a14n / dart-google-maps

A library to use Google Maps JavaScript API v3 from Dart scripts.
Apache License 2.0
130 stars 66 forks source link

Google Maps Point has no such method "y" when using getTileUrl #61

Closed EDToaster closed 6 years ago

EDToaster commented 6 years ago

In my webapp, I am using a custom Tile Server to get the map tiles.

However when using ImageMapTypeOptions and setting getTIleUrl by using the following code:

ImageMapTypeOptions()
      ..getTileUrl = (g.Point coord, double zoom) {
        return "https://..url../$zoom/${coord.x}/${coord.y}?access_token=$API_KEY";
      }

I get the error that coord has no method "y".

When using the code print(coord.y), i always get "null" as output.

Cheers!

a14n commented 6 years ago

getTileUrl is a little special to work with and you cannot directly set this function (I hadn't time to improve that).

To make it work you can have a look at:

https://github.com/a14n/dart-google-maps/blob/e8199659920c59b1d573583a1dcd8f10e5ae9f42/example/01-basics/map-projection-simple/page.dart#L108-L132

EDToaster commented 6 years ago

Thanks, will check out.

a14n commented 5 years ago

In version 3.4.0 you can now directly use getTileUrl setter

https://github.com/a14n/dart-google-maps/blob/f4d7e0f8a149d0773df02aff5db2e05c0055d37b/example/01-basics/map-projection-simple/page.dart#L107-L122