FileMaker Go Location, Part 3: Where’s My Stuff?

Location Part 3 -Where’s My Stuff?

This is Part 3 in a multi-part series about using the location functions in FileMaker Go.

Posted by  

Where Am I?

What’s Accuracy?

Where’s My Stuff?

In previous posts, we explored how the Location and LocationValues functions in FileMaker Go can get the current geographic coordinates of your iOS devices. Only knowing your current latitude and longitude doesn’t accomplish much for you if you don’t also know where other points of interest are. Where’s home? Where’s work? Where’s your next worksite? Where has The Doctor hidden his latest clue?

We don’t normally think of these locations in terms of geographic coordinates. When was the last time you told someone anything along the lines of, “Our office is at 34.755132 North, 82.268789 West”? Most of us usually communicate in terms of addresses instead: “Our office is at 10017 Pelham Road, Simpsonville, South Carolina.” If you want to know where you and your iPhone are relative to an address, you have to convert that address to latitude and longitude first.

Geocoding

This is what geocoding is for. You send an address to your geocoding service of choice, and the service returns that address’s coordinates. It isn’t a perfect science, but it’s pretty good. There are several services available, but I’ll stick with Google’s Geocoding API for now. Just format a URL with an address, and the API returns a chunk of text containing the geographic coordinates of the address. Here’s what the calculation for the URL looks like:

“https://maps.googleapis.com/maps/api/geocode/json?address=”

& GetAsURLEncoded ( $address )

& “&sensor=”

& If ( Get ( SystemPlatform ) = 3 ; // only iOS devices have location sensors

“true” ;

/* Else */ “false”

)

Now that we have a URL, we can get a response from the API using the Insert from URL script step.

Once the API sends its response, the Insert From URL step puts the result in the target field. Google’s Geocoding API can send its response in JSON or XML format, depending on what URL you use to make your request. I chose to request the JSON format.

via Location, Part 3: Where’s My Stuff?.

Liked Liked
Need FileMaker Development Help? Or to purchase FileMaker Software?
Contact FM Pro Gurus for help