I have an image file of a North Carolina map that I need to determine the lat/long range of (the lat/long of the upper left corner and lower right corner.) It has no markings on it, but it does have 2 cities marked, so I know the lat/long of those 2 points. This is the map: http://quickfacts.census.gov/qfd/maps/stout37.gif
It seems like it should be simple matter of determing the ratio of pixels to degrees, but I can’t get it to work out that way.
I believe the map is on a true grid; lat/long lines are straight horizontal and vertical. I know that longitude lines aren’t perfectly parallel, especially close to the poles, but since this map is in the continental US I expect I can ignore that fact?
These are the coordinates of the 2 lat/long points of the cities:
Raleigh
35.78 lat = 147x down
78.72 lon = 631px right
Charlotte
35.20 lat = 223px down
80.97 lon = 407px right
I tried dividing the latitude into the pixels to get a ratio, but that didn’t give me useful numbers.
I also tried dividing the difference in the latitudes (2.25) into the difference in vertical pixels (224), that gives me 99.55. But I don’t think the 99.55 is useful for anything…
Any ideas on how to determine the upper left and lower right corners of the map? TIA
You are on the right track here. You just have it upside down. Divide the difference in latitudes BY the difference in pixels to give you degrees per pixel. Now you can multiply the distance in pixels to the top edge of the map (147) by your degress/pixel to get the latitude of the top edge (146.99). Same for the longitude.
If you have Google Earth, you could add the image as an overlay, zoom in on the corners, and read the coordinates directly. This assumes the projection would match Google Earth.
First, the difference in latitudes is ~0.58 degrees. If you divide the vertical difference in pixels (223-147) by this you get 76/0.58 = 131 pixels per degree, in latitude. Since lines of latitude are equidistant that should work for your purposes, assuming that the map is a Mercator projection, or something close.
Again assuming a Mercator projection the longitudinal degree scale is the latitudinal scale multiplied by the latitudinal cosine. I get 106 pixels per degree, which looks to be off by about 7% based on the numbers posted (it yields a longitudinal separation of 240 pixels rather than 224).
Your map, now that I’ve actually looked at the link, looks like a conical projection (note that the state’s northern border, which follows latitude 36 d 33 m, appears curved). This screws any attempt to do a simple algebraic relationship between pixels and degrees.
If you’re willing to bull your way to an answer, one possibility would be to run a line through each city that is perpendicular to the northern border. These lines will intersect at the apex of the cone of projection (the angle between these lines will be equal to the difference in longitude).
Run another straight line from this apex through the points you’re trying to find. The angle between this line and either of the other two lines will be the difference in longitude.
Thanks guys. It does look like I’m not going to be able to find an algebraic relationship from pixels to degrees. That sucks, that map would have been useful for my project because of the county names written in.
You don’t say what accuracy you do need. The pixels of the picture don’t necessarily line up north to south or east to west. To find the equation with less error for your conversions, go the largest change in distance, to minimize the percentage of error. A error of plus or minus one pixel in a 10 pixel distance will give you a greater error than error of 1 pixel in a distance of 1000 pixels. Calculating the distance from one point to the end point will be more accurate than adding smaller steps together for the total distance, because each step introduces an error to the total, in my example of plus or minus 1 pixel. Avoid changing between cartesean and polar coordinates as much as possible, because you add more errors everytime. Choose a decimal round off that is a number of places more accurate than the numbers your working with, to reduce error by rounding and only round to a accuracy you wish to show the user after the final result Pick the the two most distant points in x you can find and use it for the x formula. Do the same for the Y distance. Do this at least 3 times for x and y and you can average the results.
Of course the result of the distance will be in polar.