Wrap around tiles

233 views
Skip to first unread message

Garthan

unread,
May 28, 2010, 12:27:37 PM5/28/10
to Google Maps JavaScript API v3
I am having a mental lapse <-- only explanation

using a pretty trivial url scheme for the images in a tileset... how
do I get the overlay to wrap around the world?


base + "/" + zoom + "/" + coords.y + "/" + coords.x + "." +
this.imgtype;


http://www.microimages.com/ogc/maps/seven42.html

Esa

unread,
May 28, 2010, 1:19:09 PM5/28/10
to Google Maps JavaScript API v3
Try in your getUrl()

function getUrl(ll, z){
ll.x = ll.x % (1 << z);
...

...
}

There is a meaningless misbehavior but I don't even remember what was
it.
http://koti.mbnet.fi/ojalesa/v3/osm_dual.htm

Garthan

unread,
May 28, 2010, 1:41:11 PM5/28/10
to Google Maps JavaScript API v3
knew it ought to be straight forward
Hmmm well it looks like it works...
http://www.microimages.com/ogc/maps/seven42.html

bratliff

unread,
May 29, 2010, 8:40:32 AM5/29/10
to Google Maps JavaScript API v3
The "mod" of a negative number is another negative number. If you
cross the International Date Line from right to left, the tile number
will be negative.

Try:

ll.x ^= (ll.x>>z<<z);

to clip off the overflow bits. It will always produce a positive tile
number.

Jim

unread,
Jun 23, 2010, 12:59:58 PM6/23/10
to Google Maps JavaScript API v3


On May 29, 5:40 am, bratliff <bratl...@umich.edu> wrote:
>
> Try:
>
>     ll.x ^= (ll.x>>z<<z);
>
> to clip off the overflow bits.  It will always produce a positive tile
> number.

I tried this but it is not working for me. I request the right tiles
but they're not displayed in the right place.

Jim

unread,
Jun 23, 2010, 1:00:30 PM6/23/10
to Google Maps JavaScript API v3


On May 29, 5:40 am, bratliff <bratl...@umich.edu> wrote:
>
> Try:
>
>     ll.x ^= (ll.x>>z<<z);
>
> to clip off the overflow bits.  It will always produce a positive tile
> number.

Reply all
Reply to author
Forward
0 new messages