archrid404 Posted November 15, 2019 Posted November 15, 2019 What's the process of getting lat and lon base on the address entered to filemaker.
comment Posted November 15, 2019 Posted November 15, 2019 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.
archrid404 Posted November 15, 2019 Author Posted November 15, 2019 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.
comment Posted November 15, 2019 Posted November 15, 2019 (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 November 15, 2019 by comment 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now