com.esri.core.geometry.Geometry Java Examples

The following examples show how to use com.esri.core.geometry.Geometry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: arcgis-runtime-demos-android   Author: Esri   File: LocalGeofence.java    License: Apache License 2.0 6 votes vote down vote up
public static void setFence(Polygon newFence, SpatialReference fenceSpatialReference) {

    // Keep the original geometries.
    mFenceSr = fenceSpatialReference;
    mFence = newFence;

    // Work with the fence in WGS84, as that's what the location updates will be in.
    // Note that transformations could be used here to increase accuracy.
    if ( mFenceSr.getID() != mWgs84Sr.getID() ) {
      Geometry densified = GeometryEngine.geodesicDensifyGeometry(mFence,
          mFenceSr, 20, null);
      mFenceWgs84 = (Polygon)GeometryEngine.project(densified, mFenceSr, mWgs84Sr);
    }
    else {
      mFenceWgs84 = mFence;
    }
  }
 
Example #2
Source Project: arcgis-runtime-demo-java   Author: Esri   File: GeoJsonParser.java    License: Apache License 2.0 6 votes vote down vote up
private List<Feature> parseFeatures(ArrayNode jsonFeatures) {
  List<Feature> features = new LinkedList<Feature>();
  for (JsonNode jsonFeature : jsonFeatures) {
    String type = jsonFeature.path(FIELD_TYPE).getTextValue();
    if (!FIELD_FEATURE.equals(type)) {
      continue;
    }
    Geometry g = parseGeometry(jsonFeature.path(FIELD_GEOMETRY));
    if (outSR != null && outSR.getID() != 4326) {
      g = GeometryEngine.project(g, inSR, outSR);
    }
    Map<String, Object> attributes = parseProperties(jsonFeature.path(FIELD_PROPERTIES));
    Feature f = new Graphic(g, symbol, attributes);
    features.add(f);
  } 
  return features; 
}
 
Example #3
Source Project: defense-solutions-proofs-of-concept   Author: Esri   File: GeometryUtility.java    License: Apache License 2.0 6 votes vote down vote up
private static String _parseGeometryType(Geometry.Type t)
{
	String type = null;
	if(t == Geometry.Type.Point)
	{
		type = "esriGeometryPoint";
	}
	else if (t==Geometry.Type.Polyline)
	{
		type = "esriGeometryPolyline";
	}
	else if (t==Geometry.Type.Polygon)
	{
		type = "esriGeometryPolygon";
	}
	else if (t==Geometry.Type.MultiPoint)
	{
		type = "esriGeometryMultiPoint";
	}
	return type;
}
 
Example #4
Source Project: presto   Author: prestosql   File: GeometrySerde.java    License: Apache License 2.0 6 votes vote down vote up
private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry)
{
    Geometry esriGeometry = geometry.getEsriGeometry();
    verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point");
    Point point = (Point) esriGeometry;
    verify(!point.hasAttribute(VertexDescription.Semantics.Z) &&
                    !point.hasAttribute(VertexDescription.Semantics.M) &&
                    !point.hasAttribute(VertexDescription.Semantics.ID),
            "Only 2D points with no ID nor M attribute are supported");
    output.appendByte(GeometrySerializationType.POINT.code());
    if (!point.isEmpty()) {
        output.appendDouble(point.getX());
        output.appendDouble(point.getY());
    }
    else {
        output.appendDouble(NaN);
        output.appendDouble(NaN);
    }
}
 
Example #5
Source Project: defense-solutions-proofs-of-concept   Author: Esri   File: GeometryUtility.java    License: Apache License 2.0 6 votes vote down vote up
private static String _parseGeometryType(Geometry.Type t)
{
	String type = null;
	if(t == Geometry.Type.Point)
	{
		type = "esriGeometryPoint";
	}
	else if (t==Geometry.Type.Polyline)
	{
		type = "esriGeometryPolyline";
	}
	else if (t==Geometry.Type.Polygon)
	{
		type = "esriGeometryPolygon";
	}
	else if (t==Geometry.Type.MultiPoint)
	{
		type = "esriGeometryMultiPoint";
	}
	return type;
}
 
