Package org.geotools.imageio.metadataold

Examples of org.geotools.imageio.metadataold.Band


    @Override
    protected void setBandsElement(SpatioTemporalImageReader reader) {
        init(reader);
        final HDF4ImageReader hdf4Reader = ((HDF4ImageReader) reader);
        final Band band = addBand();
        final int imageIndex = getImageIndex();
    String imageMetadataFormat=null;
    String unitAttributeName=null;
   
    // //
    //
    // Setting format specific fields and metadata format names
    //
    // //
    switch (hdf4_type){
      case TeraScan:
        imageMetadataFormat=HDF4TeraScanImageMetadata.nativeMetadataFormatName;
          unitAttributeName=HDF4TeraScanProperties.DatasetAttribs.UNITS;
          break;
      case APS:
        imageMetadataFormat=HDF4APSImageMetadata.nativeMetadataFormatName;
          unitAttributeName="productUnits";
          break;
    }
   
      try
        // //
        //
        // Setting band element metadata
        //
        // //
        final IIOMetadata metadata = hdf4Reader.getImageMetadata(imageIndex,imageMetadataFormat);
            if (metadata instanceof UnidataImageMetadata) {
                final UnidataImageMetadata commonMetadata = (UnidataImageMetadata) metadata;
                setBandFromCommonMetadata(band, commonMetadata);
                Node node = commonMetadata.getAsTree(imageMetadataFormat);
                node = node.getFirstChild();
                if (node != null) {
                 
                  //Handling units
                    final NamedNodeMap attributesMap = node.getAttributes();
                    if (attributesMap != null) {
                      final Node units = attributesMap.getNamedItem(unitAttributeName);
                        if (units != null) {
                            String unit = units.getNodeValue();
                            if (unit != null) {
                                band.setUoM(unit);
                            }
                        }
                    }
                }
            }
View Full Code Here


//                            }
//                        }
//                    }
//                }

                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);
                }

                // //
                //
                // Update the temporal, vertical extent for this coverage
                //
                // //
                temporalExtent = (LinkedHashSet<TemporalGeometricPrimitive>) temporalExtentMap.get(coverageName);
//                verticalExtent = (LinkedHashSet<NumberRange<Double>>) verticalExtentMap.get(coverageName);
//                if (ve != null) {
//                  NumberRange<Double> verticalEnvelope = NumberRange.create(ve.getMinimumValue().doubleValue(), ve.getMaximumValue().doubleValue());
//                    if (!verticalExtent.contains(verticalEnvelope))
//                        verticalExtent.add(verticalEnvelope);
//                }

                if (time != null) {
                    if (!temporalExtent.contains(time))
                        temporalExtent.add(time);
                }

                // //
                //
                // Update the fields for this coverage
                //
                // //
                fields = (LinkedHashMap<String, HDF4ProductFieldType>) fieldsMap.get(coverageName);

                String elementName = band.getName();
                if (!fields.containsKey(elementName)) {

                    Product product = HDF4ProductFieldType.getProduct(elementName);
                    Unit unit = Unit.ONE;
                    if (product != null) {
                        unit = product.getUoM();
                    } else {
                        String uOm = band.getUoM();
                        if(uOm == null)
                           unit = Unit.ONE.alternate(uOm);
                        else
                          try {
                            unit = Unit.valueOf(uOm);
View Full Code Here

TOP

Related Classes of org.geotools.imageio.metadataold.Band

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.