Question

I have partial map of the world (like America or Africa). and I need to know to pixel size of the world map based on the size of the partial/cropped map pixel size.

I have the size in pixel of the partial map (like 480x256), and I have the minLongitude,maxlongitude,minlatitude,maxlatitude (aka left,right,top,bottom edge)

I know that longitude is easy because linear :

FULL_CIRCLE_DEG = 360

longitudeDelta = (maxLongitude-minLongitude)/FULL_CIRCLE_DEG

MapFullSize = mapCroppedWidth/longitudeDelta

But for the latitude, it's kind of different:

FULL_LATITUDE_DEG = MAX_LAT_ON_EARTH - MIN_LAT_ON_EARTH (like 85.7543...-(-85.7543...))

latitudeDelta = (maxLatitude-minLatitude)/FULL_LATITUDE_DEG

MapFullHeight = ????

Please someone can help me ?

I find lot of algorithm to get a GPScoordinateToPixel conversion but nothing on square calculation.

Thank you.

No correct solution

OTHER TIPS

Here's an idea. First work out the area of your rectangle which is specified by minLongitude,maxlongitude,minlatitude,maxlatitude. Then the ratio of your current map area to the area of the whole world map could be used to scale up the current number of pixels that the map currently occupies to the number of pixels that would be required for the whole map.

To work out the area that the map currently occupies, I think you need a bit of spherical trigonometry, and you can find what you need here on wikipedia. That page on wikipedia gives you a formula for the area of a spherical triangle, so if you regard your rectangle as two triangles, you can use that formula and calculate the area of the current map.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top