Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

iphone - Convert GPS coordinates to coordinate plane

This is somewhat related to another question I asked: Translate GPS coordinates to location on PDF Map. That got me to this point, now I'm stuck on the math.

Let's say I have a floor plan of a building, I've taken gps coordinate readings from each corner of the building. Also assume that the floor plan is lined up with the latitude and longitude.

How do I convert a GPS coordinate to a X,Y position on this map? I can't seem to get the math right.

alt text

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Let delta_long and delta_lat be the differences, in degrees, in the GPS coordinates of the building's corners. Let delta_x = 320 and delta_y = 480 (feet, let's say). Then:

vertical_scale = delta_y/delta_lat with units feet/degree latitude

horizontal_scale = delta_x/(cos(latitude)*delta_long) with units feet/degree longitude.

The cos(latitude) factor compensates for the varying length of 1 degree of longitude as one moves from the equator to the poles. We can assume for this application that it won't change appreciably between the north and south ends of the building.

Then for any nearby (lat,long) point, subtract off the coordinates of the southwest corner of the building, and apply the vertical and horizontal scales in the obvious way to locate that point with respect to the building layout.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...