Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) inserting Google map into a Sales Order field (Read 4402 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
inserting Google map into a Sales Order field
Jul 6th, 2009 at 5:28pm
Print Post Print Post  
I'm almost positive I've seen an example of this in an Inside Sesame sample file, but I looked all weekend and couldn't track it down...

When creating a Sales Order, I would like to code an image box to parse the address field, add the rest of the google map url, then pull that map into the image field so that it prints with the sales order, as a delivery aid to my drivers.  Any suggestions to point me in the right direction (type of field, and how to import/size the map image file automatically) would be greatly appreciated.
  

Larry
Back to top
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: inserting Google map into a Sales Order field
Reply #1 - Jul 6th, 2009 at 6:30pm
Print Post Print Post  
You will probably run into some difficulty obtaining the map from Google. It looks like their main map image is actually comprised of multiple images arranged on a grid with another set of transparent images on top.

You may be better off using the @ASynchShell() command in a command button to send search criteria from your form to the browser address bar and then select print from your browser.

An example of this would look like (BOLD indicates user modifiable information, GREEN indicates hardcoded values, BLUE indicates elements on your form):

CommandButton :: OnElementEntry
var vDo as Int
     vDo = @AsynchShell("http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=From+YourAddress,+YourLocation,+YourState+to+" + ToAddress + ",+" + ToCity + ",+" + ToState)
  
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: inserting Google map into a Sales Order field
Reply #2 - Jul 6th, 2009 at 10:13pm
Print Post Print Post  
Hi, Ben.

thanks for your reply.  I played around with @ASynchShell this weekend, which was a snap.  But I really don't want to have to add another two steps to my delivery ticket production (printing, collating, stapling).  Is there no way to pull a map image into an element in my Order form ?
  

Larry
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: inserting Google map into a Sales Order field
Reply #3 - Jul 7th, 2009 at 1:12am
Print Post Print Post  
lksseven,

Try this. Bring up a Google Map of a location, then save the map image to your hard drive.



Were you able to do it without taking a screenshot of your screen and cropping out everything but the visible part of the map?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: inserting Google map into a Sales Order field
Reply #4 - Jul 7th, 2009 at 5:23pm
Print Post Print Post  
We did a little research on using Google maps for this purpose. Google does provide a single image, single URL interface with an accompanying API. This would technically be quite usable from within Sesame. Unfortunately, accessing this API from a non-web-browser, for commercial use, or on an internal network, violates Google's terms of service for the free interface. Google's commercial interface is available for a $10,000 yearly fee.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: inserting Google map into a Sales Order field
Reply #5 - Jul 7th, 2009 at 6:11pm
Print Post Print Post  
Hi Erica,

I managed to contort Yahoo maps into letting me make a copy of the map image to my hard drive.  

But, if the thrust is to save a map for each client, and then link to it in an image box ... not really manageable for what I would like to do - I'd love to have the program go grab the map off the net, based upon the client's current address (enough of them move from time to time that 2 years from now enough of the static saved (now inaccurate) images would prove more of a detriment than a help).  

Thanks though!!!

Mark,
         I can only wish I had enough business to make the $10,000 yearly fee doable.  Guess I'll chalk that up to a good idea stillborn.

Larry
  

Larry
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: inserting Google map into a Sales Order field
Reply #6 - Jul 7th, 2009 at 6:23pm
Print Post Print Post  
You do not have to grab the image and save it to your drive. Sesame can set an image by specifying the URL. So if you can get the correct image address (URL) from the web site, you can display it in Sesame. Unfortunately, I would suspect that Yahoo's terms of service for free use are very similar to Google's.

Try this:

Open up an application with a user editable image field.
In update mode, double click on the image
Instead of selecting an image from your Pics directory, type in the following URL:

http://www.lantica.com/images/main/demo.png
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: inserting Google map into a Sales Order field
Reply #7 - Jul 8th, 2009 at 1:05pm
Print Post Print Post  
Mark,

I tried that and it worked !   I then tried it with some .jpg files from my website and it didn't work.  Then I tried it with some .jpg files from my computer ( file:///d:/data/.../x.jpg ) and it wouldn't pull the image into the box unless I first copied the file to the sesame directory.   I know I can add a directory to rootdirs.ini for the stuff on my computer, but don't understand why other url's didn't work.

Thanks.  Larry
« Last Edit: Jul 8th, 2009 at 2:18pm by lksseven »  

Larry
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: inserting Google map into a Sales Order field
Reply #8 - Aug 4th, 2010 at 7:25pm
Print Post Print Post  
I've been trying out some ideas with Sesame and HTTP/XML/etc... and found a neat way to accomplish this using Google's URL mapping image API. Here is some code that goes into the Form Entry event in the Customer.db sample application, but should work with very little alteration in any application with address data. LE4 is an image LE.
Code
Select All
var r_add1 as string
var r_add2 as string
var r_city as string
var r_state as string
var r_zip as string

r_add1 = @replace(Add1, " ", "+")
r_add2 = @replace(Add2, " ", "+")
r_city = @replace(City, " ", "+")
r_state = @replace(State, " ", "+")
r_zip = @replace(Zip, " ", "+")


LE4 = "http://maps.google.com/maps/api/staticmap?"
    + "center=" + r_add1 + "+" + r_add2 + "+" + r_city + "+" + r_state + "+" + r_zip
    + "&size=400x250&sensor=false"
 



Here is a screenshot of the result for one record in Customers.db:


Here are some instructions from Google for all the options available:
http://code.google.com/apis/maps/documentation/staticmaps/
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: inserting Google map into a Sales Order field
Reply #9 - Aug 5th, 2010 at 4:08am
Print Post Print Post  
Mark,

How cool is that!  Thanks!  I'll tinker with that.

I had concocted a technique of searching google for an address, such as "800 S. Tucker, Tulsa, OK map"  and it would bring up a thumbnail map.  I would then right click on the map, choose "copy image URL", and then paste that into a Sesame field in the client record.  Then when a sales order is created for that client, Sesame would read the image url and go get it and plug it into an image field in the sales order.  But Google subsequently changed their scheme for map images somehow, and the later image URL's would not work in Sesame.  So I just took to copying the thumbnail map image and saving it to the Sesame server directory, and using the field string .\maps\clientid.jpg  to pull up the image.  Sesame will send me an email alert if a customer's address changes, so that I am notified to update the map image.

Here is the old Google url schema that works in Sesame:  http://www.google.com/mapdata?CxWooycCHZ75R_og____________AQwtqKMnAjWe-Uf6QI4CSL...

Here is the newer Google url schema that doesn't work in Sesame:  http://mt0.google.com/vt/data=LtgX-e3f8ctI3U5dJtbt7EJ1ZfRneYme,_JtvVDM8f0rANa7Lu...
  

Larry
Back to top
IP Logged
 
Acebanner
Full Member
***
Offline



Posts: 123
Location: New York City
Joined: Jan 23rd, 2008
Re: inserting Google map into a Sales Order field
Reply #10 - Aug 5th, 2010 at 12:30pm
Print Post Print Post  
What a great tip! Playing around with that right now. Wondering if there's any way to get a star in the map indicating the address... maybe a little flag somewhere in the query will do it. Yeah, give me an ice cream sundae and I'm happy, but it could use a cherry on top, LOL!

Edit: I did find this link on using Static Google Maps

http://code.google.com/apis/maps/documentation/staticmaps/

When I changed the submitted url to what appears below I was able to get the marker in the middle, showing the address.
Code
Select All
"http://maps.google.com/maps/api/staticmap?" + "&markers=size:mid|color:red|" + r_add1 + "+" + r_add2 + "+" + r_city + "+" + r_state + "+" + r_zip + "&size=500x225&zoom=16&sensor=false" 



The zoom code was also useful (from 1, showing entire planet, down to 21 which shows buildings.)

Great tip -- just another example of why I visit this forum regularly!
« Last Edit: Aug 5th, 2010 at 1:46pm by Acebanner »  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: inserting Google map into a Sales Order field
Reply #11 - Aug 5th, 2010 at 1:12pm
Print Post Print Post  
Yes. On the link I posted toward the bottom, there is a section on adding "markers" to the image.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: inserting Google map into a Sales Order field
Reply #12 - Aug 8th, 2010 at 8:54pm
Print Post Print Post  
Cool! I've been using a command button to open Google Earth to view an address, and another command button to view the address at Maps.Live.com in the browser, but I never thought of putting the map right on the form like that. All we need now is an interactive map on the form. Wink
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: inserting Google map into a Sales Order field
Reply #13 - Aug 9th, 2010 at 1:07pm
Print Post Print Post  
Quote:
All we need now is an interactive map on the form. Wink


Entirely doable.While playing with it, I added a zoom feature using command buttons. You could easily add buttons that scroll the center point using the lat/long centering.

Additionally, Google also provides a chart/graph system that is also extremely easy to set up and use in Sesame.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Renato Piacenti
Member
*
Offline


No personal text

Posts: 48
Location: Manaus - Amazonas - Brazil
Joined: Jun 20th, 2005
Re: inserting Google map into a Sales Order field
Reply #14 - Aug 11th, 2010 at 6:06pm
Print Post Print Post  
Very helpful to this topic.
It is possible to save the image as a JPG or PNG?
  

Renato Piacenti&&Manaus Amazonas Brazil&&Aqui a Floresta esta sendo preservada.&&Preserve a sua tamb�m.
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print