user1379094
user1379094

Reputation: 45

Is there a way to convert actual street map coordinates to a set of GPS coordinates?

I wonder is there a way to convert actual street map coordinates to a set of GPS coordinates. I was thinking if I have a set of GPS coordinates on the corners of a rectangular street map, I could virtually put a GPS coordinate to any point in that area. It is logical but I am not sure how to do it.

Upvotes: 1

Views: 789

Answers (2)

jestrange
jestrange

Reputation: 271

I think I get the concept. You need two ingredients for that: 1. Scale and.. 2. Corner sample.

It's easy to make a program to offset your marked points on the map but these requires the "Scale" (ex. 1-inch : 121001-meters) and the sample of "coordinate" in at least one of any of the four corners (top-left,top-right,bottom-left,bottom-right) for use to offset and get.

Out of these variables needed, we could easily extract to get the coords marked on your map.

MAJOR EDIT:
(Note: Disregard what I've written earlier above)
Variables:

mw = 2d mapwidth       
mh = 2d mapheight     
x = your 2d x coordinate             
y = your 2d y coordinate          
lat = latitude (our N or ?)          
lon = longitude (our N or ?)  

Formula:

lat = 180 + ( (x / mw) * 360) )          
long = 90 + ( (y / mh) * 360) ) 

Explanation:
Following the formulas which are used:

x = (mw) * (180 + latitude) / 360                   
y = (mh) * (90 + longitude) / 180       

I've personally transposed the formula above to find our latitude and longitude.
I hope this solves your problem and this is the appropriate answer for your question.
Don't forget to up my answer to save my honor from the humiliation earlier. jk. :)

Upvotes: 1

Alex Wilson
Alex Wilson

Reputation: 6740

The Geotools Java project has all the tools you need to transform from one coordinate system to another. I'm not aware of anything similar in C++ though I'm afraid.

There are an absolute wealth of coordinate systems out there (see: http://en.wikipedia.org/wiki/Geographic_coordinate_system), so you'd need to be more specific about the format in which you have your street map coordinates for me to give any more detail.

Upvotes: 2

Related Questions