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


Java GeometryAttribute类代码示例

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


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

示例1: load

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public static LinkedList<PreparedPolygon> load() throws IOException {

		URL krajeShp = Kraje.class
				.getResource("kraje/hranice_krajov_simpl.shp");
		FileDataStore store = FileDataStoreFinder.getDataStore(krajeShp);
		FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = store
				.getFeatureSource();
		FeatureCollection<SimpleFeatureType, SimpleFeature> fC = featureSource
				.getFeatures();

		FeatureIterator<SimpleFeature> iter = fC.features();

		LinkedList<PreparedPolygon> list = new LinkedList<PreparedPolygon>();

		try {
			while (iter.hasNext()) {
				Feature f = iter.next();
				GeometryAttribute geomAttr = f.getDefaultGeometryProperty();
				list.add(new PreparedPolygon((Polygonal) geomAttr.getValue()));
			}
		} finally {
			iter.close();
		}

		return list;
	}
 
开发者ID:MilanNobonn,项目名称:freemapKaPor,代码行数:27,代码来源:Kraje.java

示例2: makeProtoRoute

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public ProtoRoute makeProtoRoute(ExtendedFeature exft, Double speed) throws Exception {
	GeometryAttribute geomAttr = exft.feat.getDefaultGeometryProperty();
	MultiLineString geom = (MultiLineString) geomAttr.getValue();

	if (FAIL_ON_MULTILINESTRING && geom.getNumGeometries() > 1) {
		throw new Exception("Features may only contain a single linestring.");
	}
	
	double spacing = Config.getSpacing(exft, this.data);

	LineString ls = (LineString) geom.getGeometryN(0);
	ProtoRoute ret = this.makeProtoRouteStopsFromLinestring(ls, spacing);
	ret.speed = speed;
	return ret;
}
 
开发者ID:conveyal,项目名称:geom2gtfs,代码行数:16,代码来源:PicketStopGenerator.java

示例3: makeProtoRoute

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
@Override
public ProtoRoute makeProtoRoute(ExtendedFeature exft, Double speed) throws Exception {
	GeometryAttribute geomAttr = exft.feat.getDefaultGeometryProperty();
	MultiLineString geom = (MultiLineString) geomAttr.getValue();

	if (FAIL_ON_MULTILINESTRING && geom.getNumGeometries() > 1) {
		throw new Exception("Features may only contain a single linestring.");
	}
	
	LineString ls = (LineString) geom.getGeometryN(0);
	ProtoRoute ret = this.makeProtoRouteStopsFromLinestring(ls);
	ret.speed = speed;
			
	return ret;
}
 
开发者ID:conveyal,项目名称:geom2gtfs,代码行数:16,代码来源:ShapefileStopGenerator.java

示例4: transformFeature

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
private Map<String, Object> transformFeature(SimpleFeature feature) {
	Map<String, Object> attributes = new HashMap<String, Object>();
	for (Property prop : feature.getProperties()) {
		attributes.put(prop.getName().getLocalPart(), prop.getValue());
	}

	GeometryAttribute geometryProperty = feature
			.getDefaultGeometryProperty();
	if (geometryProperty != null) {
		String wktGeometry = "";
		try {
			if (feature.getDefaultGeometry() != null) {
				Geometry geometry = (Geometry) feature
						.getDefaultGeometry();
				if (simplifyGeometry > 0) {
					DouglasPeuckerSimplifier simplifier = new DouglasPeuckerSimplifier(
							geometry);
					simplifier.setDistanceTolerance(simplifyGeometry);
					geometry = simplifier.getResultGeometry();
				}
				if (transform != null) {
					geometry = JTS.transform(geometry, transform);
				}
				wktGeometry = geometry.toString();
			}
		} catch (Exception e) {
			LOGGER.warn("Could not convert Geometry to WKT String. Geometry will not be indexed!");
		}
		attributes.put(geometryProperty.getName().getLocalPart(),
				wktGeometry);
		attributes.put(FID_KEY, feature.getID());
	}

	return attributes;
}
 
开发者ID:Geodan,项目名称:solr-dataimporthandler-wfs,代码行数:36,代码来源:WFSDataSource.java

示例5: getDefaultGeometryProperty

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public GeometryAttribute getDefaultGeometryProperty() {
	return simpleFeature.getDefaultGeometryProperty();
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:4,代码来源:SimpleFeatureWrapper.java

示例6: setDefaultGeometryProperty

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public void setDefaultGeometryProperty(
		GeometryAttribute geometryAttribute ) {
	simpleFeature.setDefaultGeometryProperty(geometryAttribute);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:5,代码来源:SimpleFeatureWrapper.java

示例7: main

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public static void main (String[] args) throws Exception {
	Map<String,Object> params = new HashMap<String,Object>();
    params.put( "dbtype", "monetdb");
    params.put( "host", "localhost");
    params.put( "database", "test");
    params.put( "user", "monetdb");
    params.put( "passwd", "monetdb");
    
    DataStore dataStore = (new MonetDBDataStoreFactory()).createDataStore( params );
    if (dataStore == null) {
    	throw new Exception("Unable to create datastore!");
    }        
    System.out.println("DataStore created!");
    
    FeatureSource fsBuildings = dataStore.getFeatureSource("nyc_buildings");
    
    //System.out.println("bc count: " + fsBC.getCount(Query.ALL));
    
    System.out.println(fsBuildings.getSchema().getGeometryDescriptor());
    
    Query query = Query.ALL;
    query.setMaxFeatures(10);
    FeatureCollection collection = fsBuildings.getFeatures(query);
    
    System.out.println(collection.getBounds());
    
    FeatureIterator iter = collection.features();
    int counter = 0;
    while(iter.hasNext()) {
    	Feature feature = iter.next();
    	
    	//System.out.println(feature);
    	
    	GeometryAttribute geom = feature.getDefaultGeometryProperty();
    	
    	counter++;
    	if (counter >= 10) break;
    }
    
    
    
    dataStore.dispose();
}
 
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:44,代码来源:MonetDBDataStoreFactory.java

示例8: getDefaultGeometryProperty

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
/** Not Implemented. Use Attributes */
public GeometryAttribute getDefaultGeometryProperty() {return null;}
 
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:3,代码来源:SimpleFeatureImpl.java

示例9: setDefaultGeometryProperty

import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
/** Not Implemented. Use Attributes */
public void setDefaultGeometryProperty(GeometryAttribute arg0) {}
 
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:3,代码来源:SimpleFeatureImpl.java


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