4 Replies Latest reply on Nov 15, 2012 11:31 AM by RogerAC

    Using Google Map miles




      I have a layout that shows the Google Map of my destination and I am wondering if there is anyway that I can collect the mileage that it shows when entering the post codes of home and destination.


      I use mileage within the database and currently have to enter each one for every job that I go to and it be a great help to be able to trap the mileage shown and for it to be entered automatically into the database.


      I am using Filemaker 12 Advanced on a Mac.


      Thanks for you help.



        • 1. Re: Using Google Map miles

          you can probably do a webscrape for it to grab it out of the returned google maps site code. Scraping uses the insert from URL script step to grab the HTML source of the web viewer.


          You then tell filemaker to go through this "scraped" data, looking for the specific html tag or object for your data, then parsing that out.


          So if google maps used <div class="altroute-rcol altroute-info">138 mi</div>, you would calculate something like:

          Let ( [

             position = position(html ; "altroute-rcol altroute-info" ; 1 ; 1 ); //the position of where this class starts.

              position2 = position(html ; "</div>" ; 1 ; position ); //the position of where the div closes

             startpoint = position + 29 //make sure you start at the right character


             middle(html ; start ; position2)


          • 2. Re: Using Google Map miles

            Thanks Mike I new there was a posible solution out there.


            i will add this in and see how it works out over time.



            • 3. Re: Using Google Map miles



              You can also use the Google Direction API with the script step insert from URL :


              Then using a Custom Function, you could get whatever info returned by the API ( Distance or even Duration)


              See attached example file. (May not be error free)



              • 4. Re: Using Google Map miles

                Thank you Thomas


                I like this idea and the sample you have attached as it gives me a lot more food for thought than I had considered.