mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 914 forks source link

addTileOverlay getTile function not always working as expected. #1743

Closed nicholasgcoles closed 6 years ago

nicholasgcoles commented 6 years ago

I'm submitting a ... (check one with "x") [ ] question [x] any problem or bug report [ ] feature request

The plugin version: (check one with "x") [x] 2.0-beta3 (github) [ ] 2.0 (npm)

If you choose 'problem or bug report', please select OS: (check one with "x") [x] Android [ ] iOS

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 2.4.0 "Google Maps SDK for iOS"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 2.0.9-beta-20170914-1830 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"

If you use @ionic-native/google-maps, please show me the package.json

Current behavior:

I try overlay a whole bunch of tiles which are on s3 using the addTileOverlay and getTile function. I have multiple polygons which I change between and zoom in and out different levels and pan around the map etc.

I store the tile overlay object and then whenever I change to a new polygon I remove the previous tile overlay object and add the new one.

Expected behavior:

Generally with the first polygon I select, the tiles overlay correctly and I can zoom in and out and they adjust correctly. However when I change back and forth between polygons (removing the tileOverlays each time), when I log to the console the x,y and zoom parameters they jump around between the different zoom levels. Then it keeps logging to the console multiple times even though I am not moving around the map at all.

Here is an image of the console log of the x,y,zoom when the map is dead still. image

If I keep the map still for long enough (possibly 2/3 minutes) it eventually starts getting the correct x,y and zoom and then the tiles overlay.

Is this a known issue / work around available?

Or is it possibly due to the fact that I am zooming in too quickly and for some reason the getTile function can't handle it?

I have attached a function "overlayNewTiles()" and if I say keep running that function and refreshing the tiles it seems to keep going back to a lower zoom level instead of starting immediately at the current zoom level of the map.

Steps to reproduce:

Screen capture or video record:

Related code, data or error log (please format your code or data):

overlayNewTiles() { 
  this.currentTileOverlay.remove();
  this.map.addTileOverlay({
    tileSize: 256,
    getTile: function(x, y, zoom) {
     console.log(x,y,zoom);
    }).then(tileOverlay => {
      // Keep track of the tile overlay
     this.currentTileOverlay = tileOverlay;
    })
 }
wf9a5m75 commented 6 years ago

@ionic-native/google-maps v4.3.1 has been released. Please use it with the multiple_maps branch.

wf9a5m75 commented 6 years ago
$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="..." --variable API_KEY_FOR_IOS="..."  --verbose --no-fetch

$> npm install @ionic-native/core @ionic-native/google-maps --no-fetch

1743