views:

42

answers:

1

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.

+1  A: 

If you want your points of interest to align properly on your image, you need to make sure the projection and coordinate system match those used in the image. It sounds like you made the image? So presumably you know the projection? Just make sure convert uses the same projection.

I'm not sure whether it's relevant, but Google Maps uses a spherical mercator projection based on WGS84.

MarkJ
We have used an eucledian projection, so i must probably use that.Thanks for the answer.