views:

153

answers:

2

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.

+1  A: 

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.

Scott
I need the full accuracy -- it isn't for a GPS application, its for reading in municipal parking codes (which are described by intersections + distances) and correlating them to a user provided street address.
David Pfeffer
Word of caution - In that case you may have problems getting basemaps that are accurate enough. I've used Google and VE and when distances are checked against actual surveyed data (distances +/- 0.01 feet) the distances were off by 100 feet, maybe more. My own address on Google is about 5 parcels west of where it should be. Actually on the wrong side of an intersecting street (T intersection).Just something to think about.
Scott
A: 

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.

David Pfeffer