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


Java GeometryEngine.geometryFromEsriShape方法代码示例

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


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

示例1: testPointAsShape

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

示例2: 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

示例3: evaluate

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

示例4: main

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public static void main(final String[] args) throws IOException
{
    final String tableName = args.length == 0 ? "CustPoi" : args[0];
    final Configuration configuration = HBaseConfiguration.create();
    final HTable table = new HTable(configuration, tableName);
    try
    {
        final Scan scan = new Scan();
        scan.setMaxVersions(1);
        scan.setCaching(1000);
        final ResultScanner scanner = table.getScanner(scan);
        try
        {
            for (final Result result : scanner)
            {
                final int oid = Bytes.toInt(result.getRow());
                final byte[] bytes = result.getValue(Const.GEOM, Const.SHAPE);
                final Point point = (Point) GeometryEngine.geometryFromEsriShape(bytes, Geometry.Type.Point);
                System.out.format("%d %.6f %.6f\n", oid, point.getX(), point.getY());
            }
        }
        finally
        {
            scanner.close();
        }
    }
    finally
    {
        table.close();
    }
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:32,代码来源:ESRIPointScan.java

示例5: constructGeometry

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Override
public Geometry constructGeometry() {
	return GeometryEngine.geometryFromEsriShape(shapeGeometry, geomType);
}
 
开发者ID:frett27,项目名称:osm-flink-tools,代码行数:5,代码来源:ComplexEntity.java

示例6: polylineFromAscii

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public static Polyline polylineFromAscii(String ascii) throws Exception {
	return (Polyline) GeometryEngine.geometryFromEsriShape(fromAscii(ascii), Geometry.Type.Polyline);
}
 
开发者ID:frett27,项目名称:osm-flink-tools,代码行数:4,代码来源:GeometryTools.java


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