Adding Google Maps Static API as custom provider

Hi,

I understand why Google Maps was removed from the list of tile providers a while ago and I’m aware that you are not allowed to use the map tiles directly, you have to go through the API. I’ve been trying to do that using a custom provider with the Google Maps static API, but the issue I can’t get around is the “center” parameter as this is now in Spherical Mercator, which is not the same as the x and y in MapWinGIS. An example call generated through the custom provider:

https://maps.googleapis.com/maps/api/staticmap?center=**5,11**&zoom=5&size=256x256&key=*****************************

(obviously I’ve not included the key here)

If I replace 5 and 11 (in a browser) with sensible lat/long values it works fine. Is there a way I can get those values into the actual call from the MapWInGIS tile request?

My url format is below:

https://maps.googleapis.com/maps/api/staticmap?center={x},{y}&zoom={zoom}&size=256x256&key=****************************";

Can I replace x and y with something else?

Regards,

Rob H

Just bumping this - I guess no news, is bad news?

Rob H

Hello @robhoney

I had hoped that someone with more tile experience could answer this. From what little I know (and I’m sorry that I don’t have the time to verify) the map code converts the actual coordinates to tile numbers based on the selected provider (I found this Wikipedia reference here, and there are others).

I think that the OCX will always put out a URL string that uses tile numbers rather than the actual coordinates. And from what you’re saying, apparently the Google API wants the coordinates rather than the tile numbers.

So I think the only way to get these would require a modification to the OCX; perhaps adding a parameter to the Custom provider indicating that you want the coordinates within the URL rather than the tile numbers.

Regards,
Jerry.

Thanks for the reply @jerryfaust . Unfortunately, although I think I could make it work the “old way”, this seems to break Google’s terms, so looks like we’ll just have to remove it from our software for now. How likely is this to make it into a future release?

Regards,

Rob

A future release, I’d say is likely. Making it into the next release, unfortunately, is unlikely.

I’ll at least try to write it up in Jira as a feature request.

Regards,
Jerry.

1 Like