Syncfusion.Maui.Maps MapTileLayer.UrlTemplate for Google Maps

Been trying to find and figure out what the UrlTemplate is for Google Maps but to no avail. I have searched everywhere including Syncfusion Help, Github Sample Demos, and Google itself. Tried numerous variations of the Syncfusion.Xamarin.Maps Uri but have been unsuccessful.

If anybody knows what the Google Maps UrlTemplate is, please post it here and if possible update the Help and Sample demos.

Thanks.


3 Replies 1 reply marked as answer

VO Vishal Omprasad Syncfusion Team June 5, 2023 10:25 AM UTC

Hi Mark,

Regarding “MapTileLayer.UrlTemplate for Google Maps”:

Your requirement can be achieved by setting the following URL to the MapTileLayer.UrlTemplate property of the SfMaps, as shown in the following code sample.

[C#]:

this.MapTilelayer.UrlTemplate = "https://mt0.google.com/vt/lyrs=y&x={x}&y={y}&z={z}";

We have prepared a simple sample based on your requirement and shared below. In the sample we have set the Google Maps’ URL to the MapTileLayer.UrlTemplate property and added few markers for your reference. Please check our sample and let us know if you have any concerns.

We hope that this helps you. Please let us know if you need further assistance.

Regards,

Vishal O.


Attachment: GoogleMap_8df64ead.zip

Marked as answer

MA Mark June 5, 2023 02:08 PM UTC

That worked thanks. However your demo doesn't work since my Google Maps key wasn't assigned but works fine in my App. To include it in your xaml file, you need to replace the '&' with '&' (include the semicolon). Also, 'lyrs=y' is satellite view and 'lyrs=m' is street view. 'mt1.google.com' works too. Not sure what the difference is between mt0 and mt1 though.



VO Vishal Omprasad Syncfusion Team June 6, 2023 09:55 AM UTC

Hi Mark,

Thanks for sharing the valuable information. Regarding “what the difference is between mt0 and mt1”, Google uses four servers to balance the load. These are mt0, mt1, mt2 and mt3. And regarding “Google Maps key wasn't assigned but works fine”, try clean and rebuild the solution, which removes temporary files and previous build outputs.

We hope that this helps you. Please let us know if you need further assistance.

Regards,

Vishal O.


Loader.
Up arrow icon