2

What does the GEOS LineString "normalize()" routine really do?

GEOS has virtual void geos::geom::LineString::normalize() with the documentation:

A normalized linestring has the first point which is not equal to it's reflected point less than the reflected point.

Ignoring the "it's" typo, I still can't figure out what this really means.

0

From what i can understand it sorts (very naively) the nodes firstly by x, if x are equal then by y.

https://github.com/libgeos/libgeos/blob/ea82e6058d43138810ce0a2787ba57c98a630dbf/src/geom/LineString.cpp#L330

CompareTo: https://github.com/libgeos/libgeos/blob/ea82e6058d43138810ce0a2787ba57c98a630dbf/include/geos/geom/Coordinate.inl#L64

reverse: https://github.com/libgeos/libgeos/blob/ea82e6058d43138810ce0a2787ba57c98a630dbf/src/geom/CoordinateSequence.cpp#L160

  • I think I agree. But, I keep telling myself that can't be it because I can't think of an application of that sort on a LineString. (I can see cases for "normalizting" a collection of points.) Without that, it sounds more like a bug than a feature. Probably just a hang-up on my part. – Todd Trimble May 5 '16 at 16:41
  • I cannot say with certain, I didn't find any references where that method was used. The maintainers might be able to provide you an explanation why is there. – nickves May 10 '16 at 0:55

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.