Skip to content

Commit

Permalink
Merge pull request #134 from frodrigo/closed_partial_linestring
Browse files Browse the repository at this point in the history
On enableKeepPartialLinestring, output a closed linestring if the original way is closed even on missing start/end node #133
  • Loading branch information
brettch authored Sep 2, 2023
2 parents 81b0027 + e32e9c2 commit f2a3487
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
14 changes: 10 additions & 4 deletions doc/detailed-usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,9 @@ the linestring geometry column. |yes, no |no
built from option enableLinestringBuilder. When an invalid or a missing
node location is encountered the linestring is not built by default.
Enabling this option keeps it as a partial linestring. It will result in
a different geometry than the original one. |yes, no |no
a different geometry than the original one. If the original geometry is
a loop the imported geometry is a loop, even in case of faulty start and
end. |yes, no |no

|nodeLocationStoreType |This option only takes effect if at least one of
the enableBboxBuilder and enableLinestringBuilder options are enabled.
Expand Down Expand Up @@ -1902,7 +1904,8 @@ is more efficient for smaller datasets. |"InMemory", "TempFile",
built. When an invalid or a missing node location is encountered the
linestring is not built by default. Enabling this option keeps it as a
partial linestring. It will result in a different geometry than the
original one. |yes, no |no
original one. If the original geometry is a loop the imported geometry
is a loop, even in case of faulty start and end. |yes, no |no
|=======================================================================

==== --write-pgsimp-dump (--wsd)
Expand Down Expand Up @@ -1939,7 +1942,9 @@ the linestring geometry column. |yes, no |no
built from option enableLinestringBuilder. When an invalid or a missing
node location is encountered the linestring is not built by default.
Enabling this option keeps it as a partial linestring. It will result in
a different geometry than the original one. |yes, no |no
a different geometry than the original one. If the original geometry is
a loop the imported geometry is a loop, even in case of faulty start and
end. |yes, no |no

|nodeLocationStoreType |This option only takes effect if at least one of
the enableBboxBuilder and enableLinestringBuilder options are enabled.
Expand All @@ -1957,7 +1962,8 @@ the default database geometry building implementation, or the
built. When an invalid or a missing node location is encountered the
linestring is not built by default. Enabling this option keeps it as a
partial linestring. It will result in a different geometry than the
original one. |yes, no |no
original one. If the original geometry is a loop the imported geometry
is a loop, even in case of faulty start and end. |yes, no |no
|=======================================================================

==== --truncate-pgsimp (--ts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ public LineString createWayLinestring(Way way, boolean enableKeepPartialLinestri
}
}

if (enableKeepPartialLinestring && way.isClosed() && linePoints.size() > 1
&& !linePoints.get(0).equals(linePoints.get(linePoints.size() - 1))) {
linePoints.add(linePoints.get(0));
}

if (numValidNodes >= 2) {
return createLinestring(linePoints);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ public LineString createWayLinestring(Way way, boolean enableKeepPartialLinestri
}
}
}

if (enableKeepPartialLinestring && way.isClosed() && linePoints.size() > 1
&& !linePoints.get(0).equals(linePoints.get(linePoints.size() - 1))) {
linePoints.add(linePoints.get(0));
}

return createLinestring(linePoints);
}

Expand Down

0 comments on commit f2a3487

Please sign in to comment.