2

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?

3
  • 4
    Can 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.
    – blah238
    Oct 28, 2012 at 23:32
  • is there a field in the shapefile that has a pipeline segment number? Oct 29, 2012 at 12:46
  • Not to sure how to accomplish this, but due to your question I discovered pyshp which is awesome!
    – Cody Brown
    Oct 29, 2012 at 19:16

1 Answer 1

1

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

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.