Jump to content
Server Maintenance This Week. ×

Track the Mileage


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

Recommended Posts

I would suggest using the 360Works ScriptMaster plugin for this. The included GetURL As Text function can be used, with a URL such as:

http://maps.google.com/maps?q=from+FROM+to+TO&output=kml

where FROM=from zip code or address and TO=ending address or zip code.

The Position function may then be used to parse out the text results from this function. The data you want lies between "CDATA[Distance:" and "

" -- extract distance in miles or km, drive time, etc.

Alternately the WebViewer can be used for this, but it requires a webviewer layout element (even if only one pixel).

Link to comment
Share on other sites

  • 2 months later...
  • Newbies

If you want to do this entirely in Filemaker with one calculation, here is the calculation and data set for determining the distance between any two US ZIP codes.

I did this recently as part of another project. I created a distance formula by recoding one from Excel and then used freely available data that lists the lat lon for all US ZIP codes. Here is the equation:

##code start:

If (

_CountryID ≠ "001" or IsEmpty (PostalCodes::Latitude);

5000;

Round (

6371 * 2 * Asin (

Sqrt (

( Sin ( ( Radians (_gSearch_Latitude) - Radians (PostalCodes::Latitude) ) / 2 ) ^ 2 )

+

Cos ( Radians (_gSearch_Latitude) )

*

Cos ( Radians (PostalCodes::Latitude) )

*

( Sin ( ( Radians (_gSearch_Longitude) - Radians (PostalCodes::Longitude) ) / 2 ) ^ 2 )

)

);

0

)

)

# code end

I had multiple country data in my set, so I used the if() so that it only calculated distances for US addresses. The ZIP code data set is attached.

US.zip

Link to comment
Share on other sites

This topic is 4866 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
×
×
  • Create New...

Important Information

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