1

I have a .shp with all the street of an area. I also have all the gtfs of the public transportation of the area so I want to clean the gtfs data of the itinerary. The shape of all the itinerary are a bounch of point with the coordinates and some of this is in some building so i want to take all the shape's points and put on the street. I can use Grass or Gdal. Suggestions?

1

If you can relax your dependence on GRASS/GDAL, there is a Python script that does this with OpenStreetMap data.

  • Glad I could be of some help! – Tony Laidig Jul 11 '17 at 18:40
1

Here's the procedure I use in GRASS to snap points to lines. It uses the v.distance module to get the target coords for snapping to the lines. Suppose we have a points vector "stations" and a line vector "streams", and the new snapped points will be "new_stations" :

# Add columns to the original points to hold the snapp coords
v.db.addcolumn --q map=stations columns="snap_x double, snap_y double"
v.distance --q --o from=stations to=streams output=connectors upload=to_x,to_y column=snap_x,snap_y
# Create a new stations vector with the snap_x and snap_y columns 
# Use v.out.ascii with -r option to export only drainage point in current region (domain)
# snap_x and snap_y columns become the X-Y coordinates for frxst_pts point vector
v.out.ascii --q -r -c stations columns="id,station_name,station_num,longitude,latitude,snap_x,snap_y" separator=comma | v.in.ascii --q --o input=- output=new_stations x=8 y=9 cat=3 columns="east double,north double,id integer,station_name text,station_num integer,longitude double,latitude double,snap_x double,snap_y double" separator=comma skip=1    

HTH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.