Example #6
Source Project: defense-solutions-proofs-of-concept   Author: Esri   File: BufferProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
	// Operation phase...
	if (radius == null) {
		radius = (Double) ge.getField(bufferEventFld);
		if (radius == null) {
			Exception e = new Exception("Radius is not defined in geoevent");
			throw (e);
		}
	}
	MapGeometry mapGeo = ge.getGeometry();
	Point eventGeo = (Point) mapGeo.getGeometry();
	double x = eventGeo.getX();
	double y = eventGeo.getY();
	int inwkid = mapGeo.getSpatialReference().getID();
	//int inwkid = eventGeo.getSpatialReference().getWkid();
	Geometry buffer = constructBuffer(x, y, radius,
			units, inwkid, bufferwkid, outwkid);
	
	SpatialReference srOut = SpatialReference.create(outwkid);
	MapGeometry outMapGeo = new MapGeometry(buffer, srOut);
	ge.setGeometry(outMapGeo);
	return ge;
}
 
Example #7
Source Project: geometry-api-java   Author: Esri   File: OGCGeometry.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * OGC equals. Performs topological comparison with tolerance.
 * This is different from equals(Object), that uses exact comparison.
 */
public boolean Equals(OGCGeometry another) {
	if (this == another)
		return !isEmpty();
	
	if (another == null)
		return false;
	
	if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) {
		return another.Equals(this);
	}
	
	com.esri.core.geometry.Geometry geom1 = getEsriGeometry();
	com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry();
	return com.esri.core.geometry.GeometryEngine.equals(geom1, geom2,
			getEsriSpatialReference());
}
 
Example #8
Source Project: spatial-framework-for-hadoop   Author: Esri   File: ST_AsShape.java    License: Apache License 2.0 6 votes vote down vote up
public BytesWritable evaluate(BytesWritable geomref) {
	if (geomref == null || geomref.getLength() == 0){
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

	OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
	if (ogcGeometry == null){
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

	try {
		// Get Esri shape representation
		Geometry esriGeometry = ogcGeometry.getEsriGeometry();
		byte[] esriShape = GeometryEngine.geometryToEsriShape(esriGeometry);
		return new BytesWritable(esriShape);
	} catch (Exception e){
		LOG.error(e.getMessage());
		return null;
	}
}
 
Example #9
Source Project: calcite   Author: apache   File: GeoFunctions.java    License: Apache License 2.0 6 votes vote down vote up
/** Returns the OGC type of a geometry. */
private static Type type(Geometry g) {
  switch (g.getType()) {
  case Point:
    return Type.POINT;
  case Polyline:
    return Type.LINESTRING;
  case Polygon:
    return Type.POLYGON;
  case MultiPoint:
    return Type.MULTIPOINT;
  case Envelope:
    return Type.POLYGON;
  case Line:
    return Type.LINESTRING;
  case Unknown:
    return Type.Geometry;
  default:
    throw new AssertionError(g);
  }
}
 
Example #10
Source Project: defense-solutions-proofs-of-concept   Author: Esri   File: BufferProcessor.java    License: Apache License 2.0 6 votes vote down vote up
private com.esri.ges.spatial.Geometry constructBuffer(double x, double y, double radius, String units, int wkidin, int wkidbuffer, int wkidout) throws GeometryException
{
	Point center = new Point();
	center.setX(x);
	center.setY(y);
	SpatialReference srIn = SpatialReference.create(wkidin);
	SpatialReference srBuffer = SpatialReference.create(wkidbuffer);
	SpatialReference srOut = SpatialReference.create(wkidout);
	UnitConverter uc = new UnitConverter();
	String c_name = uc.findConnonicalName(units);
	int unitout = uc.findWkid(c_name);
	Unit  u = new LinearUnit(unitout);
	Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer);
	Geometry buffer = GeometryEngine.buffer(centerProj, srBuffer, radius, u);
	Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut);
	String json = GeometryEngine.geometryToJson(srOut, bufferout);
	return spatial.fromJson(json);
	
}
 
