[OpenLayers-Users] resoloution and tile x and y

Chris Adams chris at genieknows.com
Fri Aug 29 15:07:10 EDT 2008


if: pixel = tilexy * tilesize

and: res = ll / pixel

then: ll = res*pixel

if: tilesize = 300
and: tilexy is always offset by 0.5 (the center)

then:

lat = (tiley + 0.5) * 300 * res
lon = (tilex + 0.5) * 300 * res

but because we don't view the world upside down, i.e. latitude increases 
as y decreases..

lat = (-tiley + 0.5) * 300 * res
lon = (tilex + 0.5) * 300 * res

Kenny France wrote:
> Hi Guys,
>  
> Im finally getting somewhere with the help of Chris Adams (Thanks Again)
>  
> I have a map gererated, that is going to ultimatly grab image tiles 
> from my server
>  
> I now know that if my tile is 300 Px and i need a resoloution of 5,12 
> dd the calculation is
> 5.12 / 300 = 0.017066667
>  
> In my sample i am simply displaying the pink tiles for now, but it is 
> trying to pull from my url, using the getfile function in the example
>  
> so it shows get_tile.php?z=1&x=21&y=28
>  
> where z = zoom
> x = tile number in the x position
> y = tile number in the y position
>  
> No by knowing the zoom level tile number etc, how could i calculate 
> the center lat/lng of the tile needed?
> I thought it would be simple but how will i figure out if the lat/lng 
> are negitive values
>  
> Please help me once again
>  
> K-
>
> ------------------------------------------------------------------------
> I am using the free version of SPAMfighter for private users.
> It has removed 38312 spam emails to date.
> Paying users do not have this message in their emails.
> Try SPAMfighter <http://www.spamfighter.com/len> for free now!
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   




More information about the Users mailing list