[OpenLayers-Users] Custom TMS layer shifted to the north
Michael Heigl
michael.heigl at yahoo.de
Wed May 12 13:32:32 EDT 2010
Hi together,
I've set up a small test page to integrate a custom TMS Layer into OpenLayers. The tiles are displayed correctly but when I place a marker on the map it is placed north of the real position. Example:
http://www.uecmoedling.at/maptest.html
Mapnik layer is shown by default: shows the correct position
when switching the layer you get to a position which is exactly to the north of the real position
Maybe anyone can give me an hint which parameters I need to adjust to fix this shifting? I tried to modifiy the north/south bounds but this resulted in the marker changing position depending on the zoom level.
I got the following information from the people how manage the tile server but I don't know exactly what to do with these infos to make it work in OpenLayers:
The number of grids at a given zoom level is: gridWidth = 2^zoomlevel
The (earth) radius for the Mercator map projection is calculated as radius = (gridWidth * tileSize) / (2.0 * PI) where tileSize=256.
The x and y grid indexes are given by the calculated Mercator coordinate divided by the tile size:
xGrid = xCoordinate / tileSize
yGrid = yCoordinate / tileSize
Mercator coordinates will range from 0 through (gridWidth * tileSize).
The origin for the grid coordinates is at 180° W (false easting = radius * PI), and approx 85° N (false northing = -radius * PI), with x increasing toward the East and y toward the South. The scale (mpp) is determined by scale = radius * 2.0 * PI / (gridWidth * tileSize)
Other customers use an inverse flattening value of 298.257223563; so the projection is actually Mercator-ellipsoidal.
Thanks very much,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100512/b597ef76/attachment.html
More information about the Users
mailing list