@Override public FeatureSource answer() throws Throwable { return ((DataStore) ds.getDataStore(null)) .getFeatureSource(name); } })
File file = new File("mayshapefile.shp"); try { Map connect = new HashMap(); connect.put("url", file.toURL()); DataStore dataStore = DataStoreFinder.getDataStore(connect); String[] typeNames = dataStore.getTypeNames(); String typeName = typeNames[0]; System.out.println("Reading content " + typeName); FeatureSource featureSource = dataStore.getFeatureSource(typeName); FeatureCollection collection = featureSource.getFeatures(); FeatureIterator iterator = collection.features(); try { while (iterator.hasNext()) { Feature feature = iterator.next(); Geometry sourceGeometry = feature.getDefaultGeometry(); } } finally { iterator.close(); } } catch (Throwable e) {}
+ service.getOnlineResource()); layers.add(getLayerFromFeatureSource(remoteWFS.getFeatureSource(name)));
public SimpleFeatureSource getFeatureSource(String typeName) throws IOException { FeatureTypeMap map = getTypeMapBackwards(typeName, true); updateMap(map, false); SimpleFeatureSource source = wrapped.getFeatureSource(map.getOriginalName()); if (map.isUnchanged()) return source; if (source instanceof FeatureLocking) { SimpleFeatureLocking locking = DataUtilities.simple((FeatureLocking) source); return new RetypingFeatureLocking(this, locking, map); } else if (source instanceof FeatureStore) { SimpleFeatureStore store = DataUtilities.simple((FeatureStore) source); return new RetypingFeatureStore(this, store, map); } return new RetypingFeatureSource(this, source, map); }
@Override public SimpleFeatureSource getFeatureSource(String typeName) throws IOException { return delegate.getFeatureSource(typeName); }
FeatureSource fs = remoteStore.getFeatureSource(TOPP_STATES); remoteWFSStatesAvailable = Boolean.TRUE;
expect(ds.getTypeNames()).andReturn(new String[] {"trees"}).anyTimes(); expect(ds.getSchema("trees")).andReturn(type).anyTimes(); expect(ds.getFeatureSource("trees")).andReturn(fs); replay(ds);
expect(ds.getTypeNames()).andReturn(new String[] {"trees"}).anyTimes(); expect(ds.getSchema("trees")).andReturn(type).anyTimes(); expect(ds.getFeatureSource("trees")).andReturn(fs); replay(ds);
DataStore inlineFeatureDatastore = ul.getInlineFeatureDatastore(); String typeName = inlineFeatureDatastore.getTypeNames()[0]; featureSource = inlineFeatureDatastore.getFeatureSource(typeName);
public GTDataStoreFootprintProvider( Map<String, Serializable> params, String typeName, Filter filter) throws IOException { store = DataStoreFinder.getDataStore(params); if (store == null) { throw new IOException("Coould not create footprint data store from params: " + params); } if (typeName != null) { this.featureSource = store.getFeatureSource(typeName); } else { this.featureSource = store.getFeatureSource("footprints"); } this.filter = filter; }
public SimpleFeatureSource source(String dataStoreId, String typeName) throws IOException { DataStore ds = datastore(dataStoreId); return ds.getFeatureSource(typeName); }
dataStore.getFeatureSource(typeName), renamedFeatureType); } else { fs = dataStore.getFeatureSource(info.getQualifiedName());
@Override public BoundingBox getBounds(final String typeName) { try { checkStore(); return this.getTileIndexStore().getFeatureSource(typeName).getBounds(); } catch (IOException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }
@Override public QueryCapabilities getQueryCapabilities(String typeName) { try { checkStore(); return getTileIndexStore().getFeatureSource(typeName).getQueryCapabilities(); } catch (IOException e) { if (LOGGER.isLoggable(Level.INFO)) LOGGER.log(Level.INFO, "Unable to collect QueryCapabilities", e); return null; } }
SimpleFeatureType schema = tb.buildFeatureType(); store.createSchema(schema); SimpleFeatureStore featureStore = (SimpleFeatureStore) store.getFeatureSource("pgeo"); featureStore.addFeatures(fsp.getFeatures());
@Override public SimpleFeatureSource getFeatureSource(String typeName) throws IOException { // simple case, no lookups needed if (delegate instanceof DataStore) { return ((DataStore) delegate).getFeatureSource(typeName); } Name name = getNameFromLocal(typeName); return DataUtilities.simple(delegate.getFeatureSource(name)); }
public SimpleFeatureSource getFeatureSource(String typeName) throws IOException { SimpleFeatureSource fs = getDataStore(typeName).getFeatureSource(typeName); if (fs instanceof SimpleFeatureLocking) { return new DirectoryFeatureLocking((SimpleFeatureLocking) fs); } else if (fs instanceof FeatureStore) { return new DirectoryFeatureStore((SimpleFeatureStore) fs); } else { return new DirectoryFeatureSource((SimpleFeatureSource) fs); } }
@Test public void testShapeFile() throws Exception { SimpleFeatureSource fs = shapeFileDataStore.getFeatureSource(featureType.getTypeName()); checkTiles(fs); }
public void computeAggregateFunction(Query query, FeatureCalc function) throws IOException { query = mergeHints(query); checkStore(); SimpleFeatureSource fs = getTileIndexStore().getFeatureSource(query.getTypeName()); if (fs instanceof ContentFeatureSource) ((ContentFeatureSource) fs).accepts(query, function, null); else { final SimpleFeatureCollection collection = fs.getFeatures(query); collection.accepts(function, null); } }
public void testDataStore() throws IOException { SimpleFeatureSource features = DataUtilities.source(roadFeatures); Name name = features.getName(); String typeName = name.getLocalPart(); DataStore store = DataUtilities.dataStore(features); assertSame(features.getSchema(), store.getSchema(name)); assertSame(features.getSchema(), store.getSchema(typeName)); assertSame(features, store.getFeatureSource(name)); assertSame(features, store.getFeatureSource(typeName)); assertEquals(name, store.getNames().get(0)); assertEquals(typeName, store.getTypeNames()[0]); }