Jump to content

Calculate distance between 2 addresses


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

Recommended Posts

  • Newbies

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Newbies

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 2535 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
 Share

  • Similar Content

    • By Tumma K
      Hello, All!

      I am an aspiring developer for Filemaker. The company I work with is stuck in the past working off of Filemaker Pro 4.1

      I was given the task of bringing us up to Filemaker Pro/Server 13. So far my conversion prototypes are successful but we recently had a layout issue that can only be fixed in versions 3-6 (as the file is an .fp3) I work off of a macbook while our network is all Windows 7. In order for me to repair the layouts without tampering our active database, I decided the best option is to repair a copy of our solutions off the network. Unfortunately, when I go to download the trial version of Filemaker Pro 6 off of the respected website, the file is corrupt! I've tried multiple times, with different extraction apps and in different directories.

      My question is;

      Does anyone know a place where I could obtain version 6 (or better yet, 4.0) for an OSX computer? I've looked everywhere!
       
      Thank you for your time,
      Tumma K.
    • By MrEddByrnes
      I'm hoping my question can have a happy ending. In the mid-90's, I purchased Filemaker 3. When Filemaker 5.5 Pro was released, I bought the update CD, which requires the user to either have FM 3 installed or to have the installation CD for FM 3. I've used it all these years, most recently with Windows XP Pro, and it has worked just fine. The databases I began with were long ago converted to FM Pro 5.5 databases.
       
      I'm still using FM Pro 5.5 on a laptop with WinXP Pro, but in 2013, I purchased a PC with Windows 8. I haven't been able to install FM 3 on it, therefore can't install FM Pro 5.5. I am retired and rarely use Filemaker, but I have a few Filemaker databases I'd like to add to my Win 8 machine. I don't feel it's worth upgrading FM for the sake of using a couple of databases.
       
      Has anyone else run into this situation and/or have a (possible) solution? Is there perhaps any other software that can read FM 5.5 databases? Thanks in advance for your help.
       
    • By bmill
      I am using a custom filemaker solution for medical office billing written with fp5 running on a mac with snow leopard. In addition, I have a patient management db (which I wrote) that is linked through pt. ID number to the billing program allowing transfer of some demographic information (name, DOB, etc).
       
      Other than being limited by hardware restrictions, the billing program serves our needs for now and upgrading to fp12 will take some time (and money).  In the meantime, I am upgrading my pt. management program to fp13 and would like to move new patient demographic information from the billing program ( fp5 running on snow leopard through Parallels) and the new pt management program ( fp13 running on OS X 10.9) on the same mac.   
       
      Ideally, demographic information would be entered once into fp5 and then a scipt would make the data available for fp13.
       
      Any ideas on how to make this work?
    • By randyinla
      Hi, can anyone tell me why my on-line database might have stopped allowing me to delete records?  All of my access privileges and passwords are correct.
       
      thanks!
    • By randyinla
      Hi, I still use filemaker 5.5 and am very happy with it and don't want to upgrade.  Does anyone still host filemaker 5.5?  Thanks!
  • Who Viewed the Topic

    9 members have viewed this topic:
    ellarose  Saurabh Gupta  Siva D  MMHinSEA  Andreas T.  seansku  Toni  Noakess  cmdrsalamander 
×
×
  • Create New...

Important Information

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