private static void verifySameSpatialReference(OGCGeometry leftGeometry, OGCGeometry rightGeometry) { checkArgument(Objects.equals(leftGeometry.getEsriSpatialReference(), rightGeometry.getEsriSpatialReference()), "Input geometries must have the same spatial reference"); }
@SqlNullable @Description("Returns the first point of a LINESTRING geometry as a Point") @ScalarFunction("ST_StartPoint") @SqlType(GEOMETRY_TYPE_NAME) public static Slice stStartPoint(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_StartPoint", geometry, EnumSet.of(LINE_STRING)); if (geometry.isEmpty()) { return null; } MultiPath lines = (MultiPath) geometry.getEsriGeometry(); SpatialReference reference = geometry.getEsriSpatialReference(); return serialize(createFromEsriGeometry(lines.getPoint(0), reference)); }
@SqlNullable @Description("Returns the last point of a LINESTRING geometry as a Point") @ScalarFunction("ST_EndPoint") @SqlType(GEOMETRY_TYPE_NAME) public static Slice stEndPoint(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_EndPoint", geometry, EnumSet.of(LINE_STRING)); if (geometry.isEmpty()) { return null; } MultiPath lines = (MultiPath) geometry.getEsriGeometry(); SpatialReference reference = geometry.getEsriSpatialReference(); return serialize(createFromEsriGeometry(lines.getPoint(lines.getPointCount() - 1), reference)); }
return serialize(createFromEsriGeometry(new Point(), geometry.getEsriSpatialReference())); throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Unexpected geometry type: " + geometryType); return serialize(createFromEsriGeometry(centroid, geometry.getEsriSpatialReference()));
private static OGCConcreteGeometryCollection toGeometryCollection(OGCGeometry geometry) { if (geometry.geometryType() != OGCConcreteGeometryCollection.TYPE) { return new OGCConcreteGeometryCollection(geometry, geometry.getEsriSpatialReference()); } return (OGCConcreteGeometryCollection) geometry; }
public boolean touches(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { //TODO throw new UnsupportedOperationException(); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.touches(geom1, geom2, getEsriSpatialReference()); }
public boolean overlaps(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { // TODO throw new UnsupportedOperationException(); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.overlaps(geom1, geom2, getEsriSpatialReference()); }
public boolean crosses(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { //TODO throw new UnsupportedOperationException(); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.crosses(geom1, geom2, getEsriSpatialReference()); }
public boolean relate(OGCGeometry another, String matrix) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { //TODO throw new UnsupportedOperationException(); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.relate(geom1, geom2, getEsriSpatialReference(), matrix); }
public boolean crosses(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { //TODO throw new UnsupportedOperationException(); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.crosses(geom1, geom2, getEsriSpatialReference()); }
public boolean relate(OGCGeometry another, String matrix) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { //TODO throw new UnsupportedOperationException(); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.relate(geom1, geom2, getEsriSpatialReference(), matrix); }
public OGCGeometry symDifference(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { // TODO throw new UnsupportedOperationException(); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return createFromEsriGeometry( com.esri.core.geometry.GeometryEngine.symmetricDifference( geom1, geom2, getEsriSpatialReference()), esriSR); }
public boolean disjoint(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return another.disjoint(this); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.disjoint(geom1, geom2, getEsriSpatialReference()); }
public boolean contains(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return new OGCConcreteGeometryCollection(this, esriSR).contains(another); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.contains(geom1, geom2, getEsriSpatialReference()); }
public double distance(OGCGeometry another) { if (this == another) { return isEmpty() ? Double.NaN : 0; } if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return another.distance(this); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.distance(geom1, geom2, getEsriSpatialReference()); }
public double distance(OGCGeometry another) { if (this == another) { return isEmpty() ? Double.NaN : 0; } if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return another.distance(this); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.distance(geom1, geom2, getEsriSpatialReference()); }
public OGCGeometry difference(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).difference(another); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return createFromEsriGeometry( com.esri.core.geometry.GeometryEngine.difference(geom1, geom2, getEsriSpatialReference()), esriSR); }
public OGCGeometry difference(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).difference(another); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return createFromEsriGeometry( com.esri.core.geometry.GeometryEngine.difference(geom1, geom2, getEsriSpatialReference()), esriSR); }
public OGCGeometry intersection(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).intersection(another); } com.esri.core.geometry.OperatorIntersection op = (OperatorIntersection) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.Intersection); com.esri.core.geometry.GeometryCursor cursor = op.execute( getEsriGeometryCursor(), another.getEsriGeometryCursor(), getEsriSpatialReference(), null, 7); return OGCGeometry.createFromEsriCursor(cursor, esriSR, true); }
public OGCGeometry intersection(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).intersection(another); } com.esri.core.geometry.OperatorIntersection op = (OperatorIntersection) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.Intersection); com.esri.core.geometry.GeometryCursor cursor = op.execute( getEsriGeometryCursor(), another.getEsriGeometryCursor(), getEsriSpatialReference(), null, 7); return OGCGeometry.createFromEsriCursor(cursor, esriSR, true); }