Package org.geowebcache.grid

Examples of org.geowebcache.grid.SRS


                if(CRS.getAxisOrder(crs) == AxisOrder.NORTH_EAST) {
                    axisFlip = true;
                }
                String srs = request.getSRS();
                epsgId = Integer.parseInt(srs.substring(srs.lastIndexOf(':') + 1));
                SRS srs2 = SRS.getSRS(epsgId);
                crsMatchingGridSubsets = tileLayer.getGridSubsetsForSRS(srs2);
            }
            final BoundingBox tileBounds;
            {
                Envelope bbox = request.getBbox();
View Full Code Here


                continue;
            }
            BoundingBox extent = gridSubset.getExtent();
            if (null == extent) {
                try {
                    SRS srs = gridSet.getSrs();
                    try {
                        extent = getBounds(srs);
                    } catch (RuntimeException cantComputeBounds) {
                        final String msg = "Can't compute bounds for tile layer " + getName()
                                + " in CRS " + srs + ". Assuming full GridSet bounds. ("
View Full Code Here

        }
        if (epsgCode == null) {
            throw new ServiceException("Unable to determine epsg code for " + crs);
        }

        SRS srs = SRS.getSRS(epsgCode);

        // figure out the appropriate grid sub set
        Set<GridSubset> gridSubsets = new LinkedHashSet<GridSubset>();
        for (MapLayerInfo l : req.getLayers()) {
            TileLayer tl = gwc.getTileLayerByName(l.getName());
View Full Code Here

        if (!epsgCode.startsWith("EPSG:")) {
            throw new IllegalStateException("EPSG code didn't resolve to a EPSG:XXX identifier: "
                    + epsgCode);
        }

        SRS srs;
        try {
            srs = SRS.getSRS(epsgCode);
        } catch (GeoWebCacheException e) {
            throw new IllegalStateException(e.getMessage());
        }
View Full Code Here

     *             {@link GridUtil#findBestMatchingGrid} instead
     */
    public GridSubset getGridSubsetForSRS(SRS srs) {
        for (String gridSet : getGridSubsets()) {
            GridSubset gridSubset = getGridSubset(gridSet);
            SRS gridSetSRS = gridSubset.getSRS();
            if (gridSetSRS.equals(srs)) {
                return gridSubset;
            }
        }
        return null;
    }
View Full Code Here

    public List<GridSubset> getGridSubsetsForSRS(SRS srs) {
        List<GridSubset> matches = Collections.emptyList();

        for (String gridSet : getGridSubsets()) {
            GridSubset gridSubset = getGridSubset(gridSet);
            SRS gridSetSRS = gridSubset.getSRS();
            if (gridSetSRS.equals(srs)) {
                if (matches.isEmpty()) {
                    matches = new ArrayList<GridSubset>(2);
                }
                matches.add(gridSubset);
            }
View Full Code Here

        if (additionalBounds != null && additionalBounds.size() > 0) {
            Iterator<CRSEnvelope> iter = additionalBounds.values().iterator();
            while (iter.hasNext()) {
                CRSEnvelope env = iter.next();
                SRS srs = null;
                if (env.getEPSGCode() != null) {
                    srs = SRS.getSRS(env.getEPSGCode());
                }

                if (srs == null) {
                    log.error(env.toString() + " has no EPSG code");
                } else if (srs.getNumber() == 4326 || srs.getNumber() == 900913
                        || srs.getNumber() == 3857) {
                    log.debug("Skipping " + srs.toString() + " for " + name);
                } else {
                    String gridSetName = name + ":" + srs.toString();
                    BoundingBox extent = new BoundingBox(env.getMinX(), env.getMinY(),
                            env.getMaxX(), env.getMaxY());

                    GridSet gridSet = GridSetFactory.createGridSet(gridSetName, srs, extent, false,
                            25, null, GridSetFactory.DEFAULT_PIXEL_SIZE_METER, 256, 256, false);
View Full Code Here

        }

        GridSet gridSet;

        String name = getName();
        SRS srs = getSrs();
        BoundingBox extent = getExtent();
        Boolean alignTopLeft = getAlignTopLeft();
        double[] resolutions = getResolutions();
        double[] scaleDenominators = getScaleDenominators();
        Double metersPerUnit = getMetersPerUnit();
View Full Code Here

        Assert.notNull(layerBounds);

        final TileCacheInfo tileCacheInfo = info.getTileCacheInfo();
        final SpatialReference spatialReference = tileCacheInfo.getSpatialReference();

        final SRS srs;
        final BoundingBox gridSetExtent;

        final boolean alignTopLeft = true;
        final double[] resolutions;
        /*
         * let scale denoms be null so GridSetFactory computes them based on resolutions. The
         * resulting values will be pretty close to the ones defined in the ArcGIS tiling scheme
         */
        final double[] scaleDenominators = null;
        final Double metersPerUnit;
        final String[] scaleNames = null;
        final int tileWidth = tileCacheInfo.getTileCols();
        final int tileHeight = tileCacheInfo.getTileRows();
        final boolean yCoordinateFirst = false;
        final double pixelSize = 0.0254 / tileCacheInfo.getDPI();// see GridSubset.getDotsPerInch()
        {
            int epsgNumber = spatialReference.getWKID();
            if (0 == epsgNumber) {
            }
            srs = SRS.getSRS(epsgNumber);
        }
        {
            final List<LODInfo> lodInfos = tileCacheInfo.getLodInfos();
            double[][] resAndScales = getResolutions(lodInfos);

            resolutions = resAndScales[0];

            double[] scales = resAndScales[1];
            //TODO: check whether pixelSize computed above should be used instead
            metersPerUnit = (GridSetFactory.DEFAULT_PIXEL_SIZE_METER * scales[0]) / resolutions[0];
        }
        {
            // See "How to calculate the -x parameter used in the examples above" at
            // http://resources.arcgis.com/content/kbase?q=content/kbase&fa=articleShow&d=15558&print=true
            // double XOrigin = spatialReference.getXOrigin();
            // double YOrigin = spatialReference.getYOrigin();
            // XYScale = 40075017 / 360 = ~111319, where 40075017 is the circumference of the earth
            // at the ecuator and 360 the map units at the ecuator
            // final double xyScale = spatialReference.getXYScale();

            final TileOrigin tileOrigin = tileCacheInfo.getTileOrigin();// top left coordinate

            double xmin = tileOrigin.getX();
            double ymax = tileOrigin.getY();
            double ymin = layerBounds.getMinY();
            double xmax = layerBounds.getMaxX();

            // make it so the gridset height matches an integer number of tiles in order for
            // clients (OpenLayers) assuming the tile origin is the lower left corner instead of
            // the upper right to compute tile bounding boxes right
            final double resolution = resolutions[resolutions.length - 1];
            double width = resolution * tileWidth;
            double height = resolution * tileHeight;

            long numTilesWide = (long) Math.ceil((xmax - xmin) / width);
            long numTilesHigh = (long) Math.ceil((ymax - ymin) / height);

            xmax = xmin + (numTilesWide * width);
            ymin = ymax - (numTilesHigh * height);
            gridSetExtent = new BoundingBox(xmin, ymin, xmax, ymax);
        }

        String gridsetName = srs.toString() + "_" + layerName;
        GridSet layerGridset = GridSetFactory.createGridSet(gridsetName, srs, gridSetExtent,
                alignTopLeft, resolutions, scaleDenominators, metersPerUnit, pixelSize, scaleNames,
                tileWidth, tileHeight, yCoordinateFirst);

        return layerGridset;
View Full Code Here

        {
            TreeSet<SRS> srsSet = new TreeSet<>();
            HashSet<GridSubset> gridSubsetSet = new HashSet<>();
            for (String gridSetId : layer.getGridSubsets()) {
                GridSubset curGridSubSet = layer.getGridSubset(gridSetId);
                SRS curSRS = curGridSubSet.getSRS();
                if (!srsSet.contains(curSRS)) {
                    srsSet.add(curSRS);
                    gridSubsetSet.add(curGridSubSet);
                }
            }
            for(SRS curSRS: srsSet) {
                xml.simpleElement("SRS", curSRS.toString(), true);
            }
   
            GridSubset epsg4326GridSubSet = layer.getGridSubsetForSRS(SRS.getEPSG4326());
            if (null != epsg4326GridSubSet) {
                String[] bs = boundsPrep(epsg4326GridSubSet.getCoverageBestFitBounds());
View Full Code Here

TOP

Related Classes of org.geowebcache.grid.SRS

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.