本文整理汇总了Java中org.geotools.feature.FeatureCollections类的典型用法代码示例。如果您正苦于以下问题:Java FeatureCollections类的具体用法?Java FeatureCollections怎么用?Java FeatureCollections使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FeatureCollections类属于org.geotools.feature包,在下文中一共展示了FeatureCollections类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getWifUAZfromShpFile
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
/**
* Gets the wif ua zfrom shp file.
*
* @param uAZShpURL
* the u az shp url
* @return the wif ua zfrom shp file
*/
public SimpleFeatureCollection getWifUAZfromShpFile(final URL uAZShpURL) {
LOGGER.info("uAZShpURL FilePath: {} ", uAZShpURL.getFile());
SimpleFeatureCollection uazFeatureCollection = FeatureCollections
.newCollection();
FileDataStore storeUD;
try {
storeUD = openFileDataStore(uAZShpURL.getFile());
final SimpleFeatureSource featureSourceUD = storeUD.getFeatureSource();
uazFeatureCollection = featureSourceUD.getFeatures();
LOGGER.debug("featureCollection size : {} ", uazFeatureCollection.size());
} catch (final IOException e) {
LOGGER.error("getWifUAZfromShpFile ", e.getMessage());
}
return uazFeatureCollection;
}
开发者ID:AURIN,项目名称:online-whatif,代码行数:25,代码来源:GeodataFinder.java
示例2: getWifUAZfromDB
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
/**
* Gets the wif ua zfrom db.
*
* @param uazTbl
* the uaz tbl
* @return the wif ua zfrom db
*/
public SimpleFeatureCollection getWifUAZfromDB(final String uazTbl) {
LOGGER.info("getWifUAZfromDB for table : {}", uazTbl);
SimpleFeatureCollection uazFeatureCollection = FeatureCollections
.newCollection();
DataStore wifDataStore;
try {
wifDataStore = openPostgisDataStore();
final SimpleFeatureSource featureSourceUD = wifDataStore
.getFeatureSource(uazTbl);
uazFeatureCollection = featureSourceUD.getFeatures();
LOGGER.info("UAZ featureCollection size : {} ",
uazFeatureCollection.size());
} catch (final IOException e) {
LOGGER.error("could not access table {} ", uazTbl);
}
return uazFeatureCollection;
}
开发者ID:AURIN,项目名称:online-whatif,代码行数:28,代码来源:GeodataFinder.java
示例3: createCollection
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
/**
* Create a SimpleFeatureCollection with a Geometry
*
* @param all
* @return
* @throws SchemaException
*/
public static SimpleFeatureCollection createCollection(Geometry g) throws SchemaException {
SimpleFeatureCollection collection = FeatureCollections.newCollection();
SimpleFeatureType TYPE = DataUtilities.createType("MBB", "location:Polygon:srid=4326"); // 4326
// =
// srid
// of
// wgs84
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE);
featureBuilder.add(g);
SimpleFeature feature = featureBuilder.buildFeature(null);
collection.add(feature);
return collection;
}
开发者ID:esarbanis,项目名称:strabon,代码行数:24,代码来源:GeonamesParser.java
示例4: stSPARQLResultsGeoJSONWriter
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
public stSPARQLResultsGeoJSONWriter(OutputStream out) {
this.out = out;
// set the feature collection
sfCollection = FeatureCollections.newCollection("geomOutput");
// get the instance of JTSWrapper
jts = JTSWrapper.getInstance();
// initialize results/features
nresults = 0;
nfeatures = 0;
}
开发者ID:esarbanis,项目名称:strabon,代码行数:14,代码来源:stSPARQLResultsGeoJSONWriter.java
示例5: preparePointFile
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
public void preparePointFile(ArrayList<osmNode> osmNodes) throws IOException, SchemaException {
uniquePointTagKeys = getUniquePointTagKeys(osmNodes);
String passPointString = new String("location:Point:srid=4326,"+"id:Double");
for(String attribute:uniquePointTagKeys){
int colon;
do{
colon = attribute.indexOf(":");
if(colon!=-1){
attribute = attribute.substring(0, colon)+"_"+attribute.substring(colon+1);
}
}while(colon!=-1);
passPointString=passPointString+","+attribute+":String";
}
pointType = DataUtilities.createType("Location", passPointString);
pointCollection = FeatureCollections.newCollection();
pointBuilder = new SimpleFeatureBuilder(pointType);
pointFeature = pointBuilder.buildFeature(null);
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
Map <String,Serializable> parameters = new HashMap<String, Serializable>();
parameters.put("url",shpPointFile.toURI().toURL());
parameters.put("create spatial index",Boolean.TRUE);
ShapefileDataStore newdatastore = (ShapefileDataStore)dataStoreFactory.createNewDataStore(parameters);
newdatastore.createSchema(pointType);
newdatastore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
String typename = newdatastore.getTypeNames()[0];
SimpleFeatureSource simpfeatsource = newdatastore.getFeatureSource(typename);
pointFeatureStore = (SimpleFeatureStore)simpfeatsource;
}
开发者ID:banmedo,项目名称:Converter,代码行数:41,代码来源:shpMain.java
示例6: prepareLineFile
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
public void prepareLineFile(ArrayList<osmLine> osmLines) throws SchemaException, MalformedURLException, IOException {
uniqueLineTagKeys = getUniqueTagKeys(osmLines,"lines");
String passLineString = new String("location:LineString:srid=4326,"+"id:Double");
for(String attribute:uniqueLineTagKeys){
int colon;
do{
colon = attribute.indexOf(":");
if(colon!=-1){
attribute = attribute.substring(0, colon)+"_"+attribute.substring(colon+1);
}
}while(colon!=-1);
passLineString=passLineString+","+attribute+":String";
}
lineType = DataUtilities.createType("Location", passLineString);
lineCollection = FeatureCollections.newCollection();
lineBuilder = new SimpleFeatureBuilder(lineType);
lineFeature = lineBuilder.buildFeature(null);
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
Map <String,Serializable> parameters = new HashMap<String, Serializable>();
parameters.put("url",shpLineFile.toURI().toURL());
parameters.put("create spatial index",Boolean.TRUE);
ShapefileDataStore newdatastore = (ShapefileDataStore)dataStoreFactory.createNewDataStore(parameters);
newdatastore.createSchema(lineType);
newdatastore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
String typename = newdatastore.getTypeNames()[0];
SimpleFeatureSource simpfeatsource = newdatastore.getFeatureSource(typename);
lineFeatureStore = (SimpleFeatureStore)simpfeatsource;
}
开发者ID:banmedo,项目名称:Converter,代码行数:41,代码来源:shpMain.java
示例7: createFeatureCollection
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
/**
* Create featureCollection based on geometry-errors of given job
* @param job
* @return
*/
public SimpleFeatureCollection createFeatureCollection(EtlJob job){
Assert.notNull(job, "Job cannot be null");
/* We create a FeatureCollection into which we will put each Feature created from the Job's JobLogs
*/
SimpleFeatureCollection featureCollection = FeatureCollections.newCollection();
// Test if there is at least one Geometry error that must be added to the shapeFile
if(job.getGeometryErrorCount() == 0){
return featureCollection;
}
/*
* GeometryFactory will be used to create the geometry attribute of each feature (a Point
* object for the location)
*/
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(FEATURE_TYPE_GEOMETRY_ERROR);
for (Iterator<JobLog> jobLogIterator = this.managerDao.findJobLog(job).iterator(); jobLogIterator.hasNext();) {
JobLog jobLog = jobLogIterator.next();
// Test if this error is an error that must be added to the Shapefile
if(!isGeometryErrorForShapeFile(jobLog.getKey())){
continue;
}
// Get x, y and inspireId from jobLog
Double longitude = jobLog.getX();
Double latitude = jobLog.getY();
Point point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); /* Longitude (= x coord) first ! */
featureBuilder.add(point);
String gmlId = jobLog.getGmlId();
featureBuilder.add(gmlId);
featureBuilder.add(jobLog.getMessage());
featureCollection.add(featureBuilder.buildFeature(null));
}
return featureCollection;
}
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:49,代码来源:FeatureCollectionFactory.java
示例8: createFeatureCollection
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
private SimpleFeatureCollection createFeatureCollection(){
// We create a FeatureCollection into which we will put each geometryError
SimpleFeatureCollection featureCollection = FeatureCollections.newCollection();
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(FeatureCollectionFactory.FEATURE_TYPE_GEOMETRY_ERROR);
double longitude = 52.415194;
double latitude = 6.397194;
Point point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); /* Longitude (= x coord) first ! */
featureBuilder.add(point);
featureBuilder.add("DitIsDeGmlId_0");
featureBuilder.add("DitIsDeErrorMessage");
featureCollection.add(featureBuilder.buildFeature(null));
longitude = 51.415194;
latitude = 6.197194;
point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); /* Longitude (= x coord) first ! */
featureBuilder.add(point);
featureBuilder.add("DitIsDeGmlId_1");
featureBuilder.add("DitIsDeErrorMessage");
featureCollection.add(featureBuilder.buildFeature(null));
// Missing gmlId
longitude = 50.415194;
latitude = 6.197194;
point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); /* Longitude (= x coord) first ! */
featureBuilder.add(point);
//featureBuilder.add("DitIsDeGmlId_1");
featureBuilder.add("DitIsDeErrorMessage");
featureCollection.add(featureBuilder.buildFeature(null));
// Missing longitude
longitude = Double.NaN;
latitude = 6.197194;
point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); /* Longitude (= x coord) first ! */
featureBuilder.add(point);
featureBuilder.add("DitIsDeGmlId_1");
featureBuilder.add("DitIsDeErrorMessage");
featureCollection.add(featureBuilder.buildFeature(null));
// Missing latitude
longitude = 49.415194;
latitude = Double.NaN;
point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); /* Longitude (= x coord) first ! */
featureBuilder.add(point);
featureBuilder.add("DitIsDeGmlId_1");
featureBuilder.add("DitIsDeErrorMessage");
featureCollection.add(featureBuilder.buildFeature(null));
// Missing both longitude and latitude
longitude = Double.NaN;
latitude = Double.NaN;
point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); /* Longitude (= x coord) first ! */
featureBuilder.add(point);
featureBuilder.add("DitIsDeGmlId_1");
featureBuilder.add("DitIsDeErrorMessage");
featureCollection.add(featureBuilder.buildFeature(null));
return featureCollection;
}
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:63,代码来源:ShapeFileGeneratorTest.java
示例9: preparePolygonFIle
import org.geotools.feature.FeatureCollections; //导入依赖的package包/类
public void preparePolygonFIle(ArrayList <osmLine> osmPolygons) throws SchemaException, IOException {
uniquePolygonTagKeys = getUniqueTagKeys(osmPolygons,"polygons");
Collections.sort(uniquePolygonTagKeys);
String passPolygonString = new String("location:Polygon:srid=4326,"+"id:Double");
for(String attribute:uniquePolygonTagKeys){
int colon;
do{
colon = attribute.indexOf(":");
if(colon!=-1){
attribute = attribute.substring(0, colon)+"_"+attribute.substring(colon+1);
}
}while(colon!=-1);
passPolygonString=passPolygonString+","+attribute+":String";
}
pointType = DataUtilities.createType("Location", passPolygonString);
polygonCollection = FeatureCollections.newCollection();
polygonBuilder = new SimpleFeatureBuilder(pointType);
polygonFeature = polygonBuilder.buildFeature(null);
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
Map <String,Serializable> parameters = new HashMap<String, Serializable>();
parameters.put("url",shpPolygonFile.toURI().toURL());
parameters.put("create spatial index",Boolean.TRUE);
ShapefileDataStore newdatastore = (ShapefileDataStore)dataStoreFactory.createNewDataStore(parameters);
newdatastore.createSchema(pointType);
newdatastore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
String typename = newdatastore.getTypeNames()[0];
SimpleFeatureSource simpfeatsource = newdatastore.getFeatureSource(typename);
polygonFeatureStore = (SimpleFeatureStore)simpfeatsource;
}
开发者ID:banmedo,项目名称:Converter,代码行数:42,代码来源:shpMain.java
注:本文中的org.geotools.feature.FeatureCollections类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论