I am reading a shapefile for a pipeline and what I've noticed is that if I just draw a line from one point to the next (in the order I read them), there will be points where the line terminates, and the next point is really a new line - but I can't see any way to tell where those points are... How does that work?
-
4Can you expand upon your question to include code samples, screenshots, sample data, etc? Also please try to describe the problem you are having more clearly, it's a bit difficult to follow.– blah238Oct 28, 2012 at 23:32
-
is there a field in the shapefile that has a pipeline segment number?– mhoran_psprepOct 29, 2012 at 12:46
-
Not to sure how to accomplish this, but due to your question I discovered pyshp which is awesome!– Cody BrownOct 29, 2012 at 19:16
Add a comment
|
1 Answer
A bit late but what the heck :P
If a row contains multiple new/disconnected lines as you suggested you can find the index positions where "the next point is really a new line" by calling the shape.parts
attribute. Note that if there is only one line then the indexlist from shape.parts will still list the first point, ie [0]
.
Check out the Pyshp docs for more on how to use it: http://code.google.com/p/pyshp/wiki/PyShpDocs