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

micklich pushed a commit to branch 1272-buffer-processor
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit dfe72ebbf9a1238e882ca2ff928b067af66e1e2d
Author: micklich <[email protected]>
AuthorDate: Sun Feb 12 23:46:00 2023 +0100

    #1272 add buffer geometry
---
 .../streampipes/processors/geo/jvm/GeoJvmInit.java |   6 +-
 .../geo/jvm/jts/helper/buffer/BufferSide.java      |  32 ++++
 .../geo/jvm/jts/helper/buffer/CapStyle.java        |  32 ++++
 .../geo/jvm/jts/helper/buffer/JoinStyle.java       |  33 ++++
 .../geo/jvm/jts/helper/buffer/SpBufferBuilder.java | 124 ++++++++++++
 .../buffergeometry/BufferGeomProcessor.java        | 213 +++++++++++++++++++++
 .../documentation.md                               |  98 ++++++++++
 .../icon.png                                       | Bin 0 -> 12978 bytes
 .../strings.en                                     |  32 ++++
 9 files changed, 568 insertions(+), 2 deletions(-)

diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/GeoJvmInit.java
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/GeoJvmInit.java
index abaca7715..13776f657 100644
--- 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/GeoJvmInit.java
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/GeoJvmInit.java
@@ -28,6 +28,7 @@ import 
org.apache.streampipes.messaging.jms.SpJmsProtocolFactory;
 import org.apache.streampipes.messaging.kafka.SpKafkaProtocolFactory;
 import org.apache.streampipes.messaging.mqtt.SpMqttProtocolFactory;
 import org.apache.streampipes.processors.geo.jvm.config.ConfigKeys;
+import 
org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry.BufferGeomProcessor;
 import 
org.apache.streampipes.processors.geo.jvm.jts.processor.epsg.EpsgProcessor;
 import 
org.apache.streampipes.processors.geo.jvm.jts.processor.latlngtojtspoint.LatLngToJtsPointProcessor;
 import 
