Package org.geotools.imageio

Examples of org.geotools.imageio.SliceDescriptor


     *                the index of the specified 2D raster.
     * @see SpatioTemporalImageReader#getSliceDescriptor(int)
     */
    public SliceDescriptor getSliceDescriptor(int imageIndex)
            throws IOException {
        return new SliceDescriptor(getSpatioTemporalMetadata(imageIndex),ReferencingFactoryContainer.instance(GeoTools.getDefaultHints()));
    }
View Full Code Here


            //
            // //
            Map<Name, Map<String, HDF4ProductFieldType>> fieldsMap = new HashMap<Name, Map<String, HDF4ProductFieldType>>();
            for (int imageIndex = 0; imageIndex < numImages; imageIndex++) {
                final SpatioTemporalMetadata metadata = reader.getSpatioTemporalMetadata(imageIndex);
                final SliceDescriptor sd = reader.getSliceDescriptor(imageIndex);
                if (sd == null)
                    throw new IllegalStateException("unable to get the required sliceDescriptor");

                // //
                //
                // Getting slice extent
                //
                // //
//                VerticalExtent ve = sd.getVerticalExtent();
//                CoordinateReferenceSystem crs = sd.getCoordinateReferenceSystem();
                TemporalGeometricPrimitive time = sd.getTemporalExtent();
               
                BoundingBox boundingBox = sd.getHorizontalExtent();
//                String referenceID = "";
//                if (crs instanceof CompoundCRS){
//                    List<CoordinateReferenceSystem> list = ((CompoundCRS) crs).getCoordinateReferenceSystems();
//                    if (list!=null && !list.isEmpty()){
//                        for (CoordinateReferenceSystem crsElement : list){
//                            if (crsElement instanceof VerticalCRS){
//                                referenceID = crsElement.getName().getCode();
//                                break;
//                            }
//                        }
//                    }
//                }

                Band band = metadata.getBand(0);
                Set<TemporalGeometricPrimitive> temporalExtent;
//                Set<NumberRange<Double>> verticalExtent;
                Map<String, HDF4ProductFieldType> fields;

                // //
                //
                // Firstly, group coverages having the same bounding Box.
                // Some datasources may contain data coming from acquisitions
                // on different areas. We divide them in different groups.
                //
                // //

//                if (!verticalCRSMap.containsKey(referenceID)) {
                if (!coverages2DMap.containsKey(boundingBox)) {
                    // //
                    //
                    // This is the first occurrence. Setting coverageName,
                    // as well as the extents.
                    //
                    // //
                    coverageName = new NameImpl(mainCoverageName.getLocalPart() + "_" + Integer.toString(numCoverages++));
                    coverageNames.add(coverageName);
//                    verticalCRSMap.put(referenceID, coverageName);
                    coverages2DMap.put(boundingBox, coverageName);
                    temporalExtent = new LinkedHashSet<TemporalGeometricPrimitive>();
//                    verticalExtent = new LinkedHashSet<NumberRange<Double>>();
                    fields = new LinkedHashMap<String, HDF4ProductFieldType>();
                    temporalExtentMap.put(coverageName, temporalExtent);
//                    verticalExtentMap.put(coverageName, verticalExtent);
                    fieldsMap.put(coverageName, fields);
                } else {
//                    coverageName = verticalCRSMap.get(referenceID);
                  coverageName = coverages2DMap.get(boundingBox);
                }

                if (!envelopesMap.containsKey(coverageName)) {
                    // //
                    //
                    // In case this coverage's properties haven't been
                    // initialized yet, init them.
                    //
                    // //
                    initOriginalEnvelopeAndCRS(coverageName, sd);
                    final GridGeometry2D gridGeometry2D = buildGridGeometry2D(coverageName, metadata);
                    gridGeometry2DMap.put(coverageName, gridGeometry2D);
                } else {
                    GeneralEnvelope envelope = envelopesMap.get(coverageName);
                    envelope.add(sd.getGeneralEnvelope());
                    envelopesMap.put(coverageName, envelope);
                }

                // //
                //
View Full Code Here

TOP

Related Classes of org.geotools.imageio.SliceDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.