Example #11
Source Project: spatial-framework-for-hadoop   Author: Esri   File: TestStAsShape.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testPointAsShape() {
	ST_Point point = new ST_Point();
	final double longitude = 12.224;
	final double latitude = 51.829;
	BytesWritable pointAsWritable = point.evaluate(new DoubleWritable(longitude), new DoubleWritable(latitude));
	assertNotNull("The point writable must not be null!", pointAsWritable);
	
	ST_AsShape asShape = new ST_AsShape();
	BytesWritable shapeAsWritable = asShape.evaluate(pointAsWritable);
	assertNotNull("The shape writable must not be null!", pointAsWritable);
	
	byte[] esriShapeBuffer = shapeAsWritable.getBytes();
	Geometry esriGeometry = GeometryEngine.geometryFromEsriShape(esriShapeBuffer, Type.Point);
	assertNotNull("The geometry must not be null!", esriGeometry);
	assertTrue("Geometry type point expected!", esriGeometry instanceof Point);
	
	Point esriPoint = (Point) esriGeometry;
	assertEquals("Longitude is different!", longitude, esriPoint.getX(), Epsilon);
	assertEquals("Latitude is different!", latitude, esriPoint.getY(), Epsilon);
}
 
Example #12
Source Project: arcgis-runtime-demos-android   Author: Esri   File: LocalGeofence.java    License: Apache License 2.0 6 votes vote down vote up
public static void setFence(Polygon newFence, SpatialReference fenceSpatialReference) {

    // Keep the original geometries.
    mFenceSr = fenceSpatialReference;
    mFence = newFence;

    // Work with the fence in WGS84, as that's what the location updates will be in.
    // Note that transformations could be used here to increase accuracy.
    if ( mFenceSr.getID() != mWgs84Sr.getID() ) {
      Geometry densified = GeometryEngine.geodesicDensifyGeometry(mFence,
          mFenceSr, 20, null);
      mFenceWgs84 = (Polygon)GeometryEngine.project(densified, mFenceSr, mWgs84Sr);
    }
    else {
      mFenceWgs84 = mFence;
    }
  }
 
