This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch refactoring
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit 115b11b3c97727e756be37a3d01325d820a2d025
Author: Bertil Chapuis <[email protected]>
AuthorDate: Fri Dec 23 00:12:36 2022 +0100

    Improve way geometry creation
---
 .../apache/baremaps/openstreetmap/function/WayGeometryBuilder.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java
index 392cb909..7ffad58d 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java
@@ -50,7 +50,11 @@ public class WayGeometryBuilder implements Consumer<Way> {
       Coordinate[] array = list.toArray(new Coordinate[list.size()]);
       LineString line = GEOMETRY_FACTORY_WGS84.createLineString(array);
       if (!line.isEmpty()) {
-        if (!line.isClosed()) {
+        // Ways can be open or closed depending on the geometry or the tags:
+        // https://wiki.openstreetmap.org/wiki/Way
+        if (!line.isClosed()
+          || way.getTags().containsKey("highway")
+          || way.getTags().containsKey("barrier")) {
           way.setGeometry(line);
         } else {
           Polygon polygon = 
GEOMETRY_FACTORY_WGS84.createPolygon(line.getCoordinates());

Reply via email to