org.apache.streampipes.processors.geo.jvm.jts.processor.reprojection.ReprojectionProcessor;
@@ -70,7 +71,8 @@ public class GeoJvmInit extends ExtensionsModelSubmitter {
             new LatLngToJtsPointProcessor(),
             new TrajectoryFromPointsProcessor(),
             new SpeedCalculatorProcessor(),
-            new ReprojectionProcessor())
+            new ReprojectionProcessor(),
+            new BufferGeomProcessor())
         .registerMessagingFormats(
             new JsonDataFormatFactory(),
             new CborDataFormatFactory(),
@@ -89,7 +91,7 @@ public class GeoJvmInit extends ExtensionsModelSubmitter {
     PGSimpleDataSource ds = new PGSimpleDataSource();
     String[] serverAddresses = {"localhost"};
     ds.setServerNames(serverAddresses);
-    int [] portNumbers = {54320};
+    int[] portNumbers = {54320};
     ds.setPortNumbers(portNumbers);
     ds.setDatabaseName("EPSG");
     ds.setUser("streampipes");
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/BufferSide.java
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/BufferSide.java
new file mode 100755
index 000000000..af51c9972
--- /dev/null
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/BufferSide.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.streampipes.processors.geo.jvm.jts.helper.buffer;
+
+public enum BufferSide {
+  Left(-1), Both(0), Right(1);
+
+  private final int number;
+
+  BufferSide(int number) {
+    this.number = number;
+  }
+
+  public int getNumber() {
+    return number;
+  }
+}
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/CapStyle.java
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/CapStyle.java
new file mode 100755
index 000000000..f1225eec1
--- /dev/null
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/CapStyle.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.streampipes.processors.geo.jvm.jts.helper.buffer;
+
+public enum CapStyle {
+  Round(1), Flat(2), Square(3);
+
+  private int number;
+
+  CapStyle(int number) {
+    this.number = number;
+  }
+
+  public int getNumber() {
+    return number;
+  }
+}
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/JoinStyle.java
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/JoinStyle.java
new file mode 100755
index 000000000..f9a8212d9
--- /dev/null
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/JoinStyle.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.streampipes.processors.geo.jvm.jts.helper.buffer;
+
+public enum JoinStyle {
+  Round(1), Mitre(2), Bevel(3);
+
+  private int number;
+
+  JoinStyle(int number) {
+    this.number = number;
+  }
+
+  public int getNumber() {
+    return number;
+  }
+}
+
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/SpBufferBuilder.java
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/SpBufferBuilder.java
new file mode 100755
index 000000000..db496ff0f
--- /dev/null
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/buffer/SpBufferBuilder.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.streampipes.processors.geo.jvm.jts.helper.buffer;
+
+import 
org.apache.streampipes.processors.geo.jvm.jts.exceptions.SpNotSupportedGeometryException;
+import org.apache.streampipes.processors.geo.jvm.jts.helper.SpGeometryBuilder;
+import 
org.apache.streampipes.processors.geo.jvm.jts.helper.SpReprojectionBuilder;
+
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.Point;
+import org.locationtech.jts.geom.Polygon;
+import org.locationtech.jts.operation.buffer.BufferOp;
+import org.locationtech.jts.operation.buffer.BufferParameters;
+
+public class SpBufferBuilder {
+
+  public static Polygon createSpBuffer(Point geom, double distance, int 
capStyle, int segments, double simplifyFactor) {
+
+    Point geomInternal = geom;
+    Polygon bufferGeom = null;
+
+    //if capStyle is flat it will be forced to be round
+    if (capStyle == 2) {
+      capStyle = 1;
+    }
+
+    try {
+      // transform to metric coordinate system
+      if (!SpReprojectionBuilder.isMeterCRS(geom.getSRID())) {
+
+        geomInternal =
+            (Point) SpReprojectionBuilder.reprojectSpGeometry(geom, 
SpReprojectionBuilder.findWgsUtm_EPSG(geom));
+      }
+
+      //creates buffer params
+      BufferParameters bufferParam = new BufferParameters(); //init
+      bufferParam.setEndCapStyle(capStyle);
+      bufferParam.setQuadrantSegments(segments);
+      bufferParam.setSimplifyFactor(simplifyFactor);
+
+      bufferGeom = (Polygon) 
SpGeometryBuilder.createSPGeom(BufferOp.bufferOp(geomInternal, distance, 
bufferParam),
+          geomInternal.getSRID());
+
+      if (bufferGeom.getSRID() != geom.getSRID()) {
+        bufferGeom = (Polygon) 
SpReprojectionBuilder.reprojectSpGeometry(bufferGeom, geom.getSRID());
+      }
+    } catch (SpNotSupportedGeometryException e) {
+      //if reprojection geometry is not supported an empty geometry has to be 
created
+      bufferGeom = (Polygon) SpGeometryBuilder.createEmptyGeometry(bufferGeom);
+    }
+
+    return bufferGeom;
+  }
+
+  public static Geometry createSpBuffer(Geometry geom,
+                                        Double distance,
+                                        int endCapStyle,
+                                        int joinStyle,
+                                        double mitreLimit,
+                                        int segment,
+                                        double simplifyFactor,
+                                        boolean singleSided,
+                                        int side) {
+    Geometry internal = geom;
+    Geometry result = null;
+    BufferParameters bufferParameter = new BufferParameters();
+    bufferParameter.setEndCapStyle(endCapStyle);
+    bufferParameter.setJoinStyle(joinStyle);
+    bufferParameter.setMitreLimit(mitreLimit);
+    bufferParameter.setQuadrantSegments(segment);
+    bufferParameter.setSimplifyFactor(simplifyFactor);
+    bufferParameter.setSingleSided(singleSided);
+    //
+    if (side != 0) {
+      distance = distance * side;
+    }
+
+    try {
+      //if epsg is not a metric CRS, it will be transformed to corresponding 
utm zone
+      if (!SpReprojectionBuilder.isMeterCRS(geom.getSRID())) {
+
+        internal = SpReprojectionBuilder.reprojectSpGeometry(internal,
+            
SpReprojectionBuilder.findWgsUtm_EPSG(SpGeometryBuilder.extractPoint(internal)));
+      }
+
+      //using bufferOP with input geometry (internal) distance and Parameter)
+      result = SpGeometryBuilder.createSPGeom(BufferOp.bufferOp(internal, 
distance, bufferParameter).toText(),
+          internal.getSRID());
+
+
+      // if geometry wasn't metric, transformation took place. to get the 
result in the same coordinate system like input, it will
+      // be back transformed
+      if (result.getSRID() != geom.getSRID()) {
+        result = SpReprojectionBuilder.reprojectSpGeometry(result, 
geom.getSRID());
+      }
+    } catch (SpNotSupportedGeometryException e) {
+      result = SpGeometryBuilder.createEmptyGeometry(internal);
+    }
+
+    //========VALIDATE RESULT
+    if (result.isEmpty()) {
+      // TODO: Logger Info
+    }
+
+    return result;
+  }
+
+
+}
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/buffergeometry/BufferGeomProcessor.java
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/buffergeometry/BufferGeomProcessor.java
new file mode 100644
index 000000000..cf8271228
--- /dev/null
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/buffergeometry/BufferGeomProcessor.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry;
+
+import org.apache.streampipes.commons.exceptions.SpRuntimeException;
+import org.apache.streampipes.model.DataProcessorType;
+import org.apache.streampipes.model.graph.DataProcessorDescription;
+import org.apache.streampipes.model.runtime.Event;
+import org.apache.streampipes.model.schema.PropertyScope;
+import org.apache.streampipes.processors.geo.jvm.jts.helper.SpGeometryBuilder;
+import org.apache.streampipes.processors.geo.jvm.jts.helper.buffer.BufferSide;
+import org.apache.streampipes.processors.geo.jvm.jts.helper.buffer.CapStyle;
+import org.apache.streampipes.processors.geo.jvm.jts.helper.buffer.JoinStyle;
+import 
org.apache.streampipes.processors.geo.jvm.jts.helper.buffer.SpBufferBuilder;
+import org.apache.streampipes.sdk.builder.ProcessingElementBuilder;
+import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder;
+import org.apache.streampipes.sdk.helpers.EpProperties;
+import org.apache.streampipes.sdk.helpers.EpRequirements;
+import org.apache.streampipes.sdk.helpers.Labels;
+import org.apache.streampipes.sdk.helpers.Locales;
+import org.apache.streampipes.sdk.helpers.Options;
+import org.apache.streampipes.sdk.helpers.OutputStrategies;
+import org.apache.streampipes.sdk.utils.Assets;
+import org.apache.streampipes.wrapper.context.EventProcessorRuntimeContext;
+import org.apache.streampipes.wrapper.routing.SpOutputCollector;
+import org.apache.streampipes.wrapper.standalone.ProcessorParams;
+import org.apache.streampipes.wrapper.standalone.StreamPipesDataProcessor;
+
+import org.locationtech.jts.geom.Geometry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BufferGeomProcessor extends StreamPipesDataProcessor {
+  public static final String GEOM_KEY = "geometry-key";
+  public static final String EPSG_KEY = "epsg-key";
+  public static final String CAP_KEY = "cap-style-key";
+  public static final String SEGMENTS_KEY = "segments-key";
+  public static final String SIMPLIFY_FACTOR_KEY = "simplify-factor-key";
+  public static final String DISTANCE_KEY = "distance-key";
+  public static final String JOIN_KEY = "join-style-key";
+  public static final String MITRE_LIMIT_KEY = "mitre-limit-key";
+  public static final String SIDE_KEY = "side-key";
+  public static final String IS_SINGLE_SIDE = "is-single-side-key";
+  public static final String GEOM_RUNTIME = "geometry-buffer";
+  public static final String EPSG_RUNTIME = "epsg-buffer";
+  private String geometryMapper;
+  private String epsgMapper;
+  private Integer capStyle;
+  private Integer joinStyle;
+  private Integer side;
+  private Double mitreLimit;
+  private Integer segments;
+  private Double simplifyFactor;
+  private Double distance;
+  private Boolean singleSided;
+  private static final Logger LOG = 
LoggerFactory.getLogger(BufferGeomProcessor.class);
+
+  @Override
+  public DataProcessorDescription declareModel() {
+    return 
ProcessingElementBuilder.create("org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry")
+        .category(DataProcessorType.GEO)
+        .withAssets(Assets.DOCUMENTATION, Assets.ICON)
+        .withLocales(Locales.EN)
+        .requiredStream(StreamRequirementsBuilder
+            .create()
+            .requiredPropertyWithUnaryMapping(
+                
EpRequirements.domainPropertyReq("http://www.opengis.net/ont/geosparql#Geometry";),
+                Labels.withId(GEOM_KEY),
+                PropertyScope.MEASUREMENT_PROPERTY)
+            .requiredPropertyWithUnaryMapping(
+                
EpRequirements.domainPropertyReq("http://data.ign.fr/def/ignf#CartesianCS";),
+                Labels.withId(EPSG_KEY),
+                PropertyScope.MEASUREMENT_PROPERTY)
+            .build())
+        .outputStrategy(OutputStrategies.append(
+                EpProperties.stringEp(
+                    Labels.withId(GEOM_KEY),
+                    GEOM_RUNTIME,
+                    "http://www.opengis.net/ont/geosparql#Geometry";
+                ),
+                EpProperties.numberEp(
+                    Labels.withId(EPSG_KEY),
+                    EPSG_RUNTIME,
+                    "http://data.ign.fr/def/ignf#CartesianCS";
+                )
+            )
+        )
+        .requiredSingleValueSelection(
+            Labels.withId(CAP_KEY),
+            Options.from(
+                CapStyle.Square.name(),
+                CapStyle.Flat.name(),
+                CapStyle.Round.name())
+        )
+        .requiredSingleValueSelection(
+            Labels.withId(JOIN_KEY),
+            Options.from(
+                JoinStyle.Bevel.name(),
+                JoinStyle.Mitre.name(),
+                JoinStyle.Round.name())
+        )
+        .requiredSingleValueSelection(
+            Labels.withId(SIDE_KEY),
+            Options.from(
+                BufferSide.Both.name(),
+                BufferSide.Left.name(),
+                BufferSide.Right.name())
+        )
+        .requiredIntegerParameter(
+            Labels.withId(MITRE_LIMIT_KEY),
+            5)
+        .requiredIntegerParameter(
+            Labels.withId(SEGMENTS_KEY),
+            8
+        )
+        .requiredFloatParameter(
+            Labels.withId(SIMPLIFY_FACTOR_KEY),
+            0.01f
+        )
+        .requiredFloatParameter(
+            Labels.withId(DISTANCE_KEY)
+        )
+        .build();
+  }
+
+  @Override
+  public void onInvocation(ProcessorParams parameters, SpOutputCollector 
spOutputCollector,
+                           EventProcessorRuntimeContext runtimeContext) throws 
SpRuntimeException {
+
+    this.geometryMapper = 
parameters.extractor().mappingPropertyValue(GEOM_KEY);
+    this.epsgMapper = parameters.extractor().mappingPropertyValue(EPSG_KEY);
+    String readCapStyle = parameters.extractor().selectedSingleValue(CAP_KEY, 
String.class);
+    String readJoinStyle = 
parameters.extractor().selectedSingleValue(JOIN_KEY, String.class);
+    String readSide = parameters.extractor().selectedSingleValue(SIDE_KEY, 
String.class);
+    this.mitreLimit = 
parameters.extractor().singleValueParameter(MITRE_LIMIT_KEY, Double.class);
+    this.segments = parameters.extractor().singleValueParameter(SEGMENTS_KEY, 
Integer.class);
+    this.simplifyFactor = 
parameters.extractor().singleValueParameter(SIMPLIFY_FACTOR_KEY, Double.class);
+    this.distance = parameters.extractor().singleValueParameter(DISTANCE_KEY, 
Double.class);
+
+    // transform names to numbers
+    this.capStyle = 1;
+    if (readCapStyle.equals(CapStyle.Square.name())) {
+      this.capStyle = CapStyle.Square.getNumber();
+    } else if (readCapStyle.equals(CapStyle.Flat.name())) {
+      this.capStyle = CapStyle.Flat.getNumber();
+    }
+    // transform names to numbers
+    this.joinStyle = 1;
+    if (readJoinStyle.equals(JoinStyle.Bevel.name())) {
+      this.joinStyle = JoinStyle.Bevel.getNumber();
+    } else if (readJoinStyle.equals(JoinStyle.Mitre.name())) {
+      this.joinStyle = JoinStyle.Mitre.getNumber();
+    }
+    // transform names to numbers
+    this.singleSided = false;
+    this.side = 0;
+    if (readSide.equals(BufferSide.Right.name())) {
+      this.side = BufferSide.Right.getNumber();
+      this.singleSided = true;
+    } else if (readSide.equals(BufferSide.Left.name())) {
+      this.side = BufferSide.Left.getNumber();
+      singleSided = true;
+    }
+  }
+
+  @Override
+  public void onEvent(Event event, SpOutputCollector collector) throws 
SpRuntimeException {
+    String geom = 
event.getFieldBySelector(geometryMapper).getAsPrimitive().getAsString();
+    Integer epsg = 
event.getFieldBySelector(epsgMapper).getAsPrimitive().getAsInt();
+    Geometry geometry = SpGeometryBuilder.createSPGeom(geom, epsg);
+    Geometry bufferGeom =
+        SpBufferBuilder.createSpBuffer(
+            geometry,
+            distance,
+            capStyle,
+            joinStyle,
+            mitreLimit,
+            segments,
+            simplifyFactor,
+            singleSided,
+            side);
+
+    if (!bufferGeom.isEmpty()) {
+      event.addField(GEOM_RUNTIME, bufferGeom.toText());
+      event.addField(EPSG_RUNTIME, bufferGeom.getSRID());
+      collector.collect(event);
+    } else {
+      LOG.warn("An empty polygon geometry is created and is not parsed into 
the stream");
+    }
+
+    collector.collect(event);
+
+  }
+
+  @Override
+  public void onDetach() throws SpRuntimeException {
+  }
+}
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/documentation.md
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/documentation.md
new file mode 100755
index 000000000..b799534a4
--- /dev/null
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/documentation.md
@@ -0,0 +1,98 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+## Buffer Geometry
+
+<p align="center">
+    <img src="icon.png" width="150px;" class="pe-image-documentation"/>
+</p>
+
+***
+
+## Description
+
+Creates a buffer Polygon Geometry from a geometry
+***
+
+## Required inputs
+
+* WKT of a JTS Geometry
+* Integer value representing EPSG code
+* Distance
+* Cap Style
+* Join Style
+* Mitre-Limit
+* Side
+* Simplify Factor
+* Quadrant Segments
+***
+
+## Configuration
+
+### 1st parameter
+Input Geometry
+
+### 2nd parameter
+EPSG code value
+
+### 3rd parameter
+Distance
+the buffer distance around in geometry in meter
+
+### 4rd parameter
+Cap Style
+CAP_ROUND - the usual round end caps
+CAP_FLAT - end caps are truncated flat at the line ends
+CAP_SQUARE - end caps are squared off at the buffer distance beyond the line 
ends 
+
+### 5rd parameter
+Simplify Factor
+The default simplify factor Provides an accuracy of about 1%, which matches 
the accuracy of the 
+default Quadrant Segments parameter.
+
+### 6rd parameter
+Quadrant Segments
+The default number of facets into which to divide a fillet of 90 degrees. A 
value of 8 gives 
+less than 2% max error in the buffer distance. For a max error of < 1%, use QS 
= 12. 
+For a max error of < 0.1%, use QS = 18.
+
+### 7rd parameter
+Join Style
+Defines the corners in a buffer
+JOIN_ROUND - the usual round join
+JOIN_MITRE - corners are "sharp" (up to a distance limit)
+JOIN_BEVEL - corners are beveled (clipped off). 
+
+### 8rd parameter
+Mitre-Limit
+mitre ratio limit (only affects mitered join style)
+
+### 9rd parameter
+Side
+: 'left' or 'right' performs a single-sided buffer on the geometry, with the 
buffered side 
+relative to the direction of the line. This is only applicable to LINESTRING 
geometry and 
+does not affect POINT or POLYGON geometries.
+
+***
+
+## Output
+
+
+
+### Example
+
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/icon.png
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/icon.png
new file mode 100644
index 000000000..32c49ca7b
Binary files /dev/null and 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/icon.png
 differ
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/strings.en
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/strings.en
new file mode 100755
index 000000000..bcc328a55
--- /dev/null
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry/strings.en
@@ -0,0 +1,32 @@
+org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry.title=Geo
 Buffer Geometry
+org.apache.streampipes.processors.geo.jvm.jts.processor.buffergeometry.description=Creates
 a polygon buffer from a geometry
+
+geometry-key.title=JTS Geometry Event
+geometry-key.description=Single Geometry
+
+epsg-key.title=EPSG
+epsg-key.description=EPSG
+
+cap-style-key.title=Cap Style Parameter
+cap-style-key.description= Cap style
+
+segments-key.title=Segment Value
+segments-key.description=Set the parameter
+
+simplify-factor-key.title=Simplify factor
+simplify-factor-key.description=Simplify factor
+
+distance-key.title=Distance
+distance-key.description=Distance in meters with radius of the buffer
+
+join-style-key.title=Join Style Parameter
+join-style-key.description=Join Style Parameter
+
+mitre-limit-key.title=Mitre Limit
+mitre-limit-key.description=Mitre Limit
+
+side-key.title= Side Choice
+side-key.description= Side Choice
+
+is-single-side-key.title=Is Single Sided
+is-single-side-key.description=Value for options single sided
\ No newline at end of file

Reply via email to