static LayerMetadata buildMetadataForAutoMode( FeatureStore store, FeatureType ft, String name ) { List<ICRS> crs = new ArrayList<ICRS>(); Envelope envelope = null; try { envelope = store.getEnvelope( ft.getName() ); } catch ( Throwable e ) { LOG.debug( "Could not get envelope from feature store: {}", e.getLocalizedMessage() ); LOG.trace( "Stack trace:", e ); } if ( envelope != null ) { crs.add( envelope.getCoordinateSystem() ); } SpatialMetadata smd = new SpatialMetadata( envelope, crs ); Description desc = new Description( name, Collections.singletonList( new LanguageString( name, null ) ), null, null ); LayerMetadata md = new LayerMetadata( name, desc, smd ); md.getFeatureTypes().add( ft ); return md; }
/** * Ignores all errors, tries to aggregate all envelopes of all feature types. * * @param fs * @return null, if none of the feature types had an envelope */ public static Envelope getCombinedEnvelope( FeatureStore fs ) { Envelope env = null; for ( FeatureType ft : fs.getSchema().getFeatureTypes() ) { if ( env == null ) { try { env = fs.getEnvelope( ft.getName() ); } catch ( Throwable e ) { // ignore it } } else { try { Envelope b = fs.getEnvelope( ft.getName() ); if ( b != null ) { env = env.merge( b ); } } catch ( Throwable e ) { // ignore it } } } return env; }
try { FeatureStore fs = service.getStore( ftName ); env = fs.getEnvelope( ftName ); } catch ( FeatureStoreException e ) { LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
this.envelope = this.featureStore.getEnvelope( this.rootFT ); this.rasterCache = RasterCache.getInstance( cacheDir, true ); File directory = this.rasterCache.getCacheDirectory();
env = fs.getEnvelope( ftName ); } catch ( FeatureStoreException e ) { LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
env = fs.getEnvelope( ftName ); } catch ( FeatureStoreException e ) { LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
smd.setEnvelope( store.getEnvelope( featureType ) ); } else { smd.setEnvelope( getCombinedEnvelope( store ) );