Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtain coordinates of a point on a road

I have a range defined by an intersection and a number of feet away from the intersection. (e.g. 100 ft north of Washington St. & 5th St. to 300 ft south of Washington St. & 6th St.)

I am looking to geocode this into a lat/long pair. However, I cannot see any way to get Google Maps API or Virtual Earth, etc. to do this. They will happily geocode the intersection, but not the distance away. I can't just add 100 ft because the road doesn't necessarily go exactly straight or exactly in a cardinal direction.

I investigated getting the polyline that describes the road, but am not having much luck with obtaining that either from Google/VEarth. I looked at TIGER/LINE from the US Census but their data is very inaccurate.

Can anyone make a suggestion for how to geocode this? This is for a public map, so any of the free APIs from Google, Microsoft, etc. should be fine.

Ultimately, by the way, I'm looking for an actual street address rather than coordinates. I want to know that the range in the example I gave above, for instance, would be 508 to 563 Washington St.

like image 600
David Pfeffer Avatar asked Jan 05 '10 16:01

David Pfeffer


People also ask

How do you find the the coordinates of a point?

To find out the coordinates of a point in the coordinate system you do the opposite. Begin at the point and follow a vertical line either up or down to the x-axis. There is your x-coordinate. And then do the same but following a horizontal line to find the y-coordinate.


2 Answers

Food for thought - I don't know what your application is but remember the accuracy of a typical GPS device is 10 meters (approx 33 feet). Is it possible you are trying to make this more precise than necessary?

Possible solutions

  1. Can you just add the 100 feet and project that point perpendicular to the road? Close enough?

  2. Grab the intersection. Traverse the first segment. If its length < 100 feet, grab the scond segment, and so on until you are 100 feet away from the intersection as measured along the road. You will need to add the appropriate checks / do some math to determine where along a segment the actual 100' mark falls.

I used the second method over the summer and will see if I can find some sample code. No promises though.

#3 - Grab the intersection. Get the bearing of the first segment and use coordinate geometry to calculate the point 100 feet along the street at a given angle. This assumes the street does not have any deflections in it, otherwise use #2.

like image 79
DenaliHardtail Avatar answered Oct 02 '22 12:10

DenaliHardtail


I ended up taking a different approach -- rather than geocoding to house numbers, I use percentage up the street. I can therefore get away with calculating the length of the street and then determining how far up the street the geocoded coordinates are.

like image 24
David Pfeffer Avatar answered Oct 02 '22 12:10

David Pfeffer