Example #13
Source Project: sis   Author: apache   File: AttributeTypeBuilderTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Tests {@link AttributeTypeBuilder#roles()}.
 */
@Test
@DependsOnMethod("testOtherCharacteristics")
public void testRoles() {
    final AttributeTypeBuilder<Geometry> builder = new FeatureTypeBuilder().addAttribute(Geometry.class);
    final Set<AttributeRole> roles = builder.roles();
    assertTrue("isEmpty", roles.isEmpty());

    assertTrue("add(DEFAULT_GEOMETRY)", builder.addRole(AttributeRole.DEFAULT_GEOMETRY));
    assertSetEquals(Collections.singleton(AttributeRole.DEFAULT_GEOMETRY), roles);
    assertFalse("add(DEFAULT_GEOMETRY)", builder.addRole(AttributeRole.DEFAULT_GEOMETRY));

    assertTrue("add(IDENTIFIER_COMPONENT)", roles.add(AttributeRole.IDENTIFIER_COMPONENT));
    assertSetEquals(Arrays.asList(AttributeRole.DEFAULT_GEOMETRY, AttributeRole.IDENTIFIER_COMPONENT), roles);
    assertFalse("add(IDENTIFIER_COMPONENT)", roles.add(AttributeRole.IDENTIFIER_COMPONENT));

    assertTrue("remove(DEFAULT_GEOMETRY)", roles.remove(AttributeRole.DEFAULT_GEOMETRY));
    assertSetEquals(Collections.singleton(AttributeRole.IDENTIFIER_COMPONENT), roles);
    assertFalse("remove(DEFAULT_GEOMETRY)", roles.remove(AttributeRole.DEFAULT_GEOMETRY));

    assertTrue("remove(IDENTIFIER_COMPONENT)", roles.remove(AttributeRole.IDENTIFIER_COMPONENT));
    assertTrue("isEmpty", roles.isEmpty());
    assertFalse("remove(IDENTIFIER_COMPONENT)", roles.remove(AttributeRole.IDENTIFIER_COMPONENT));
}
 
Example #14
Source Project: defense-solutions-proofs-of-concept   Author: Esri   File: GeometryUtility.java    License: Apache License 2.0 6 votes vote down vote up
private static String _parseGeometryType(Geometry.Type t)
{
	String type = null;
	if(t == Geometry.Type.Point)
	{
		type = "esriGeometryPoint";
	}
	else if (t==Geometry.Type.Polyline)
	{
		type = "esriGeometryPolyline";
	}
	else if (t==Geometry.Type.Polygon)
	{
		type = "esriGeometryPolygon";
	}
	else if (t==Geometry.Type.MultiPoint)
	{
		type = "esriGeometryMultiPoint";
	}
	return type;
}
 
Example #15
Source Project: spatial-framework-for-hadoop   Author: Esri   File: ST_GeomFromShape.java    License: Apache License 2.0 5 votes vote down vote up
public BytesWritable evaluate(BytesWritable shape, int wkid) throws UDFArgumentException  {
	try {
		Geometry geometry = GeometryEngine.geometryFromEsriShape(shape.getBytes(), Geometry.Type.Unknown);
		switch (geometry.getType())
		{
		case Point:
			return GeometryUtils.geometryToEsriShapeBytesWritable(geometry, wkid, OGCType.ST_POINT);
			
		case MultiPoint:
			return GeometryUtils.geometryToEsriShapeBytesWritable(geometry, wkid, OGCType.ST_MULTIPOINT);
			
		case Line:
			return GeometryUtils.geometryToEsriShapeBytesWritable(geometry, wkid, OGCType.ST_LINESTRING);
			
		case Polyline:
			return GeometryUtils.geometryToEsriShapeBytesWritable(geometry, wkid, OGCType.ST_MULTILINESTRING);
			
		case Envelope:
			return GeometryUtils.geometryToEsriShapeBytesWritable(geometry, wkid, OGCType.ST_POLYGON);
			
		case Polygon:
			return GeometryUtils.geometryToEsriShapeBytesWritable(geometry, wkid, OGCType.ST_MULTIPOLYGON);
			
		default:
			return GeometryUtils.geometryToEsriShapeBytesWritable(geometry, wkid, OGCType.UNKNOWN);
		}
	} catch (Exception e) {
		LogUtils.Log_ExceptionThrown(LOG, "geom-from-shape", e);
		return null;
	}
}
 
Example #16
Source Project: sis   Author: apache   File: ESRI.java    License: Apache License 2.0 5 votes vote down vote up
/**
     * Merges a sequence of points or paths if the first instance is an implementation of this library.
     *
     * @throws ClassCastException if an element in the iterator is not an ESRI geometry.
     */
    @Override
    final Geometry tryMergePolylines(Object next, final Iterator<?> polylines) {
        if (!(next instanceof MultiPath || next instanceof Point)) {
            return null;
        }
        final Polyline path = new Polyline();
        boolean lineTo = false;
add:    for (;;) {
            if (next instanceof Point) {
                final Point pt = (Point) next;
                if (pt.isEmpty()) {
                    lineTo = false;
                } else {
                    final double x = ((Point) next).getX();
                    final double y = ((Point) next).getY();
                    if (lineTo) {
                        path.lineTo(x, y);
                    } else {
                        path.startPath(x, y);
                        lineTo = true;
                    }
                }
            } else {
                path.add((MultiPath) next, false);
                lineTo = false;
            }
            /*
             * 'polylines.hasNext()' check is conceptually part of 'for' instruction,
             * except that we need to skip this condition during the first iteration.
             */
            do if (!polylines.hasNext()) break add;
            while ((next = polylines.next()) == null);
        }
        return path;
    }
 
Example #17
Source Project: geometry-api-java   Author: Esri   File: OGCGeometry.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
	int hash = 1;
	com.esri.core.geometry.Geometry geom1 = getEsriGeometry();
	if (geom1 != null)
		hash = geom1.hashCode();
	
	if (esriSR != null)
		hash = NumberUtils.hashCombine(hash, esriSR.hashCode());
	
	return hash;
}
 
