Map tiling - What kind of projection?

Posted by ikky on Stack Overflow See other posts from Stack Overflow or by ikky
Published on 2010-03-14T22:13:00Z Indexed on 2010/03/15 23:39 UTC
Read the original article Hit count: 448

Filed under:
|
|
|
|

Hi. I've taken a large image and divided it in to square tiles (256x256). It is made for google maps also, so the whole image is divided into z_x_y.png (Depending on zoom level).

z=0 => 1x1 tile z=1 => 2x2 tilesthe z=2 => 4x4 tiles

My imageMap is "flat" and is not based on a sphere like the worldmap.

I'm gonna use this map on a windows mobile app (which has no google API), and all the "points of interests" is inserted into a database by longitude and latitude. And since i have to make this for the windows mobile, i just have XY coordinate system.

Is it enough to just use this:

MAP_WIDTH  = 256*TILES_W;
MAP_HEIGHT = 256*TILES_H;

function convert(int lat, int lon)
{
    int y = (int)((-1 * lat) + 90) * (MAP_HEIGHT / 180);
    int x = (int)(lon + 180) * (MAP_WIDTH / 360);

    ImagePoint p = new ImagePoint(x,y);  // An object which holds the coordinates

    return p;
}

Or do i need a projection technique?

Thanks in advance. Please ask, if something is unclear.

© Stack Overflow or respective owner

Related posts about image

Related posts about map