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


Java OGCGeometry类代码示例

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


OGCGeometry类属于com.esri.core.geometry.ogc包,在下文中一共展示了OGCGeometry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BytesWritable evaluate(Text wkwrap, int wkid) throws UDFArgumentException {

		String wkt = wkwrap.toString();

		try {
			Geometry geomObj = GeometryEngine.geometryFromWkt(wkt,
															  0,
															  Geometry.Type.Unknown);
			SpatialReference spatialReference = null;  // Idea: OGCGeometry.setSpatialReference after .fromText
			if (wkid != GeometryUtils.WKID_UNKNOWN) {
				spatialReference = SpatialReference.create(wkid);
			}
			OGCGeometry ogcObj = OGCGeometry.createFromEsriGeometry(geomObj, spatialReference);
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} catch (Exception e) {  // IllegalArgumentException, GeometryException
			LogUtils.Log_InvalidText(LOG, wkt);
			return null;
		}
	}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:20,代码来源:ST_GeomCollection.java

示例2: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
@Override
public Object evaluate(DeferredObject[] args) throws HiveException {
	
	OGCGeometry geom1 = geomHelper1.getGeometry(args);
	OGCGeometry geom2 = geomHelper2.getGeometry(args);
	
	if (geom1 == null || geom2 == null) {
		return false;
	}

	if (firstRun && geomHelper1.isConstant()) {
		
		// accelerate geometry 1 for quick relation operations since it is constant
		geom1IsAccelerated = opSimpleRelation.accelerateGeometry(geom1.getEsriGeometry(), 
				geom1.getEsriSpatialReference(), GeometryAccelerationDegree.enumMedium);
	}

	firstRun = false;
	
	return opSimpleRelation.execute(geom1.getEsriGeometry(), geom2.getEsriGeometry(), geom1.getEsriSpatialReference(), null);
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:22,代码来源:ST_GeometryRelational.java

示例3: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public DoubleWritable 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;
	}

	Envelope envBound = new Envelope();
	ogcGeometry.getEsriGeometry().queryEnvelope(envBound);
	resultDouble.set(envBound.getYMin());
	return resultDouble;
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:18,代码来源:ST_MinY.java

