本文整理汇总了Java中com.esri.core.geometry.ogc.OGCGeometry.fromJson方法的典型用法代码示例。如果您正苦于以下问题:Java OGCGeometry.fromJson方法的具体用法?Java OGCGeometry.fromJson怎么用?Java OGCGeometry.fromJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.core.geometry.ogc.OGCGeometry
的用法示例。
在下文中一共展示了OGCGeometry.fromJson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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.fromJson(json);
return GeometryUtils.geometryToEsriShapeBytesWritable(ogcGeom);
} catch (Exception e) {
}
return null;
}
示例2: testPolylineSimplifyIssueGithub52
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testPolylineSimplifyIssueGithub52() throws Exception {
String json = "{\"paths\":[[[2,0],[4,3],[5,1],[3.25,1.875],[1,3]]],\"spatialReference\":{\"wkid\":4326}}";
{
OGCGeometry g = OGCGeometry.fromJson(json);
assertTrue(g.geometryType().equals("LineString"));
OGCGeometry simpleG = g.makeSimple();//make ogc simple
assertTrue(simpleG.geometryType().equals("MultiLineString"));
assertTrue(simpleG.isSimpleRelaxed());//geodatabase simple
assertTrue(simpleG.isSimple());//ogc simple
OGCMultiLineString mls =(OGCMultiLineString)simpleG;
assertTrue(mls.numGeometries() == 4);
OGCGeometry baseGeom = OGCGeometry.fromJson("{\"paths\":[[[2,0],[3.25,1.875]],[[3.25,1.875],[4,3],[5,1]],[[5,1],[3.25,1.875]],[[3.25,1.875],[1,3]]],\"spatialReference\":{\"wkid\":4326}}");
assertTrue(simpleG.equals(baseGeom));
}
}
示例3: testIsectTriaJson1
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectTriaJson1() throws Exception {
String json1 = "{\"rings\":[[[1, 0], [3, 0], [1, 2], [1, 0]]], \"spatialReference\":{\"wkid\":4326}}";
String json2 = "{\"rings\":[[[0, 1], [2, 1], [0, 3], [0, 1]]], \"spatialReference\":{\"wkid\":4326}}";
OGCGeometry g0 = OGCGeometry.fromJson(json1);
OGCGeometry g1 = OGCGeometry.fromJson(json2);
OGCGeometry rslt = g0.intersection(g1);
assertTrue(rslt != null);
assertTrue(rslt.geometryType().equals("Polygon"));
assertTrue(rslt.esriSR.getID() == 4326);
String s = GeometryEngine.geometryToJson(rslt.getEsriSpatialReference().getID(), rslt.getEsriGeometry());
}