Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
640 views
in Technique[技术] by (71.8m points)

gis - How do I convert coordinates to a Latitude & Longitude?

I am reverse engineering a transportation visualization app. I need to find out the latitude for the origin of their data feed. Specifically what XY 0,0 is. The only formulas I have found calculate distance between two points, or location of a bearing/distance.

They use the XY to display a map in a very legacy application. The XY is in FEET.

I have these coordinates:

47.70446615506108, -122.34469839507263: x=1268314, y=260622
47.774182540800616,-122.3412994737105:  x=1269649, y=286031
47.60024792289405, -122.32767331735774: x=1271767, y=222532
47.57012494413499, -122.29129609983679: x=1280532, y=211374

I need to find out what the latitude and longitude of x=0, y=0 is and what the formula would be to find this out.

They have two data feeds, one is more current than the other. The feed with the most current data does NOT include latitude, longitude, but only XY. I am trying to extrapolate based on their less current, yet more informative (includes lat, lon) data feed what 0,0 is so I can simply convert their (more current) data feed's XY coordinates to latitude and longitude.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you look at the first 2 lines of data, and subtract the latitude

47.7044 - 47.7741 = -0.06972 degrees

There are 60 nautical miles per degree of latitude, and 6076 feet per nautical mile.

-.06972 * 60 * 6076 = 25,415 ft

Subtracting the two 'Y' values:

260662 - 286031 = 25,409 ft

So indeed that seems to prove the X and Y values are in feet.

If you take any of the Y values, and convert back to degrees, for example

260622 ft / ( 6076 ft/nm ) / ( 60 nm/degree ) = .71
286031 ft / 6076 / 60 = .78

So subtracting those values from the latitudes of (47.70 and 47.77) gives you very close to exactly 47 degrees, which should be your y=0 point.

For longitude, a degree is 60 nautical miles at the equator and 0 miles at the poles. So the number of miles per degree has to be multiplied by the cosine of the latitude, so approx cos(47 degrees), or .68. So instead of 6076 nm per degree, it's about 4145 nm.

So for the X values,

1268314 ft / ( 4145 ft/nm ) / ( 60 nm/degree ) = 5.10 degrees
1269649 ft / 4145 / 60 = 5.10 degrees

These X numbers increase as the latitude increases (less negative), so I believe you should add 5.1 degrees, which means the X base point is about

-122.3 + 5.1 = 117.2 West longitude for your x=0 point.

This is roughly the position of Spokane WA.

So given X=1280532, Y=211374

Lat = 47 + ( 211374 / 6096 / 60 ) = 47.58
Lon = -117.2 - ( 1280532 / ( 6096 * cos(47.58)) / 60 ) = -122.35

Which is roughly equivalent to the given data 47.57 and -122.29

The variance may be due to different projections - the X,Y system may be a "flattened" projection as opposed to lat/long which apply to a spherical projection? So to be accurate you may yet need more advanced math or that open source library :)

This question may also be helpful, it contains code for calculating great circle distances:

Calculate distance between two latitude-longitude points? (Haversine formula)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...