8 Replies Latest reply on Nov 9, 2012 7:26 AM by pnajar

    Maps

    pnajar

      I track a number of ships through out the world. For each ship I track I get a periodic update that updates their Latitude and Longitude. Is their a way to project the current location as well as past locations on a map within Filemaker (12)?

        • 1. Re: Maps
          brsamuel

          Though I have no experience with this type of situation, I would bet that it can be done using a web viewer and Google Maps.

          • 2. Re: Maps
            psijmons

            pnajar,

             

            attached is an example I received from via the FMSummit in Antwerpen, showing how to use the geocodes in a webviewer.

            Take note of the custom functions that are used.

            1 of 1 people found this helpful
            • 3. Re: Maps
              filemaker@i-absolute.com

              Hi pnajar,

               

                   i'm working in a similar project and my starting point is the example file that psijmons attached.

               

              Cheers, Fabio.

              • 4. Re: Maps
                pnajar

                Thank you very much for the example. It will take me a little while to understand it. Are there any additional explanations fort the design of the example?

                • 5. Re: Maps
                  psijmons

                  In the example file, just look at the first 2 scripts (the other script were added by me just to do some testing), see how the webviewer is defined and look carefully at the custom functions.

                  You do not have to change anything in the code, just add to your solution:

                  • fields
                  • customfunctions
                  • scripts
                  • webviewer calculation

                  When you link it to your correct LNG / LAT geocode fields where appropriate.

                  Since you are already working with the geocodes and not addresses, you do not have to convert addresses, making it a lot simpler.

                  You need to feed an array of geocodes to HTML to display in the webviewer.

                   

                   

                  Here is an example HTML that is generated and will display the pointers right away:

                   

                   

                  <!DOCTYPE html>

                  <html>

                            <head>

                                      <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

                                      <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>

                                      <title>Google Maps Test</title>

                                      <style type="text/css">html, body {  height: 100%;  margin: 0;  padding: 0;}#map_canvas {  height: 100%;}</style>

                                      <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>

                                      <script type="text/javascript">

                                                function initialize() {

                                                          var myOptions = {

                                                                    zoom: 5,

                                                                    center: new google.maps.LatLng(46.52863469527167,2.43896484375),

                                                                    mapTypeId: google.maps.MapTypeId.ROADMAP,

                                                                    mapTypeControlOptions:{

                                                                              mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID]

                                                                                                                                }

                                                                                                            };

                                                          var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

                                                          var markerBounds = new google.maps.LatLngBounds();

                                                          var markers = new Array(

                                                                    {"position":new google.maps.LatLng(37.4065103,-121.9842093)},

                                                                    {"position":new google.maps.LatLng(37.3308050,-121.8938260)),

                                                                    {"position":new google.maps.LatLng(37.3313684,-122.0306825)},

                                                                    {"position":new google.maps.LatLng(37.7843800,-122.4244850)}

                                                                                                                      );

                                                          var infoWindow = new google.maps.InfoWindow;

                                                          function addMarker(options){

                                                                    var marker = new google.maps.Marker({map:map});

                                                                    marker.setOptions(options);

                                                                    google.maps.event.addDomListener(marker, 'click', function() {

                                                                              infoWindow.setContent(marker['info']);

                                                                              infoWindow.open(map, marker);                    });

                                                                    markerBounds.extend(options.position);

                                                                    return marker;          }

                                                          google.maps.event.addListener(map, 'click', function() {

                                                                    infoWindow.close();          });

                                                          var end = markers.length;

                                                          for(var i=0; i<end; i++) {

                                                                    addMarker({

                                                                              position: markers[i]['position'],

                                                                              title: "Marker "+i,

                                                                              info: markers[i]['info']                    });}

                                                          map.setCenter(markerBounds.getCenter());

                                                          map.fitBounds(markerBounds);}

                                                </script>

                            </head>

                            <body onload="initialize()">

                                      <div id="map_canvas"></div>

                            </body>

                  </html>

                  • 6. Re: Maps
                    pnajar

                    Thanks for the help. This example will take me, a FileMaker novice, sometimes to assimilate. Improving FileMaker skills is the goal of this project.

                    • 7. Re: Maps
                      ThomasKunetz

                      Hi,

                       

                      If you can bear a bit of French, here is a full explanation webinar plus all samples :

                       

                      Séminaire Web Cartographie et géolocalisation Lundi 9 juillet de 11h à 12h

                       

                       

                      Or if you have attended Devcon in Miami it's the sesison INT005

                       

                      Tom.

                      1 of 1 people found this helpful
                      • 8. Re: Maps
                        pnajar

                        Again thanks. As it turns out French is my second language.

                         

                        Much appreciated

                        Peter