9 Replies Latest reply on Mar 5, 2015 5:17 PM by perren

    polyline google maps problem GPS coordinates

    ouuzi

      Hi to all First post here!!!

      I am developing a simple database for our helicopter company.My main job is an engineer and I am not really an expert in Filemaker.

      I have started with a template from this post (DevCon 2012 Session Recording: Mapping and Geolocation with FileMaker 12) and I am at a point where I need to connect the markers on the map. I am using an html field with the following code:

       

      <!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(

        [[MarkersArray]]

        );

       

        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;

        }

       

       

        var end = markers.length;

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

        addMarker({

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

        title: "Marker "+i,

        info: markers[i]['info']

        });

        }

              var polyline = new google.maps.Polyline({

                  map: map,

                  path: MarkersArray,

                  strikeColor:"#0000FF",

                  strokeWeight:1

                  });

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

        infoWindow.close();

        });

        map.setCenter(markerBounds.getCenter());

        map.fitBounds(markerBounds);

      }

      </script>

      </head>

      <body onload="initialize()">

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

      </body>

       

       

      </html>

       

      I can not get the points to connect.What I doing wrong?With orange is the part that I have added.

      Thanks a lot in advance!!!

      Dimitris