ThinkGeo.com    |     Documentation    |     Premium Support

Advice on Google Overlay on Mobile

Afternoon,

Xamarin Forms app. Looking to migrate over from the Xamarin Forms Map control and Google SDK on the platforms (droid and iOS) to use your map control.

Using your map control we are currently using a Google Overlay and this uses the Google API and I am seeing quite a difference between the combination of your control and the Google API and the Forms map control and SDK when panning and zooming.

From what I have read in the forums it appears the Google API requires the use of a single tile rather than multiples.

This would explain the panning issue I see when panning as it is one big tile and not the lovely and smooth panning that the SDK provides. See shot below:


The next issue I think is going to be similar to the one above (single tile) is when zooming. On certain zoom levels the map area is not “filled”. As you can see from the shot below at the top and bottom of the view.

This is the code I am using for the Google overlay

GoogleMapsOverlay googleMapsOverlay = new GoogleMapsOverlay(googleApiKey: gAPIKey, uriSigningSecret: gUriSigningSecret)
{
	MapType = GoogleMapsMapType.Mobile
};
MapView.Overlays.Add(googleMapsOverlay);

I did see some chatter in the forums about requesting various sized tiles but this appears to be when we could choose the tile mode.

I am seeking some direction here on how best to resolve this?
Is it even possible to correct the panning and zooming issues using the Google Overlay?
Is the better solution to use another provider for the Overlay?
Other suggestions?

I hope you can assist here.
Regards
Chris …

Hey @Chris_Marassovich,

Honestly, Google has made some changes to their Static Maps API that restricts their images to a maximum size of 640x640 to anyone using their free tier and their paid tier is quite… costly. It’s actually been a recent issue that we are trying to workaround, but if you aren’t married with Google Maps, I would highly suggest another provider. Depending on your app’s workload, I can suggest a few providers.

  • ThinkGeo Cloud Maps (ThinkGeoCloudRasterMapsOverlay or ThinkGeoCloudVectorMapsOverlay) - Obviously, it’s our online map service. Being a developer, you actually already have access to a free tier of ThinkGeo Cloud using your developer login.
  • Bing Maps (BingMapsOverlay) - Cheaper to use than Google Maps, but I think their costs might still be a little higher compared to others.
  • MapBox (MapBoxStaticTilesOverlay) - Very popular for mobile and web services.
  • OpenStreetMaps (OpenStreetMapOverlay) - An excellent open source service that almost all other providers use their raw data for. The only problem is they have restrictive usage limits and will block user agents if you go over their limits.

It might also be good to implement local caching of tiles, if possible, to save costs.

Thanks,
Kyle

@Kyle_Day

We have a paid subscription and project is linked to billing account but map image is still cropped (in the image, left and right side) when using GoogleMapsOverlay… :frowning: ?

Oh well, maybe it’s on Google’s side after all…

Hey @Mikko_Viitala,

Yeah, sorry about that. Google’s latest change to their Static Maps API has made it difficult for us to use. We are exploring options without violating their TOS, but progress is slow. I would suggest looking into other service providers out there and trying them out in the meantime.

Thanks,
Kyle

1 Like

Afternoon @Kyle_Day.

I have circled back to this topic of Google Overlays on Mobile.
Users are always very keen to see Google layers … (a lot like the old IBM adage if you are old enough to recall it? Something about no one ever got fired for purchasing IBM).

I am still seeing the exact same issue here and I have a Google API Key and URL signing secret.

I assume there has been no change here in this space.
Or is there another way to get this (google overlay) functioning?

Regards
Chris …

Hey @Chris_Marassovich1,

This one is tough because of Google’s update to their StaticMap API last year. The cutoff on the top and bottom of the map isn’t the result of the SkiaSharp issue that you were seeing with OSM and other web services. It’s because Google limits the size of the image that you can get back on their StaticMap API, 640x640px at 1x resolution or 1280x1280 at 2x resolution for high dpi displays. So when your map is any large than that, you’ll have that gap.

I did notice that we are stretching the image on the GoogleOverlay when you first initialize the overlay. Once the user zooms in, it then stops the stretching. For whatever reason, this doesn’t happen if you use the GoogleLayer instead. I can look into and fix that, but that only exacerbates the gap issue as it is immediately apparent.

Alternatively, you can do MultiTile mode, but the problem with that is you’ll get the Google watermark on each tile. And unfortunately due to their TOS, we cannot modify the images to just have one watermark. This just makes your maps look bad.

Overall, it’s a pretty bad predicament for us. Undeniably, Google Maps are ubiquitous to every mobile user, but due to these new policy changes from their side, it makes is super hard to use without using their software explicitly. They also are pushing harder on using Vector mapping over images, which is good, but not really good for the WMS standard that most use. I mean, there is a reason that most mobile apps with maps in them use something like MapBox or Here Maps instead of Google as a base map provider. It might be better to look into those options instead.

Thanks,
Kyle