Fix lat/lon vs. lon/lat issues
[gpl/argeo-suite.git] / org.argeo.app.geo / src / org / argeo / app / api / geo / FeatureAdapter.java
index 03ca1ce4bd8fd5a0b670e410fd962453a7172270..69689a95b07f1e54ca015184534b5112e43f0293 100644 (file)
@@ -5,11 +5,8 @@ import javax.xml.namespace.QName;
 import org.argeo.api.acr.Content;
 import org.argeo.api.acr.search.AndFilter;
 import org.argeo.app.api.EntityType;
-import org.argeo.app.api.WGS84PosName;
-import org.argeo.app.geo.JTS;
-import org.locationtech.jts.geom.Coordinate;
+import org.argeo.app.geo.acr.GeoEntityUtils;
 import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.geom.Point;
 
 import jakarta.json.stream.JsonGenerator;
 
@@ -29,12 +26,13 @@ public interface FeatureAdapter {
 
        static Geometry getGeoPointGeometry(Content c) {
                if (c.hasContentClass(EntityType.geopoint)) {
-                       double latitude = c.get(WGS84PosName.lat, Double.class).get();
-                       double longitude = c.get(WGS84PosName.lon, Double.class).get();
-
-                       Coordinate coordinate = new Coordinate(longitude, latitude);
-                       Point the_geom = JTS.GEOMETRY_FACTORY.createPoint(coordinate);
-                       return the_geom;
+                       return GeoEntityUtils.toPoint(c);
+//                     double latitude = c.get(WGS84PosName.lat, Double.class).get();
+//                     double longitude = c.get(WGS84PosName.lon, Double.class).get();
+//
+//                     Coordinate coordinate = new Coordinate(longitude, latitude);
+//                     Point the_geom = JTS.GEOMETRY_FACTORY.createPoint(coordinate);
+//                     return the_geom;
                }
                return null;
        }