示例4: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public DoubleWritable evaluate(BytesWritable geomref) {
	if (geomref == null || geomref.getLength() == 0) {
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

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

	switch(GeometryUtils.getType(geomref)) {
	case ST_POINT:
		OGCPoint pt = (OGCPoint)ogcGeometry;
		resultDouble.set(pt.M());
		return resultDouble;
	default:
		LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_POINT, GeometryUtils.getType(geomref));
		return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:26,代码来源:ST_M.java

示例5: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BytesWritable evaluate(BytesWritable geomref, IntWritable index) {
	if (geomref == null || geomref.getLength() == 0 || index == null) {
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

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

	int idx = index.get() - 1;  // 1-based UI, 0-based engine
	if (GeometryUtils.getType(geomref) == GeometryUtils.OGCType.ST_POLYGON) {
		try {
			OGCLineString hole = ((OGCPolygon)(ogcGeometry)).interiorRingN(idx);
			return GeometryUtils.geometryToEsriShapeBytesWritable(hole);
		} catch (Exception e) {
			LogUtils.Log_InternalError(LOG, "ST_InteriorRingN: " + e);
			return null;
		}
	} else {
		LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_POLYGON, GeometryUtils.getType(geomref));
		return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:27,代码来源:ST_InteriorRingN.java

示例6: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public IntWritable 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;
	}
	if (GeometryUtils.getType(geomref) == GeometryUtils.OGCType.ST_POLYGON) {
		try {
			resultInt.set(((OGCPolygon)(ogcGeometry)).numInteriorRing());
			return resultInt;
		} catch (Exception e) {
			LogUtils.Log_InternalError(LOG, "ST_NumInteriorRing: " + e);
			return null;
		}
	} else {
		LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_POLYGON, GeometryUtils.getType(geomref));
		return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:25,代码来源:ST_NumInteriorRing.java

示例7: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public DoubleWritable 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;
	}
	if (!ogcGeometry.isMeasured()) {
		LogUtils.Log_NotMeasured(LOG);
		return null;
	}

	resultDouble.set(ogcGeometry.MaxMeasure());
	return resultDouble;
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:20,代码来源:ST_MaxM.java

示例8: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BytesWritable evaluate(Text wkwrap) throws UDFArgumentException {
	String wkt = wkwrap.toString();
	try {
		OGCGeometry ogcObj = OGCGeometry.fromText(wkt);
		ogcObj.setSpatialReference(null);
		if (ogcObj.geometryType().equals("MultiLineString")) {
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} else {
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTILINESTRING, GeometryUtils.OGCType.UNKNOWN);
			return null;
		}

	} catch (Exception e) {  // IllegalArgumentException, GeometryException
		LogUtils.Log_InvalidText(LOG, wkt);
		return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:18,代码来源:ST_MultiLineString.java

示例9: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BytesWritable evaluate(DoubleWritable ... xyPairs) throws UDFArgumentLengthException{

		if (xyPairs == null || xyPairs.length == 0 ||  xyPairs.length%2 != 0) {
			LogUtils.Log_VariableArgumentLengthXY(LOG);
			return null;
		}

		try {
			MultiPoint mPoint = new MultiPoint();

			for (int i=0;i<xyPairs.length;i+=2){
				mPoint.add(xyPairs[i].get(), xyPairs[i+1].get());
			}

			return GeometryUtils.geometryToEsriShapeBytesWritable(OGCGeometry.createFromEsriGeometry(mPoint, null, true));
		} catch (Exception e) {
		    LogUtils.Log_InternalError(LOG, "ST_MultiPoint: " + e);
		    return null;
		}
	}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:21,代码来源:ST_MultiPoint.java

示例10: testMultiPointSinglePoint

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
@Test
public void testMultiPointSinglePoint() {
	String wkt = "multipoint((1 0))";
	OGCGeometry g0 = OGCGeometry.fromText(wkt);
	assertTrue(g0.dimension() == 0);
	String gt = g0.geometryType();
	assertTrue(gt.equals("MultiPoint"));
	OGCMultiPoint mp = (OGCMultiPoint)g0;
	assertTrue(mp.numGeometries() == 1);
	OGCGeometry p = mp.geometryN(0);
	String s = p.asText();
	assertTrue(s.equals("POINT (1 0)"));
	
	String ms = p.convertToMulti().asText();
	assertTrue(ms.equals("MULTIPOINT ((1 0))"));
	
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:18,代码来源:TestOGC.java

示例11: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BytesWritable evaluate(BytesWritable wkb, int wkid) throws UDFArgumentException {

		try {
			SpatialReference spatialReference = null;
			if (wkid != GeometryUtils.WKID_UNKNOWN) {
				spatialReference = SpatialReference.create(wkid);
			}
			byte [] byteArr = wkb.getBytes();
            ByteBuffer byteBuf = ByteBuffer.allocate(byteArr.length);
			byteBuf.put(byteArr);
			OGCGeometry ogcObj = OGCGeometry.fromBinary(byteBuf);
			ogcObj.setSpatialReference(spatialReference);
			String gType = ogcObj.geometryType();
			if (gType.equals("MultiLineString") || gType.equals("LineString")) {
				return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
			} else {
				LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTILINESTRING, GeometryUtils.OGCType.UNKNOWN);
				return null;
			}
		} catch (Exception e) {  // IllegalArgumentException, GeometryException
			LOG.error(e.getMessage());
			return null;
		}
	}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:25,代码来源:ST_MLineFromWKB.java

示例12: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BooleanWritable 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 {
		resultBoolean.set(ogcGeometry.isEmpty());
	} catch (Exception e) {
	    LogUtils.Log_InternalError(LOG, "ST_IsEmpty" + e);
		return null;
	}
	return resultBoolean;
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:21,代码来源:ST_IsEmpty.java

示例13: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BytesWritable evaluate(BytesWritable wkb, int wkid) throws UDFArgumentException {

		try {
			SpatialReference spatialReference = null;
			if (wkid != GeometryUtils.WKID_UNKNOWN) {
				spatialReference = SpatialReference.create(wkid);
			}
			byte [] byteArr = wkb.getBytes();
            ByteBuffer byteBuf = ByteBuffer.allocate(byteArr.length);
			byteBuf.put(byteArr);
			OGCGeometry ogcObj = OGCGeometry.fromBinary(byteBuf);
			ogcObj.setSpatialReference(spatialReference);
			String gType = ogcObj.geometryType();
			if (gType.equals("MultiPoint") || gType.equals("Point")) {
				return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
			} else {
				LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_LINESTRING, GeometryUtils.OGCType.UNKNOWN);
				return null;
			}
		} catch (Exception e) {  // IllegalArgumentException, GeometryException
			LOG.error(e.getMessage());
			return null;
		}
	}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:25,代码来源:ST_MPointFromWKB.java

示例14: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
public BytesWritable evaluate(Text wkwrap, int wkid) throws UDFArgumentException {

		String wkt = wkwrap.toString();
		try {
			SpatialReference spatialReference = null;
			if (wkid != GeometryUtils.WKID_UNKNOWN) {
				spatialReference = SpatialReference.create(wkid);
			}
			OGCGeometry ogcObj = OGCGeometry.fromText(wkt);
			ogcObj.setSpatialReference(spatialReference);
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} catch (Exception e) {  // IllegalArgumentException, GeometryException
			LogUtils.Log_InvalidText(LOG, wkt);
			return null;
		}
	}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:17,代码来源:ST_GeomFromText.java

示例15: evaluate

import com.esri.core.geometry.ogc.OGCGeometry; //导入依赖的package包/类
@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
	DeferredObject jsonDeferredObject = arguments[0];

	String json = null;

	if (jsonOI.getCategory() == Category.STRUCT){
		//StructObjectInspector structOI = (StructObjectInspector)jsonOI;

		// TODO support structs
	} else {
		PrimitiveObjectInspector primOI = (PrimitiveObjectInspector)jsonOI;
		json = (String)primOI.getPrimitiveJavaObject(jsonDeferredObject.get());
	}

	try {
		OGCGeometry ogcGeom = OGCGeometry.fromGeoJson(json);
	    return GeometryUtils.geometryToEsriShapeBytesWritable(ogcGeom);
	} catch (Exception e) {
		LogUtils.Log_InvalidText(LOG, json);
	}

	return null;
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:25,代码来源:ST_GeomFromGeoJson.java


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