i Would like to calculate the Sum of pipe lengths in Mapinfo within a polygon. Any ideas?

  1. Open the MapBasic window (from the Option menu)
  2. Select you polygon
  3. Run these statements from the MapBasic window. Simple copy & paste them into the MapBasic window, hightlight all the lines and hit enter. Do replace "PIPES" with the name of your table.

    Fetch First From Selection

    Dim oSel As Object

    oSel = Selection.OBJ

    Select Sum(ObjectLen(Overlap(PIPES.OBJ, oSel), "m")) "SumLength, m" From PIPES Where PIPES.OBJ Intersects oSel

    Browse * From Selection

    UnDim oSel

This should give you a browser with the sum of the lengths of the lines within the selected polygon.

Do note that the length is only measured within the selected polygon. Some lines may extend outside the polygon. That part of the lines is not part of the total length

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.