Search in sources :

Example 1 with ResourceInfo

use of org.geotools.data.ResourceInfo in project polymap4-core by Polymap4.

the class AbstractFeatureSource method getInfo.

public ResourceInfo getInfo() {
    return new ResourceInfo() {

        final Set<String> words = new HashSet<String>();

        {
            words.add("features");
            words.add(AbstractFeatureSource.this.getTypeName());
        }

        public ReferencedEnvelope getBounds() {
            try {
                return AbstractFeatureSource.this.getBounds();
            } catch (IOException e) {
                return null;
            }
        }

        public CoordinateReferenceSystem getCRS() {
            return AbstractFeatureSource.this.getSchema().getCoordinateReferenceSystem();
        }

        public String getDescription() {
            return null;
        }

        public Set<String> getKeywords() {
            return words;
        }

        public String getName() {
            return AbstractFeatureSource.this.getTypeName();
        }

        public URI getSchema() {
            Name name = AbstractFeatureSource.this.getSchema().getName();
            URI namespace;
            try {
                namespace = new URI(name.getNamespaceURI());
                return namespace;
            } catch (URISyntaxException e) {
                return null;
            }
        }

        public String getTitle() {
            Name name = AbstractFeatureSource.this.getSchema().getName();
            return name.getLocalPart();
        }
    };
}
Also used : ResourceInfo(org.geotools.data.ResourceInfo) Set(java.util.Set) HashSet(java.util.HashSet) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) Name(org.opengis.feature.type.Name)

Example 2 with ResourceInfo

use of org.geotools.data.ResourceInfo in project polymap4-core by Polymap4.

the class GridServiceInfo method main.

// test ***********************************************
public static void main(String[] args) throws Exception {
    // File f = new File( "/home/falko/Data/tiff/bluemarble.tif" );
    File f = new File("/home/falko/Data/ncrast/elevation_4326.tif");
    AbstractGridCoverage2DReader reader = GridCoverageReaderFactory.open(f);
    System.out.println("reader: " + reader);
    System.out.println("reader: " + reader.getInfo().getSource());
    System.out.println("reader: " + reader.getInfo().getTitle());
    System.out.println("reader: " + Arrays.asList(reader.getGridCoverageNames()));
    System.out.println("reader: " + reader.getFormat().getName());
    System.out.println("reader: " + reader.getCoordinateReferenceSystem());
    System.out.println("reader: " + reader.getOriginalEnvelope());
    System.out.println("reader: " + reader.getOriginalGridRange());
    for (String name : reader.getGridCoverageNames()) {
        ResourceInfo info = reader.getInfo(name);
        System.out.println("coverage: " + info.getTitle());
        System.out.println("coverage: " + info.getName());
        System.out.println("coverage: " + info.getDescription());
        System.out.println("coverage: " + info.getBounds());
    }
    reader.dispose();
}
Also used : DefaultResourceInfo(org.polymap.core.catalog.resolve.DefaultResourceInfo) IResourceInfo(org.polymap.core.catalog.resolve.IResourceInfo) ResourceInfo(org.geotools.data.ResourceInfo) AbstractGridCoverage2DReader(org.geotools.coverage.grid.io.AbstractGridCoverage2DReader) File(java.io.File)

Example 3 with ResourceInfo

use of org.geotools.data.ResourceInfo in project polymap4-core by Polymap4.

the class WfsServiceInfo method getResources.

@Override
public Iterable<IResourceInfo> getResources(IProgressMonitor monitor) throws Exception {
    List<IResourceInfo> result = new ArrayList();
    for (Name name : ds.getNames()) {
        ResourceInfo info = ds.getFeatureSource(name).getInfo();
        result.add(new WfsResourceInfo(this, info));
    }
    return result;
}
Also used : DefaultResourceInfo(org.polymap.core.catalog.resolve.DefaultResourceInfo) IResourceInfo(org.polymap.core.catalog.resolve.IResourceInfo) ResourceInfo(org.geotools.data.ResourceInfo) ArrayList(java.util.ArrayList) IResourceInfo(org.polymap.core.catalog.resolve.IResourceInfo) Name(org.opengis.feature.type.Name)

Aggregations

ResourceInfo (org.geotools.data.ResourceInfo)3 Name (org.opengis.feature.type.Name)2 DefaultResourceInfo (org.polymap.core.catalog.resolve.DefaultResourceInfo)2 IResourceInfo (org.polymap.core.catalog.resolve.IResourceInfo)2 File (java.io.File)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 AbstractGridCoverage2DReader (org.geotools.coverage.grid.io.AbstractGridCoverage2DReader)1