Example #18
Source Project: geometry-api-java   Author: Esri   File: OGCGeometry.java    License: Apache License 2.0 5 votes vote down vote up
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());
}
 
Example #19
Source Project: Bats   Author: lealone   File: GeoFunctions.java    License: Apache License 2.0 5 votes vote down vote up
/** Returns whether {@code geom1} intersects {@code geom2}. */
public static boolean ST_Intersects(Geom geom1, Geom geom2)  {
  final Geometry g1 = geom1.g();
  final Geometry g2 = geom2.g();
  final SpatialReference sr = geom1.sr();
  return intersects(g1, g2, sr);
}
 
Example #20
Source Project: Bats   Author: lealone   File: GeoFunctions.java    License: Apache License 2.0 5 votes vote down vote up
/** Computes the union of the geometries in {@code geomCollection}. */
 public static Geom ST_Union(Geom geomCollection) {
  SpatialReference sr = geomCollection.sr();
  final Geometry g =
      GeometryEngine.union(new Geometry[] {geomCollection.g()}, sr);
  return bind(g, sr);
}
 
Example #21
Source Project: defense-solutions-proofs-of-concept   Author: Esri   File: Polygon2PtProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
	
	MapGeometry mapGeo = ge.getGeometry();
	Geometry geo = mapGeo.getGeometry();
	if(geo.getType()!=Geometry.Type.Polygon)
		return null;
	Point center = GeometryUtility.CenterOfMass((Polygon)geo);
	MapGeometry outMapGeo = new MapGeometry(center, mapGeo.getSpatialReference());
	ge.setGeometry(outMapGeo);
	return ge;
}
 
