Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 1854 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Find a friendly geocoding API and get it from there. 

In the past I used Google Maps for this, but now they require a billing account even for the free tiers.

 

Posted
10 minutes ago, comment said:

Find a friendly geocoding API and get it from there. 

In the past I used Google Maps for this, but now they require a billing account even for the free tiers.

 

I have a free API key using google maps but i don't know how pull the lat and long from there.

Posted (edited)

If they didn't change it, then you have two options: import an XML response, or get a JSON response and parse it.

I suggest you try the JSON route first: for testing, define a global text field, then use the Insert From URL script step to place the response in this field. The URL needs to be calculated from your address fields - something like:

"http://maps.googleapis.com/maps/api/geocode/json?address="
&
Substitute ( List ( Street ; City ; State ; Country ) ; [ " " ; "+" ] ; [ ¶ ; "+" ] ) 
&
"&key=YOUR_API_KEY"

This should populate the global field with a JSON response like the one shown here.

 

Then you can parse out the latitude using:

JSONGetElement ( YourTable::gTestfield ; "results[0]geometry.location.lat" )

and, of course, for longitude change the last key to "lon".

 

Once you have it all working, you can replace the global test field with a script variable.

---
Caveat: the response may contain more than one address; you should test for this and, if necessary, let the user select the correct one.

 

 

Edited by comment
  • Like 1

This topic is 1854 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.