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


Java GeometryEngine.union方法代码示例

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


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

示例1: ST_Union

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
/** Computes the union of {@code geom1} and {@code geom2}. */
public static Geom ST_Union(Geom geom1, Geom geom2) {
  SpatialReference sr = geom1.sr();
  final Geometry g =
      GeometryEngine.union(new Geometry[]{geom1.g(), geom2.g()}, sr);
  return bind(g, sr);
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:GeoFunctions.java

示例2: evaluate

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public BytesWritable evaluate (BytesWritable ... geomrefs){
	// validate arguments
	if (geomrefs == null || geomrefs.length < 2){
		LogUtils.Log_VariableArgumentLength(LOG);
	}

	int firstWKID = 0;

	SpatialReference spatialRef = null;

	// validate spatial references and geometries first
	for (int i=0;i<geomrefs.length; i++){
		
		BytesWritable geomref = geomrefs[i];
		
		if (geomref == null || geomref.getLength() == 0){
			LogUtils.Log_ArgumentsNull(LOG);
			return null;
		}

		if (i==0){
			firstWKID = GeometryUtils.getWKID(geomref);
			if (firstWKID != GeometryUtils.WKID_UNKNOWN) {
				spatialRef = SpatialReference.create(firstWKID);
			}
		} else if (firstWKID != GeometryUtils.getWKID(geomref)){
			LogUtils.Log_SRIDMismatch(LOG, geomrefs[0], geomref);
			return null;
		}
	}
	
	// now build geometry array to pass to GeometryEngine.union
	Geometry [] geomsToUnion = new Geometry[geomrefs.length];
	
	for (int i=0;i<geomrefs.length;i++){
		//HiveGeometry hiveGeometry = GeometryUtils.geometryFromEsriShape(geomrefs[i]);
		OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomrefs[i]);
		
		// if (i==0){   // get from ogcGeometry rather than re-create above?
		// 	spatialRef = hiveGeometry.spatialReference;
		// }
		
		if (ogcGeometry == null){
			LogUtils.Log_ArgumentsNull(LOG);
			return null;
		}
		
		geomsToUnion[i] = ogcGeometry.getEsriGeometry();
	}
	
	try {
		Geometry unioned = GeometryEngine.union(geomsToUnion, spatialRef);

		// we have to infer the type of the differenced geometry because we don't know
		// if it's going to end up as a single or multi-part geometry
		OGCType inferredType = GeometryUtils.getInferredOGCType(unioned);
		
		return GeometryUtils.geometryToEsriShapeBytesWritable(unioned, firstWKID, inferredType);
	} catch (Exception e){
		LogUtils.Log_ExceptionThrown(LOG, "GeometryEngine.union", e);
		return null;
	}
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:64,代码来源:ST_Union.java


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