Revision 5829
Added by ben leinfelder over 13 years ago
SpatialDataset.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package edu.ucsb.nceas.metacat.spatial; |
24 | 24 |
|
25 |
import org.geotools.feature.FeatureType; |
|
26 | 25 |
import org.geotools.data.shapefile.ShapefileDataStore; |
27 | 26 |
import org.geotools.data.FeatureStore; |
28 | 27 |
import org.geotools.data.DefaultTransaction; |
29 | 28 |
import org.geotools.data.Transaction; |
30 |
import org.geotools.feature.Feature; |
|
31 |
import org.geotools.filter.Filter; |
|
32 | 29 |
import org.geotools.filter.CompareFilter; |
33 | 30 |
import org.geotools.filter.FilterFactory; |
34 | 31 |
import org.geotools.filter.FilterFactoryFinder; |
35 | 32 |
import org.geotools.filter.IllegalFilterException; |
36 | 33 |
import org.geotools.feature.FeatureCollection; |
37 | 34 |
import org.geotools.feature.FeatureCollections; |
35 |
import org.opengis.feature.simple.SimpleFeature; |
|
36 |
import org.opengis.feature.simple.SimpleFeatureType; |
|
38 | 37 |
|
39 | 38 |
import org.apache.log4j.Logger; |
40 | 39 |
|
... | ... | |
88 | 87 |
* @param geomType The kind of feature to be added. Currently "polygon" and "point" supported. |
89 | 88 |
* @param feature The geotools feature to be added to the spatial cache. |
90 | 89 |
*/ |
91 |
public void add( String geomType, Feature feature ) { |
|
90 |
public void add( String geomType, SimpleFeature feature ) {
|
|
92 | 91 |
if( geomType.equals("polygon") ) { |
93 | 92 |
// Check if feature actually is a multipolygon |
94 | 93 |
if( feature != null) |
... | ... | |
203 | 202 |
* @param feature The geotools feature to be added to the spatial cache. |
204 | 203 |
* @param docid The document id to be inserted or updated. Used to filter for existing features. |
205 | 204 |
*/ |
206 |
public void insertOrUpdate( String geomType, Feature feature, String docid ) throws IOException { |
|
205 |
public void insertOrUpdate( String geomType, SimpleFeature feature, String docid ) throws IOException {
|
|
207 | 206 |
|
208 | 207 |
FeatureCollection fColl = FeatureCollections.newCollection(); |
209 | 208 |
FilterFactory filterFactory = FilterFactoryFinder.createFilterFactory(); |
... | ... | |
244 | 243 |
/* |
245 | 244 |
* Insert or update new feature in shape file |
246 | 245 |
*/ |
247 |
private void insertOrUpdateDataStore(ShapefileDataStore dStore, CompareFilter filter, Feature feature, |
|
246 |
private void insertOrUpdateDataStore(ShapefileDataStore dStore, CompareFilter filter, SimpleFeature feature,
|
|
248 | 247 |
FeatureCollection fColl, String docid) throws IOException |
249 | 248 |
{ |
250 | 249 |
if (dStore != null && filter != null && feature != null && fColl != null) |
... | ... | |
314 | 313 |
|
315 | 314 |
synchronized(polygonStore) |
316 | 315 |
{ |
317 |
FeatureType polygonType = featureSchema.getPolygonFeatureType(); |
|
316 |
SimpleFeatureType polygonType = featureSchema.getPolygonFeatureType();
|
|
318 | 317 |
polygonStore.createSchema( polygonType ); |
319 | 318 |
FeatureStore polygonFeatureStore = (FeatureStore) polygonStore.getFeatureSource( polygonType.getTypeName() ); |
320 | 319 |
polygonFeatureStore.addFeatures( polygonCollection ); |
... | ... | |
340 | 339 |
{ |
341 | 340 |
synchronized(pointStore) |
342 | 341 |
{ |
343 |
FeatureType pointsType = featureSchema.getPointFeatureType(); |
|
342 |
SimpleFeatureType pointsType = featureSchema.getPointFeatureType();
|
|
344 | 343 |
pointStore.createSchema( pointsType ); |
345 | 344 |
FeatureStore pointFeatureStore = (FeatureStore) pointStore.getFeatureSource( pointsType.getTypeName() ); |
346 | 345 |
pointFeatureStore.addFeatures( pointCollection ); |
Also available in: Unified diff
geoserver upgrade:
-remove embedded geoserver
-include geotools api and update spatial harvesting
-include simple template for using maps in skin (openlayers now, not mapbuilder)