Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On enableKeepPartialLinestring, output a closed linestring if the original way is closed even on missing start/end node #133 #134

Merged
merged 1 commit into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading