- if (!c.hasContentClass(EntityType.geopoint))
- return;
-
- double latitude = c.get(WGS84PosName.lat, Double.class).get();
- double longitude = c.get(WGS84PosName.lng, Double.class).get();
+ Geometry the_geom;
+ if (gpx) {// experimental
+ Content area = c.getContent("gpx/area.gpx").orElse(null);
+ if (area == null)
+ return;
+ try (InputStream in = area.open(InputStream.class)) {
+ SimpleFeature feature = GpxUtils.parseGpxToPolygon(in);
+ the_geom = (Geometry) feature.getDefaultGeometry();
+ } catch (IOException e) {
+ throw new UncheckedIOException("Cannot parse " + c, e);
+ }
+ } else {
+ if (!c.hasContentClass(EntityType.geopoint))
+ return;
+
+ double latitude = c.get(WGS84PosName.lat, Double.class).get();
+ double longitude = c.get(WGS84PosName.lng, Double.class).get();
+
+ Coordinate coordinate = new Coordinate(longitude, latitude);
+ the_geom = geometryFactory.createPoint(coordinate);