[postgis-users] Finding/Categorizing Paths from A to B

Paragon Corporation lr at pcorp.us
Mon May 19 00:09:54 PDT 2008


 


On Sun, May 18, 2008 at 12:10 PM, Webb Sprague <webb.sprague at gmail.com>
wrote:
>> That is exactly what I want to do... but first I want to find a way 
>> to boil down all trips to 12 or so distinct paths; without having to 
>> overlay every trip.  But since I only have points, not streets; i 
>> have no way to say path
>> #1 is different from path #2.

This is all very interesting stuff.  

>> 1.  Find or make a table that describes the street system as polygons for
each block and intersection, with unique ids  (create through buffering
lines/ points >> or by converting a shapefile or creating geometric data
from float input). Be careful to get the topology right (full coverage, non
overlapping etc)

If you are in the U.S.  You could download the Tiger Street index for your
area to give you paths for streets

http://www2.census.gov/geo/tiger/TIGER2007FE/


2. Then Use Paul's nifty hack  (plus my corrections to his logic :) to snap
your GPS points to a line segment  (that will sort of normalize all your
points so to speak)

http://blog.cleverelephant.ca/2008/04/snapping-points-in-postgis.html


3.  Now form new line segments from the snapped points - this will guarantee
all your line strings align with the street topology.

4. Now to figure out what paths are the same -  do a  (well this part I
haven't given much thought to) and if I thought about it a bit more, I'm
sure I can come up with something simpler than this

WHERE st_intersects(a,b) AND Length(ST_Difference(a,b)) < sometolerance

Hope that helps,
Regina





More information about the postgis-users mailing list