Sounds Essential is a trusted partner on several demanding and highly complex development projects. Their technical skills, creativity, and most importantly, their grasp of our business needs has helped our company deliver sophisticated solutions to our (very happy) clients. Even when projects reach the "intense" stage, we really enjoy working with Sounds Essential.
Digital Spark LLC
Capturing Map Coordinates Into FileMaker
What is an API?
If you really want to dig into the answer to this question, head over to Wikipedia and knock yourself out! For our purposes, the following definition will suffice:
An application programming interface (API) is a particular set of rules ('code') and specifications that software programs can follow to communicate with each other. It serves as an interface between different software programs and facilitates their interaction, similar to the way the user interface facilitates interaction between humans and computers.
So, from within FileMaker we're going to communicate with Google Maps through the API. Now that's taken care of...
Again according to the mighty Wikipedia:
The basic concepts of what we will be doing are:
- Place a web viewer on a layout.
- Immediately after this, we call a FileMaker script in our database using the FMP URL protocol, passing parameters which set variables with the latitude and longitude. Then in our script, we use the values in these variables to set the latitude and longitude fields.
- As a bonus feature, we also have a starting address field, which is used when the map is first loaded to center the map on this location. The address is geocoded (converted to latitude and longitude) and then these coordinates become the center of the map.
If you wish to integrate capturing coordinates into your FileMaker solution, what do you need to be aware of?
API Key - this demo does not have an API key, but it is suggested and recommended that you get one of these from Google. It is free to get one and the use of the API is free within limits. Be sure to familiarize yourself with the usage guidelines before implementing and sending any solution live.
Fields - the FileMaker Latitude and Longitude fields are referenced in the script that sets the coordinates into the fields. The HTML andStart Address fields are referenced in the web viewer.
There are plenty of comments in the code on the HTML tab to assist porting this over to your own solution.
This demo should be compatible with FileMaker Pro 13 or 14 and FileMaker Go 13 or 14. It is recommended that you have the latest updates installed for the applications.
The FMP URL protocol is not supported in WebDirect, and therefore this demo will not work in WebDirect.
Update 2015-09-09: As noted in HomeBase Software's post on the same subject, this demo will not work when deployed as a runtime solution as the FMP URL protocol is configured when FileMaker Pro is installed. There might be a way to dig into the OS and set up the protocol manually, but we have not attempted this and it falls outside of the scope of this article.
Finally, the demo file...
You can download the demo file here.
While this demo is not compatible with WebDirect, we have implemented grabbing coordinates into FileMaker from a web viewer located on a WebDirect layout. It's a lot more involved but we'll look at doing a blog post on this technique in the near future.
Have fun with the demo and implementing the technique in your own solution. If you need help, don't hesitate to get in touch.
Check out our second post on this subject, which modifies the demo file to have a marker drop when the record loads if previously selected coordinates exist.
- Tags: FileMaker