本文整理汇总了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;
}
}
示例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);
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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))"));
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}