ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

addTileOverlaySync tileSize 512 crashing #243

Closed aligassan closed 4 years ago

aligassan commented 4 years ago

**I'm submitting a ..

cordova information: (run $> cordova plugin list)

cordova-plugin-advanced-http 2.0.5 "Advanced HTTP plugin"
cordova-plugin-background-mode 0.7.2 "BackgroundMode"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.1.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-request-location-accuracy 2.2.3 "Request Location Accuracy"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.1.0 "Cordova sqlite storage plugin - cordova-sqlite-sto
rage plugin version"
cordova.plugins.diagnostic 4.0.11 "Diagnostic"

package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)**

   "@angular/core": "^7.2.15",
  "@ionic-native/google-maps": "^5.5.0",

Current behavior:

My project is getting images weather radar from rain viewer api then add images to google map Tile Overlay . The problem is if l put value 512 in tileSize ( addTileOverlaySync ) i will get crash after run app . if i put value tileSize 256 he will working fine without crash . i Expected he working fine with size 512 , becuase if i put value 256 i will getting low res image . any idea please ?

My code

 map: GoogleMap;
  t : any;

  constructor(public http : HttpClient) { }

  ngOnInit() {

    this.http.get('https://tilecache.rainviewer.com/api/maps.json').subscribe(data=>{

      let t = data

      this.t  = t[12]
      console.log(this.t)
      })

    setTimeout(async ()=>{
     await this.loadMap()
    },2000)

  }

  async loadMap() {

    let options: GoogleMapOptions = {
      camera: {
        target: {
          lat: 33.2232,
          lng: 43.6793
        },
        zoom:6
      },
    };
    this.map = GoogleMaps.create('map_canvas',options);

    this.map.addTileOverlaySync({
      getTile: (x: number, y: number, zoom: number) => {
        console.log("https://tilecache.rainviewer.com/v2/radar/"+this.t +"/512/"+zoom+"/"+x+"/"+y+"/1/1_1.png")
        return "https://tilecache.rainviewer.com/v2/radar/"+this.t +"/512/"+zoom+"/"+x+"/"+y+"/1/1_1.png";
      },
      visible: true,
      zIndex: 0,
      tileSize: 512,
      opacity: 1.0,
      debug: false
    });

  }
}