Page 1 of 1
How get GPS coordinates from adresse List within Stack
Posted: Sat Apr 27, 2013 2:29 pm
by Partenaire
Hello to all,
I would like to get the latitude and longitude positions from several points. How is it possible?
In a field i have the point (Name,adresse,ZIP, Town)
After the loop from this field, i get only Adress,ZIP,TOWN but how get GPS coordinates for each adresse?
I search in this Forum without success how to do that!
Thanks for yours Help
Eric
Re: How get GPS coordinates from adresse List within Stack
Posted: Sat Apr 27, 2013 3:14 pm
by Dixie
Eric...
Code: Select all
on mouseUp
ask "Address"
if it is empty then exit mouseUp
put it into theAddress
replace space with "+" in theAddress
put "http://maps.googleapis.com/maps/api/geocode/xml?address=<addGeo>&sensor=false" into theURL
replace "<addGeo>" with urlEncode(theAddress) in theURL
put URL theURL into returnedData
replace space with empty in returnedData
put lineOffset("<lat>",returnedData) into lat
put lineOffset("<lng>",returnedData) into lng
put line lat of returnedData && line lng of returnedData into theResult
replace "<lat>" with empty in theResult
replace "</lng>" with empty in theResult
replace "</lat> <lng>" with comma in theResult
put theResult
end mouseUp
Dixie
Re: How get GPS coordinates from adresse List within Stack
Posted: Sat Apr 27, 2013 3:44 pm
by Partenaire
Dixie,
Thanks You very Munch.
After several hours finding, you give me a speed solution. Fantastic
And Tomorow , i can go back my coding.
You are the King
Have a nice day.
Eric
Re: How get GPS coordinates from adresse List within Stack
Posted: Sun Apr 28, 2013 10:22 am
by Partenaire
Hi Dixie, Hi Alls
Your code work very well when no accented letter in "Adress" of my field. I need to change accented letter before use function (yourcode) to get GPS coordinates.
I build this code to do that. Sure easier is possible.
I will be happy to read any opinion about this code
Code: Select all
constant letteraccent="áàâäãåçéèêëíìîïñóòôöõúùûüÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜ"
constant letterNoAccent="aaaaaaceeeeiiiinooooouuuuaaaaaaceeeeiiiinooooouuuu"
function Atraiter
local theData,theDataA,counter
put fld "data2" into theData
if theData is empty then exit top
set itemdel To TAB
repeat for each line L in TheData
add 1 to counter
put item 2 of L & " "& item 3 of L into thedataA[counter]["nom"]
put item 4 of L & comma & item 5 of L &comma &item 6 of L&comma&&item 7 of L into thedataA[counter]["adresse"]
-- check adresse accented letter
local letterNoAc,theAdresse
put empty into theAdresse
repeat for each char C in thedataA[counter]["adresse"]
put C after theadresse
put char offset(C,letterAccent) of letterNoAccent into letterNoAc
if letterNoAc is not empty then
replace C with letterNoAc in theadresse
end if
end repeat
put theAdresse into thedataA[counter]["adresse"]
end repeat
put getGPS(ThedataA) into theDataA --function
After getting GPS coordinates i use a html script from Livecode Forum To Bangkok (thank for him), and It is possible to have a google Maps with markers. Nice
Eric