Example #22
Source Project: spatial-framework-for-hadoop   Author: Esri   File: ST_EnvIntersects.java    License: Apache License 2.0 5 votes vote down vote up
public BooleanWritable evaluate(BytesWritable geometryref1, BytesWritable geometryref2)
{
	if (geometryref1 == null || geometryref2 == null ||
	    geometryref1.getLength() == 0 || geometryref2.getLength() == 0) {
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}
	if (!GeometryUtils.compareSpatialReferences(geometryref1, geometryref2)) {
		LogUtils.Log_SRIDMismatch(LOG, geometryref1, geometryref2);
		return null;
	}

	OGCGeometry ogcGeom1 = GeometryUtils.geometryFromEsriShape(geometryref1);
	OGCGeometry ogcGeom2 = GeometryUtils.geometryFromEsriShape(geometryref2);
	if (ogcGeom1 == null || ogcGeom2 == null){
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

	Geometry geometry1 = ogcGeom1.getEsriGeometry();
	Geometry geometry2 = ogcGeom2.getEsriGeometry();
	Envelope env1 = new Envelope(), env2 = new Envelope();
	geometry1.queryEnvelope(env1);
	geometry2.queryEnvelope(env2);

	resultBoolean.set(env1.isIntersecting(env2));
	return resultBoolean;
}
 
Example #23
Source Project: presto   Author: prestosql   File: PagesSpatialIndexSupplier.java    License: Apache License 2.0 5 votes vote down vote up
private static void accelerateGeometry(OGCGeometry ogcGeometry, Operator relateOperator)
{
    // Recurse into GeometryCollections
    GeometryCursor cursor = ogcGeometry.getEsriGeometryCursor();
    while (true) {
        com.esri.core.geometry.Geometry esriGeometry = cursor.next();
        if (esriGeometry == null) {
            break;
        }
        relateOperator.accelerateGeometry(esriGeometry, null, Geometry.GeometryAccelerationDegree.enumMild);
    }
}
 
Example #24
Source Project: presto   Author: prestosql   File: GeometryUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static Envelope getEnvelope(OGCGeometry ogcGeometry)
{
    GeometryCursor cursor = ogcGeometry.getEsriGeometryCursor();
    Envelope overallEnvelope = new Envelope();
    while (true) {
        Geometry geometry = cursor.next();
        if (geometry == null) {
            return overallEnvelope;
        }

        Envelope envelope = new Envelope();
        geometry.queryEnvelope(envelope);
        overallEnvelope.merge(envelope);
    }
}
 
Example #25
Source Project: presto   Author: prestosql   File: GeometryUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean disjoint(Envelope envelope, OGCGeometry ogcGeometry)
{
    GeometryCursor cursor = ogcGeometry.getEsriGeometryCursor();
    while (true) {
        Geometry geometry = cursor.next();
        if (geometry == null) {
            return true;
        }

        if (!GeometryEngine.disjoint(geometry, envelope, null)) {
            return false;
        }
    }
}
 
Example #26
Source Project: presto   Author: prestosql   File: GeometrySerde.java    License: Apache License 2.0 5 votes vote down vote up
private static OGCGeometry createFromEsriGeometry(Geometry geometry, boolean multiType)
{
    Geometry.Type type = geometry.getType();
    switch (type) {
        case Polygon: {
            if (!multiType && ((Polygon) geometry).getExteriorRingCount() <= 1) {
                return new OGCPolygon((Polygon) geometry, null);
            }
            return new OGCMultiPolygon((Polygon) geometry, null);
        }
        case Polyline: {
            if (!multiType && ((Polyline) geometry).getPathCount() <= 1) {
                return new OGCLineString((Polyline) geometry, 0, null);
            }
            return new OGCMultiLineString((Polyline) geometry, null);
        }
        case MultiPoint: {
            if (!multiType && ((MultiPoint) geometry).getPointCount() <= 1) {
                if (geometry.isEmpty()) {
                    return new OGCPoint(new Point(), null);
                }
                return new OGCPoint(((MultiPoint) geometry).getPoint(0), null);
            }
            return new OGCMultiPoint((MultiPoint) geometry, null);
        }
        case Point: {
            if (!multiType) {
                return new OGCPoint((Point) geometry, null);
            }
            return new OGCMultiPoint((Point) geometry, null);
        }
        case Envelope: {
            Polygon polygon = new Polygon();
            polygon.addEnvelope((Envelope) geometry, false);
            return new OGCPolygon(polygon, null);
        }
        default:
            throw new IllegalArgumentException("Unexpected geometry type: " + type);
    }
}
 
Example #27
Source Project: Quicksql   Author: Qihoo360   File: GeoFunctions.java    License: MIT License 5 votes vote down vote up
protected static Geom bind(Geometry geometry, int srid) {
  if (geometry == null) {
    return null;
  }
  if (srid == NO_SRID) {
    return new SimpleGeom(geometry);
  }
  return bind(geometry, SpatialReference.create(srid));
}
 
Example #28
Source Project: geometry-api-java   Author: Esri   File: OGCGeometry.java    License: Apache License 2.0 5 votes vote down vote up
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());
}
 
Example #29
Source Project: defense-solutions-proofs-of-concept   Author: Esri   File: SpatialQProcessor.java    License: Apache License 2.0 5 votes vote down vote up
private Geometry constructGeometry(MapGeometry geo) throws Exception {
	try {

		Geometry geoIn = geo.getGeometry();
		return GeometryEngine.project(geoIn, srIn, srBuffer);
	} catch (Exception e) {
		LOG.error(e.getMessage());
		LOG.error(e.getStackTrace());
		throw (e);
	}
}
 
Example #30
Source Project: Quicksql   Author: Qihoo360   File: GeoFunctions.java    License: MIT License 5 votes vote down vote up
/** Returns whether {@code geom1} intersects {@code geom2}. */
public static boolean ST_Intersects(Geom geom1, Geom geom2)  {
  final Geometry g1 = geom1.g();
  final Geometry g2 = geom2.g();
  final SpatialReference sr = geom1.sr();
  return intersects(g1, g2, sr);
}