MapType.getTile seems to return the wrong thing

99 views
Skip to first unread message

Alexander Maryanovsky

unread,
Jun 27, 2011, 11:44:47 PM6/27/11
to google-map...@googlegroups.com
Hi,

I'm trying to obtain the tile nodes/URLs used by Google Maps. For some reason, however, this code:

map.mapTypes.get(map.getMapTypeId()).getTile(new google.maps.Point(0, 0), 0, document).innerHTML

returns this:

<img style="width: 256px; height: 256px; -webkit-user-select: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " src="http://maps.gstatic.com/intl/en_us/mapfiles/transparent.png">

which is clearly not the (0,0) tile at zoom 0. In fact, I've been unable to get getTile to return anything other than the above, even with different arguments.

You can examine my latest attempt at http://www.maryanovsky.com/sasha/tmp/gmtest/


Thanks,
Alexander (aka Sasha) Maryanovsky.

Chris Broadfoot

unread,
Jun 27, 2011, 11:53:41 PM6/27/11
to google-map...@googlegroups.com
On Tue, Jun 28, 2011 at 1:44 PM, Alexander Maryanovsky <msa...@gmail.com> wrote:
I'm trying to obtain the tile nodes/URLs used by Google Maps.

You can't. Sorry! What do you want this for? Access to our tiles is restricted by our terms of service, which is influenced heavily by our agreements with data providers.

--

Alexander Maryanovsky

unread,
Jun 28, 2011, 3:13:03 AM6/28/11
to google-map...@googlegroups.com
I wrote my own implementation of a library similar to Google Maps, but in Java/GWT (www.maryanovsky.com/sasha/maps/). I am now trying to add proper support for Google Maps tiles to it by accessing them via the Google Maps API (which believe is allowed by the EULA) rather than creating them myself. That's how OpenLayers do it - http://openlayers.org/blog/2010/07/10/google-maps-v3-for-openlayers/ and http://trac.osgeo.org/openlayers/browser/sandbox/ahocevar/google-ng/lib/OpenLayers/Tile/Google.js


Alexander (aka Sasha) Maryanovsky.

Rossko

unread,
Jun 28, 2011, 4:29:22 AM6/28/11
to Google Maps JavaScript API v3
> I am now trying to add proper
> support for Google Maps tiles to it by accessing them via the Google Maps
> API

If you use the API you don't need to know the tile URL, that's the
APIs job

Alexander Maryanovsky

unread,
Jun 28, 2011, 2:12:59 PM6/28/11
to google-map...@googlegroups.com
The returned node works if you simply add it to the document, so it appears that getTile adds an onload handler and replaces the src attribute with the right value once the node is actually used. Not sure what this is meant to prevent, really... It's not like one can't inspect the URL afterwards and figure out the mapping from tile coordinates to tile URLs.
Reply all
Reply to author
Forward
0 new messages