当前位置: 首页>>代码示例>>Java>>正文


Java GeometryEngine.geometryToEsriShape方法代码示例

本文整理汇总了Java中com.esri.core.geometry.GeometryEngine.geometryToEsriShape方法的典型用法代码示例。如果您正苦于以下问题:Java GeometryEngine.geometryToEsriShape方法的具体用法?Java GeometryEngine.geometryToEsriShape怎么用?Java GeometryEngine.geometryToEsriShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esri.core.geometry.GeometryEngine的用法示例。


在下文中一共展示了GeometryEngine.geometryToEsriShape方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
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;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:23,代码来源:ST_AsShape.java

示例2: testGeomFromPointShapeWithoutSpatialReference

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPointShapeWithoutSpatialReference() throws UDFArgumentException {
	Point point = createFirstLocation();

	byte[] esriShape = GeometryEngine.geometryToEsriShape(point);
	assertNotNull("The shape must not be null!", esriShape);

	BytesWritable shapeAsWritable = new BytesWritable(esriShape);
	assertNotNull("The shape writable must not be null!", shapeAsWritable);

	ST_GeomFromShape fromShape = new ST_GeomFromShape();
	BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable);
	assertNotNull("The geometry writable must not be null!", geometryAsWritable);

	final int wkid = 0;
	validatePoint(point, wkid, geometryAsWritable);
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:18,代码来源:TestStGeomFromShape.java

示例3: testGeomFromPointShape

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPointShape() throws UDFArgumentException {
	Point point = createFirstLocation();
	byte[] esriShape = GeometryEngine.geometryToEsriShape(point);
	assertNotNull("The shape must not be null!", esriShape);

	BytesWritable shapeAsWritable = new BytesWritable(esriShape);
	assertNotNull("The shape writable must not be null!", shapeAsWritable);

	final int wkid = 4326;
	ST_GeomFromShape fromShape = new ST_GeomFromShape();
	BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
	assertNotNull("The geometry writable must not be null!", geometryAsWritable);

	validatePoint(point, wkid, geometryAsWritable);
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:17,代码来源:TestStGeomFromShape.java

示例4: testGeomFromLineShape

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromLineShape() throws UDFArgumentException {
	Polyline line = createLine();
	byte[] esriShape = GeometryEngine.geometryToEsriShape(line);
	assertNotNull("The shape must not be null!", esriShape);

	BytesWritable shapeAsWritable = new BytesWritable(esriShape);
	assertNotNull("The shape writable must not be null!", shapeAsWritable);

	final int wkid = 4326;
	ST_GeomFromShape fromShape = new ST_GeomFromShape();
	BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
	assertNotNull("The geometry writable must not be null!", geometryAsWritable);

	OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geometryAsWritable);
	assertNotNull("The OGC geometry must not be null!", ogcGeometry);

	Geometry esriGeometry = ogcGeometry.getEsriGeometry();
	assertNotNull("The Esri geometry must not be null!", esriGeometry);
	assertTrue("The geometries are different!",
			GeometryEngine.equals(line, esriGeometry, SpatialReference.create(wkid)));
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:23,代码来源:TestStGeomFromShape.java

示例5: testGeomFromPolylineShape

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPolylineShape() throws UDFArgumentException {
	Polyline line = createPolyline();
	byte[] esriShape = GeometryEngine.geometryToEsriShape(line);
	assertNotNull("The shape must not be null!", esriShape);

	BytesWritable shapeAsWritable = new BytesWritable(esriShape);
	assertNotNull("The shape writable must not be null!", shapeAsWritable);

	final int wkid = 4326;
	ST_GeomFromShape fromShape = new ST_GeomFromShape();
	BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
	assertNotNull("The geometry writable must not be null!", geometryAsWritable);

	OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geometryAsWritable);
	assertNotNull("The OGC geometry must not be null!", ogcGeometry);

	Geometry esriGeometry = ogcGeometry.getEsriGeometry();
	assertNotNull("The Esri geometry must not be null!", esriGeometry);
	assertTrue("The geometries are different!",
			GeometryEngine.equals(line, esriGeometry, SpatialReference.create(wkid)));
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:23,代码来源:TestStGeomFromShape.java

示例6: testGeomFromPolygonShape

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPolygonShape() throws UDFArgumentException {
	Polygon polygon = createPolygon();
	byte[] esriShape = GeometryEngine.geometryToEsriShape(polygon);
	assertNotNull("The shape must not be null!", esriShape);

	BytesWritable shapeAsWritable = new BytesWritable(esriShape);
	assertNotNull("The shape writable must not be null!", shapeAsWritable);

	final int wkid = 4326;
	ST_GeomFromShape fromShape = new ST_GeomFromShape();
	BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
	assertNotNull("The geometry writable must not be null!", geometryAsWritable);

	OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geometryAsWritable);
	assertNotNull("The OGC geometry must not be null!", ogcGeometry);

	Geometry esriGeometry = ogcGeometry.getEsriGeometry();
	assertNotNull("The Esri geometry must not be null!", esriGeometry);
	assertTrue("The geometries are different!",
			GeometryEngine.equals(polygon, esriGeometry, SpatialReference.create(wkid)));
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:23,代码来源:TestStGeomFromShape.java

示例7: testGeomEngine

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomEngine()
{
    final Envelope orig = new Envelope(0, 0, 10, 10);
    final byte[] bytes = GeometryEngine.geometryToEsriShape(orig);
    Assert.assertNotNull(bytes);
    final Geometry geometry = GeometryEngine.geometryFromEsriShape(bytes, Geometry.Type.Envelope);
    Assert.assertNotNull(geometry);
    Assert.assertTrue(geometry instanceof Envelope);
    final Envelope dest = (Envelope) geometry;
    Assert.assertEquals(0, dest.getXMin(), 0.001);
    Assert.assertEquals(0, dest.getYMin(), 0.001);
    Assert.assertEquals(10, dest.getXMax(), 0.001);
    Assert.assertEquals(10, dest.getYMax(), 0.001);
}
 
开发者ID:mraad,项目名称:GeoEnrichment,代码行数:16,代码来源:GeomEngineTest.java


注:本文中的com.esri.core.geometry.GeometryEngine.geometryToEsriShape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。