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


Java OGCGeometry.fromText方法代码示例

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


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

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

示例2: 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("MultiPoint")) {
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} else {
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTIPOINT, GeometryUtils.OGCType.UNKNOWN);
			return null;
		}
	} catch (Exception e) {  // IllegalArgumentException, GeometryException
			LogUtils.Log_InvalidText(LOG, wkt);
			return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:17,代码来源:ST_MultiPoint.java

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

示例4: 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("Point")) {
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} else {
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_POINT, 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_Point.java

示例5: 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("MultiPolygon")) {
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} else {
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTIPOLYGON, GeometryUtils.OGCType.UNKNOWN);
			return null;
		}
	} catch (Exception e) {  // IllegalArgumentException, GeometryException
		LogUtils.Log_InvalidText(LOG, wkt);
		return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:17,代码来源:ST_MultiPolygon.java

示例6: 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("LineString")) {
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} else {
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_LINESTRING, 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_LineString.java

示例7: 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("Polygon")) {
			return GeometryUtils.geometryToEsriShapeBytesWritable(ogcObj);
		} else {
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_POLYGON, GeometryUtils.OGCType.UNKNOWN);
			return null;
		}
	} catch (Exception e) {  // IllegalArgumentException, GeometryException
		LogUtils.Log_InvalidText(LOG, wkt);
		return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:17,代码来源:ST_Polygon.java

示例8: getGeometry

import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
private OGCGeometry getGeometry(DeferredObject arg) {
	Object writable;
	try {
		writable = oi.getPrimitiveWritableObject(arg.get());
	} catch (HiveException e) {
		LOG.error("Failed to get writable", e);
		return null;
	}
	
	if (writable == null) {
		return null;
	}
	
	switch (oi.getPrimitiveCategory()) {
		case BINARY: return getGeometryFromBytes((BytesWritable)writable);
		case STRING: return OGCGeometry.fromText(((Text)writable).toString());
		default: return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:20,代码来源:HiveGeometryOIHelper.java

示例9: testPoint

import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testPoint() {
	OGCGeometry g = OGCGeometry.fromText("POINT(1 2)");
	assertTrue(g.geometryType().equals("Point"));
	OGCPoint p = (OGCPoint) g;
	assertTrue(p.X() == 1);
	assertTrue(p.Y() == 2);
	assertTrue(g.equals(OGCGeometry.fromText("POINT(1 2)")));
	assertTrue(!g.equals(OGCGeometry.fromText("POINT(1 3)")));
	assertTrue(g.equals((Object)OGCGeometry.fromText("POINT(1 2)")));
	assertTrue(!g.equals((Object)OGCGeometry.fromText("POINT(1 3)")));
	OGCGeometry buf = g.buffer(10);
	assertTrue(buf.geometryType().equals("Polygon"));
	OGCPolygon poly = (OGCPolygon) buf.envelope();
	double a = poly.area();
	assertTrue(Math.abs(a - 400) < 1e-1);
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:18,代码来源:TestOGC.java

示例10: testFirstPointOfPolygon

import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testFirstPointOfPolygon() {
	OGCGeometry g = OGCGeometry
			.fromText("POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -5 5, 5 5, 5 -5, -5 -5))");
	assertTrue(g.geometryType().equals("Polygon"));
	OGCPolygon p = (OGCPolygon) g;
	assertTrue(p.numInteriorRing() == 1);
	OGCLineString ls = p.exteriorRing();
	OGCPoint p1 = ls.pointN(1);
	assertTrue(ls.pointN(1).equals(OGCGeometry.fromText("POINT(10 -10)")));
	OGCPoint p2 = ls.pointN(3);
	assertTrue(ls.pointN(3).equals(OGCGeometry.fromText("POINT(-10 10)")));
	OGCPoint p0 = ls.pointN(0);
	assertTrue(ls.pointN(0).equals(OGCGeometry.fromText("POINT(-10 -10)")));
	String ms = g.convertToMulti().asText();
	assertTrue(ms.equals("MULTIPOLYGON (((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -5 5, 5 5, 5 -5, -5 -5)))"));

}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:19,代码来源:TestOGC.java

示例11: testMultiPolygonUnion

import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testMultiPolygonUnion() {
	OGCGeometry g = OGCGeometry
			.fromText("POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -5 5, 5 5, 5 -5, -5 -5))");
	OGCGeometry g2 = OGCGeometry
			.fromText("POLYGON((90 90, 110 90, 110 110, 90 110, 90 90))");
	OGCGeometry u = g.union(g2);
	assertTrue(u.geometryType().equals("MultiPolygon"));
	assertTrue(!u.contains(OGCGeometry.fromText("POINT(0 0)")));
	assertTrue(u.contains(OGCGeometry.fromText("POINT(9 9)")));
	assertTrue(!u.contains(OGCGeometry.fromText("POINT(-20 1)")));
	assertTrue(u.disjoint(OGCGeometry.fromText("POINT(0 0)")));
	assertTrue(!u.disjoint(OGCGeometry.fromText("POINT(9 9)")));
	assertTrue(u.disjoint(OGCGeometry.fromText("POINT(-20 1)")));
	assertTrue(u.contains(OGCGeometry.fromText("POINT(100 100)")));
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:17,代码来源:TestOGC.java

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

示例13: testFirstPointOfLineString

import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testFirstPointOfLineString() {
	OGCGeometry g = OGCGeometry
			.fromText("LINESTRING(-10 -10, 10 -10, 10 10, -10 10, -10 -10)");
	assertTrue(g.geometryType().equals("LineString"));
	OGCLineString p = (OGCLineString) g;
	assertTrue(p.numPoints() == 5);
	assertTrue(p.isClosed());
	assertTrue(p.pointN(1).equals(OGCGeometry.fromText("POINT(10 -10)")));
	String ms = g.convertToMulti().asText();
	assertTrue(ms.equals("MULTILINESTRING ((-10 -10, 10 -10, 10 10, -10 10, -10 -10))"));
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:13,代码来源:TestOGC.java

示例14: testIsectTria3

import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectTria3() {
	String wkt = "polygon((1 0, 3 0, 1 2, 1 0))";
	String wk2 = "polygon((2 2, 2 1, 3 1, 2 2))";
	OGCGeometry g0 = OGCGeometry.fromText(wkt);
	OGCGeometry g1 = OGCGeometry.fromText(wk2);
	g0.setSpatialReference(SpatialReference.create(4326));
	g1.setSpatialReference(SpatialReference.create(4326));
	OGCGeometry rslt = g0.intersection(g1);
	assertTrue(rslt != null);
	assertTrue(rslt.dimension() == 0);
	assertTrue(rslt.geometryType().equals("Point"));
	assertTrue(rslt.esriSR.getID() == 4326);
	String s = rslt.asText();
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:16,代码来源:TestOGC.java

示例15: testIntersection

import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIntersection() {
	OGCGeometry g = OGCGeometry.fromText("LINESTRING(0 0, 10 10)");
	OGCGeometry g2 = OGCGeometry.fromText("LINESTRING(10 0, 0 10)");
	OGCGeometry u = g.intersection(g2);
	assertTrue(u.dimension() == 0);
	String s = u.asText();
	assertTrue(u.equals(OGCGeometry.fromText("POINT(5 5)")));
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:10,代码来源:TestOGC.java


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