Convert Longitude/Latitude to cartesian x,y

  • Thread starter 3saul
  • Start date
  • #1
3
0
I have a series of maps from various parts of the world.

Each map is 512 pixels by 512 pixels. I also have approximate left, top, right and bottom latitude and longitude values for each map.

I'm wanting to plot variable lat/long value on the maps which need to be converted to x,y values - any advice on how to proceed?
 

Answers and Replies

  • #2
SteamKing
Staff Emeritus
Science Advisor
Homework Helper
12,796
1,668
3saul: You are getting involved in an area of surveying known as geodesy. I think you should Google the term 'Universal Transverse Mercator' to learn the basics. Software to handle lat/long - UTM X/Y conversions can be downloaded from the US Army Corps of Engineers web site - Google 'CORPSCON'
 
  • #3
3
0
I forgot to mention, the map width is equal to 1024km - as is the height (so each pixel equates to approx. 2km).

SteamKing, thank you for your response. I've looked over some of the information, which seems relatively complicated for my purposes.

I don't need a huge amount of accuracy but my current calculations (below) aren't producing accurate enough results. The x/y are both off by about 40 (positive) pixels. This tells me my calculations are too simple.

currentlatitude = -27.445617
currentlongitude = 152.93503

--Make values positive
if currentlatitude < 0 then
currentlatitude = currentlatitude * -1
end

if currentlongitude < 0 then
currentlongitude = currentlongitude * -1
end



--The following are the coordinates for my map
mapLeftLong = 147.98
mapRightLong = 158.46
mapTopLat = -23.15 --was a negative figure
mapBottomLat = -32.31 --was a negative figure

--Make values positive
if mapLeftLong < 0 then
mapLeftLong = mapLeftLong * -1
end

if mapRightLong < 0 then
mapRightLong = mapRightLong * -1
end

if mapTopLat < 0 then
mapTopLat = mapTopLat * -1
end

if mapBottomLat < 0 then
mapBottomLat = mapBottomLat * -1
end


xadjusted = mapRightLong - currentlongitude
yadjusted = mapBottomLat - currentlatitude


ypoints = mapRightLong - mapLeftLong
xpoints = mapBottomLat - mapTopLat


--Get pixel value
globalXTranslated = (512/xpoints) * xadjusted
globalYTranslated = (512/ypoints) * yadjusted
 
  • #4
SteamKing
Staff Emeritus
Science Advisor
Homework Helper
12,796
1,668
3saul: What do you know about these maps you have? What kind of projection (Mercator, etc.) was used to make them? Most map projections distort some feature (direction, location, area, etc.) in order to produce a 2-D representation of the surface of a 3-D body. Unless you have a special map projection, a simple linear scaling of lat/long to X/Y will not be accurate.
 
  • #5
3
0
The projection for the map images is gnomonic. They are Lambert Conformal, with standard parallels of 18S and 40S.

I hope this helps you to help me further. It means very little to me.
 
Last edited:

Related Threads on Convert Longitude/Latitude to cartesian x,y

Replies
9
Views
49K
Replies
19
Views
24K
Replies
7
Views
4K
Replies
1
Views
2K
Replies
18
Views
9K
Replies
3
Views
15K
Replies
12
Views
2K
Replies
1
Views
1K
Replies
1
Views
2K
Replies
5
Views
1K
Top