开发者

Map tiling - What kind of projection?

开发者 https://www.devze.com 2022-12-22 18:19 出处:网络
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).

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 + 18开发者_如何学编程0) * (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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消