replace missing tiles with default tile?

128 views
Skip to first unread message

Ammorth

unread,
Feb 16, 2011, 3:09:07 PM2/16/11
to google-map...@googlegroups.com
Hey everyone,

I'm currently working on a project for Test Drive Unlimited 2, where I use the Google API with a custom imageMapType that uses textures from the game.  To save on bandwidth from our server, I had created a tiled water tile in hopes I could have it displayed when a tile doesn't exist.  However, I am unable to find anywhere within the API to set or change a default tile.

I cannot do tile x,y,zoom checks as the islands are not square and therefore, need a way to either set a default tile (which loads when the tile accessed doesn't exist) or a way to check for if a file exists on the server, (using javascript) so I can return the default tile myself.

Please respond if you are un-clear/need more information.

Thanks,

Ammorth

geoco...@gmail.com

unread,
Feb 16, 2011, 3:20:59 PM2/16/11
to Google Maps JavaScript API v3
Change your getTileUrl function to return the default tile where you
want it to.

-- Larry

>
> Thanks,
>
> Ammorth

Ammorth

unread,
Feb 16, 2011, 3:46:49 PM2/16/11
to google-map...@googlegroups.com

The picture included is a schematic of my map (divided into 512 piece tiles) at the highest zoom.  The purple shaded areas are tiles which contain only water.  To reduce bandwidth, I would like to have all of those tiles load a single default image instead.  I can't do a check inside my getTileUrl function to see if the tile is a purple tile, as they don't follow a pattern easy to check (hence the switch statement).  Hence my problem.

I did a search on these forums and someone had a similar issue.  They solved it by having the server return a different image via the 404 error protocol.  I am not a webmaster, nor do I have a vast knowledge of internet re-directs and what-not.  My issue with the 404 error is that the map would be on the same server as the rest of the site.  So if someone were to 404 while browsing the site, they would be redirected to the default tile, would they not?

I am really hoping there is a way to do this within the javascript code.

Thanks,

Ammorth


geoco...@gmail.com

unread,
Feb 16, 2011, 4:14:54 PM2/16/11
to Google Maps JavaScript API v3
On Feb 16, 12:46 pm, Ammorth <kchutsk...@gmail.com> wrote:
> <http://dl.dropbox.com/u/11896898/oahu%20exmaple.jpg>
> The picture included is a schematic of my map (divided into 512 piece tiles)
> at the highest zoom.  

Pictures are not useful. Please read the posting guidelines.

> The purple shaded areas are tiles which contain only
> water.  To reduce bandwidth, I would like to have all of those tiles load a
> single default image instead.  I can't do a check inside my getTileUrl
> function to see if the tile is a purple tile, as they don't follow a pattern
> easy to check (hence the switch statement).  Hence my problem.
>
> I did a search on these forums and someone had a similar issue.  They solved
> it by having the server return a different image via the 404 error
> protocol.  I am not a webmaster, nor do I have a vast knowledge of internet
> re-directs and what-not.  My issue with the 404 error is that the map would
> be on the same server as the rest of the site.  So if someone were to 404
> while browsing the site, they would be redirected to the default tile, would
> they not?
>
> I am really hoping there is a way to do this within the javascript code.

That was what I suggested.

Larry

>
> Thanks,
>
> Ammorth

Rossko

unread,
Feb 16, 2011, 4:22:14 PM2/16/11
to Google Maps JavaScript API v3
> I can't do a check inside my getTileUrl
> function to see if the tile is a purple tile, as they don't follow a pattern
> easy to check (hence the switch statement).  Hence my problem.

This is where you need to do some thinking. How would _you_ tell
where to put these tiles? You would consult your 'master map'. You
need some way to get your javascript do something similar.
You might get it to ask your server about each tile as and when they
are requested; efficient but complex to implement. Or you might
provide it with a little look-up table so it can check which tiles
should be available or not.

Ammorth

unread,
Feb 16, 2011, 4:46:17 PM2/16/11
to google-map...@googlegroups.com
Sorry for being lazy.  I was hoping there would be something automatic (where I could exclude files and it would do all the work for me).

Either way, I'm going with a look-up table and seeing if the tile should exist or not.

Thanks to both of you for the help!

Ammorth
Reply all
Reply to author
Forward
0 new messages