16

I am trying to clean a shapefile to make it usable for routing with pgrouting, postgis, postgresql.

Here an intersection, it seems to be connected but when we zoom …. It is not:

not zoomed 1 zoomed 1

Same here :

not zoomed 2 zoomed 2

Here (it is zoomed at max) there is 2 ways when it seems to be one, and only one is connected :

zoomed at max 2

I am using assign_vertex_id with different tolerances, and QGIS and PostGIS, but I don't know what to use in it.

2
  • I wonder: are these truly errors? For instance, both situations could be used to represent a two-way street meeting a one-way street. This may be a critical issue, because you don't want to introduce new errors in an effort to eliminate others!
    – whuber
    Aug 1, 2011 at 22:05
  • In fact it is just an horribly bad shapefile, I want an extremely simple undirected routing, and what you see is very zoomed.
    – hokkos
    Aug 3, 2011 at 8:57

2 Answers 2

12

You can use GRASS to do some cleaning. I think you need to break those vectors remove duplicates and then snap them. For that there is the v.clean tool with the options break, rmdupl and snap .

4

Within PostGIS, try ST_SnapToGrid to snap vertices to a virtual grid. You need to to some detective work to determine what snapping distance to use. It could be a 0.01 (1 cm), or 1.0, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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