Ejemplo n.º 1
0
        protected static AVList wcsGetParamsFromCapsDoc(WCS100Capabilities caps, AVList parameters)
        {
            if (caps == null)
            {
                String message = Logging.getMessage("nullValue.WCSCapabilities");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (parameters == null)
            {
                String message = Logging.getMessage("nullValue.ElevationModelConfigParams");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            WCS100DescribeCoverage coverage = (WCS100DescribeCoverage)parameters.getValue(AVKey.DOCUMENT);

            if (coverage == null)
            {
                String message = Logging.getMessage("nullValue.WCSDescribeCoverage");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            getWCSElevationModelConfigParams(caps, coverage, parameters);

            wcsSetFallbacks(parameters);
            determineNumLevels(coverage, parameters);

            parameters.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(caps.getVersion(), parameters));

            if (parameters.getValue(AVKey.ELEVATION_EXTREMES_FILE) == null)
            {
                // Use the default extremes file if there are at least as many levels in this new elevation model as the
                // level of the extremes file, which is level 5.
                int numLevels = (int)parameters.getValue(AVKey.NUM_LEVELS);
                if (numLevels >= 6)
                {
                    parameters.setValue(AVKey.ELEVATION_EXTREMES_FILE, "config/SRTM30Plus_ExtremeElevations_5.bil");
                }
            }

            return(parameters);
        }
Ejemplo n.º 2
0
        protected static void determineNumLevels(WCS100DescribeCoverage coverage, AVList parameters)
        {
            List <GMLRectifiedGrid> grids =
                coverage.getCoverageOfferings().get(0).getDomainSet().getSpatialDomain().getRectifiedGrids();

            if (grids.Count < 1 || grids[0].getOffsetVectors().Count < 2)
            {
                parameters.setValue(AVKey.NUM_LEVELS, 18);
                return;
            }

            double xRes           = Math.Abs(grids[0].getOffsetVectors().get(0).x);
            double yRes           = Math.Abs(grids[0].getOffsetVectors().get(1).y);
            double dataResolution = Math.Min(xRes, yRes);

            int    tileSize    = (int)parameters.getValue(AVKey.TILE_WIDTH);
            LatLon level0Delta = (LatLon)parameters.getValue(AVKey.LEVEL_ZERO_TILE_DELTA);

            double n = Math.Log(level0Delta.getLatitude().degrees / (dataResolution * tileSize)) / Math.Log(2);

            parameters.setValue(AVKey.NUM_LEVELS, (int)(Math.Ceiling(n) + 1));
        }
Ejemplo n.º 3
0
        public static AVList getWCSElevationModelConfigParams(WCS100Capabilities caps, WCS100DescribeCoverage coverage,
                                                              AVList parameters)
        {
            DataConfigurationUtils.getWCSConfigParameters(caps, coverage, parameters); // checks for null args

            // Ensure that we found all the necessary information.
            if (parameters.getStringValue(AVKey.DATASET_NAME) == null)
            {
                Logging.logger().warning(Logging.getMessage("WCS.NoCoverageName"));
                throw new WWRuntimeException(Logging.getMessage("WCS.NoCoverageName"));
            }

            if (parameters.getStringValue(AVKey.SERVICE) == null)
            {
                Logging.logger().warning(Logging.getMessage("WCS.NoGetCoverageURL"));
                throw new WWRuntimeException(Logging.getMessage("WCS.NoGetCoverageURL"));
            }

            if (parameters.getStringValue(AVKey.DATA_CACHE_NAME) == null)
            {
                Logging.logger().warning(Logging.getMessage("nullValue.DataCacheIsNull"));
                throw new WWRuntimeException(Logging.getMessage("nullValue.DataCacheIsNull"));
            }

            if (parameters.getStringValue(AVKey.IMAGE_FORMAT) == null)
            {
                Logging.logger().severe("WCS.NoImageFormats");
                throw new WWRuntimeException(Logging.getMessage("WCS.NoImageFormats"));
            }

            if (parameters.getValue(AVKey.SECTOR) == null)
            {
                Logging.logger().severe("WCS.NoLonLatEnvelope");
                throw new WWRuntimeException(Logging.getMessage("WCS.NoLonLatEnvelope"));
            }

            if (parameters.getStringValue(AVKey.COORDINATE_SYSTEM) == null)
            {
                String msg = Logging.getMessage("WCS.RequiredCRSNotSupported", "EPSG:4326");
                Logging.logger().severe(msg);
                throw new WWRuntimeException(msg);
            }

            return(parameters);
        }