[Google Maps Library] google maps polyline issue on Iphone

Forge Component
(26)
Published on 26 Feb by Labs
26 votes
Published on 26 Feb by Labs

we have an application using the google maps mobile plugin. we are facing a strange issue in a screen where we are showing a route including 2 markers, A as start and B as end of the route. Initially the route is shown properly, however after showing about 20 routes, the routes no longer are shown on the map. we are using a javascript to draw the polyline on the map, please find the javascript below. This issue is only apearing on Iphones, on android phones we do not see this issue. In our search for a solution we have removed the polyline, showing only start and end markers on the map.This works fine, even after over 20 routes. So it seems the polyline is causing some issues after a while. 

we are using outsystems in the cloud and version is Version 10.0.828.0.

any help is greatly appreciated,

regards, Hille

function addMarkersToMap(data, colors, bounds, start, end, containerId) {
   
        var map = new google.maps.Map(document.getElementById(containerId), {
          zoom: 2,
          center: {lat: 0, lng: -180},
          disableDefaultUI: true,
          mapTypeId: 'roadmap'
        });
       
        /* use bounds to determine the zoom */
        map.fitBounds(bounds);
       
        var marker = new google.maps.Marker ({
            position: start,
            map: map,
            title: 'A',
            label: 'A'
        });
       
        var marker2 = new google.maps.Marker ({
            position: end,
            map: map,
            title: 'B',
            label: 'B'
        });
               
        var Path = new google.maps.Polyline({
          path: data,
          geodesic: true,
          //strokeColor: colors[1],
          strokeOpacity: 1.0,
          strokeWeight: 5
        });
       
         Path.setMap(map);
}

Hi Hille,
I know this is an old thread but we are having similar issue with google.maps.Polygon ... each time screen is displayed a bunch of canvas elements with 512x512 size is created. And after some time we have a memory limit warning and polygon stops to be drawn on the map... Basically we discovered then when using polygon around 15 canvas element are created and are never removed (garbage collected) by Safari and each has 512x512 dimensions and 1Mb of memory... 



PS: To not create multiple threads we can use this one https://www.outsystems.com/forums/discussion/62402/how-to-draw-a-polygon-marker-in-a-single-map-mobile-app/#Post248473