Newbies keithcraig Posted June 13, 2014 Newbies Posted June 13, 2014 Hello can someone please tell me how I can return a value that is the Kilometres between two addresses. The addresses are from my database are Starting Address and Destination address. I don't need travelling directions, just the calculated distance. Preferably using Google maps Australia I have FM8
comment Posted June 13, 2014 Posted June 13, 2014 The question is not quite clear: if you want to get the distance from Goggle each time you need it, then there is no calculation of distance involved (at least not on your part). OTOH, if you want to calculate the distance yourself, then you will need each address to have a latitude and a longitude. If you're using version 8 (i.e. no web viewer), then perhaps you should look into that.
Newbies keithcraig Posted June 13, 2014 Author Newbies Posted June 13, 2014 Sorry I didn't make my self very clear. I have address fields ie Street, Suburb,State, for the departures and another fields ie Street, Suburb,State for the arrivals. What I would like to do it press a script button that would return the distance in a different field. With this information I can workout a delivery cost. Hope that helps. I am thinking of upgrading to FM13 but at the moment I have Windows Vista and FM13 wont work
comment Posted June 13, 2014 Posted June 13, 2014 This is going to take some work. First, study the Google Maps Distance Matrix API to find out how to calculate the URL for the HTTP request from your data. To get the response into a field, you will need to import it, using Import Records from XML source. For this, you will also need an XSLT stylesheet to transform Google's XML to Filemaker's grammar. Note that Filemaker (< v.13) can only import XML from an HTTP request, not HTTPS.
Lee Smith Posted June 13, 2014 Posted June 13, 2014 Hi Keith, and welcome to the FM Forums, I moved your topic from "FileMaker Legacy Versions 7 – 9" to "Calculation Engine (Define Fields)” because, the General Topics, including FileMaker Legacy Versions, are restricted to questions about the tools, functions and features that were introduced in the version named, and not for asking How-To questions. We have this topic for Calculation Questions. Lee
jbante Posted June 15, 2014 Posted June 15, 2014 I am thinking of upgrading to FM13 but at the moment I have Windows Vista and FM13 wont work When you do get around to upgrading to 13, this process can get a little easier (if you don't already know XSLT) because you'll have the Insert From URL script step available to you. You'll be able to request XML or JSON as you prefer and parse the result with FileMaker's own text functions. This blog post describes the process. Does your application also show locations on a Google Map? You'd be violating Google's license terms to use the Distance Matrix API (or any other from the Google Maps family of APIs) and not include a Google Map in your application. The MapQuest Route Matrix API is an alternative to Google's Distance Matrix API with different licensing restrictions. 1
sal88 Posted July 18, 2014 Posted July 18, 2014 Very nice solution! I'm wondering if it's possible to pull the distance value from a map that is currently in the web viewer. i.e. the user might have used a different route to the one that Google Maps proposes (but same origin and destination). Therefore it would be great if the user could define the route they took by dragging the nodes within google maps on the web viewer, which then outputs the new distances.
Gyrodude Posted August 26, 2014 Posted August 26, 2014 I keep finding responses telling us that the Google Distance API must be displayed in a Map for licensing purposes, but not how to accomplish this in FileMaker. I'm writing an application that pulls the API information into a text field so I can get the distance value (JSON) but I haven't figured out how to get this to the web viewer for displaying the route. Can someone please post an example of how this works? Thanks
Gyrodude Posted August 26, 2014 Posted August 26, 2014 Answered my own question with a workaround. The agreement is that the data captured from the API must be used in a MAP but it doesn't specify how that data gets to the map. So I created a Web Viewer object and via a script, I represent the same query via Googles standard map display: "https://www.google.com/maps/dir/" & <Table>::MAP_City_Start & "+" & <Table>::MAP_ST_Start & "/" & <Table>::MAP_City_End & "+" & <Table>::MAP_ST_End Since the data returned via the JSON is identical to the data via google/maps in a web viewer, it's legally represented. Thanks
jbante Posted August 26, 2014 Posted August 26, 2014 A different way to satisfy the license terms is to choose a service with more lenient license terms. The OpenStreetMap APIs are as loose as it gets, requiring only conspicuous attribution, but OpenStreetMap doesn't have an API for transit distance or directions. However, MapQuest has an "open" version of their directions API based on OpenStreetMap data with similar license terms.
Recommended Posts
This topic is 4111 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 accountSign in
Already have an account? Sign in here.
Sign In Now