Skip to content

Commit

Permalink
Fix LineString->getPoint(n) for M geometries (closes GH-1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Nov 15, 2024
2 parents bf8a953 + 51c3b3d commit 47e2308
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- GEOSLineSubstring, avoid crash with NaN length fraction (GH-1077, Dan Baston)
- MinimumClearance, avoid crash on NaN inputs (GH-1079, Dan Baston)
- Fix LineString->getPoint(n) for M geometries (GH-1191, @hsieyuan)
- Fix TopologyPreservingSimplifier/TaggedLineString to avoid jumping components (JTS-1096, Martin Davis)


## Changes in 3.12.2
Expand Down
7 changes: 5 additions & 2 deletions src/simplify/TaggedLineString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ TaggedLineString::extractCoordinates(

if(size) {
for(std::size_t i = 0; i < size; i++) {
TaggedLineSegment* seg = segs[i];
TaggedLineSegment* seg = segs[i];
assert(seg);
pts->add(seg->p0);
}
Expand All @@ -185,7 +185,6 @@ TaggedLineString::extractCoordinates(
const Coordinate&
TaggedLineString::getCoordinate(std::size_t i) const
{

return parentLine->getCoordinateN(i);
}

Expand All @@ -198,6 +197,10 @@ TaggedLineString::size() const
const Coordinate&
TaggedLineString::getComponentPoint() const
{
//-- when simplified use a valid coordinate
if (resultSegs.size() > 0) {
return resultSegs[0]->p0;
}
return getParentCoordinates()->getAt(1);
}

Expand Down

0 comments on commit 47e2308

Please # to comment.