Hi,
I have implemented server side script to calculate BBOX for tileX,tileY. But it seems there's some mistake in calculating BBOX. I get tiles, but with Y-offset of more than 128 px. Can you please share me server side script to interpret NutiteqStream tile request URL, which calculates BBOX to get tiles for tileX,tileY?
Pseudo code algorithm is also fine.
Also I am pasting my code snippet which does tileX,tileY to BBOX conversion, incase you can point error -
------------------
while(@xy){
$tileX = shift(@xy);
$tileY = shift(@xy);
$mapTopLeftX = $tileX*$resolution[$z]*$tileSizeInPixel-180;
$mapTopLeftY = 180-$tileY*$resolution[$z]*$tileSizeInPixel;
$mapBottomRightX=$mapTopLeftX + $resolution[$z]*$tileSizeInPixel;
$mapBottomRightY=$mapTopLeftY - $resolution[$z]*$tileSizeInPixel;
//tilecache URL http://server/cgi-bin/tilecache.cgi?LAYERS=LAYER_NAME&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=$mapTopLeftX,$mapTopLeftY,$mapBottomRightX,$mapBottomRightY&WIDTH=64&HEIGHT=64\n";
}
-------------------------------------------------
It seems that you try to project the tiles to EPSG:4326 coordinate system. Does the client use this too? Most streaming API implementations in client (like NutiteqStreamedMap) use Google Mercator EPSG3785 and this has shift in Y direction, as Y-direction resolution is different (Google Mercator Y-span is -85.05112877980659 to 85.05112877980659).
I have a converter script for EPSG3785 and WMS back-end in EPSG3785 which works at least with MapServer (but not guaranteed for other backends). Please email to nutiteq@nutiteq.com, we can share it for a small fee, or for free if you have library commercial license.
/JaakL