Package org.geowebcache.grid

Examples of org.geowebcache.grid.GridSubset


            TileLayer tl = tlIter.next();
            System.out.println(tl.getName());
            if(tl.getName().equals("sf:AggregateGeoFeature")) {
                //tl.isInitialized();
                foudAGF = true;
                GridSubset epsg4326 = tl.getGridSubset(gwcListener.gridSetBroker.WORLD_EPSG4326.getName());
                assertTrue(epsg4326.getGridSetBounds().equals( new BoundingBox(-180.0,-90.0,180.0,90.0)));
                String mime = tl.getMimeTypes().get(1).getMimeType();
                assertTrue(mime.startsWith("image/") || mime.startsWith("application/vnd.google-earth.kml+xml"));
            }
        }
       
View Full Code Here


                longToSphericalMercatorX(maxX),
                latToSphericalMercatorY(maxY));
       
        Hashtable<String,GridSubset> grids = new Hashtable<String,GridSubset>(3);
       
        GridSubset gridSubset4326 = GridSubsetFactory.createGridSubSet(
                gridSetBroker.WORLD_EPSG4326,
                bounds4326, 0, 25 );
       
        grids.put(gridSetBroker.WORLD_EPSG4326.getName(), gridSubset4326);
       
        GridSubset gridSubset900913 = GridSubsetFactory.createGridSubSet(
                gridSetBroker.WORLD_EPSG3857,
                bounds900913, 0, 25 );
       
        grids.put(gridSetBroker.WORLD_EPSG3857.getName(), gridSubset900913);
       
        // Native stuff
        if(nativeSRSName != null && ! nativeSRSName.equalsIgnoreCase("EPSG:4326")) {
           
            minX = nativeEnv.getMinX();
            minY = nativeEnv.getMinY();
            maxX = nativeEnv.getMaxX();
            maxY = nativeEnv.getMaxY();

            BoundingBox nativeBounds = new BoundingBox(minX,minY,maxX,maxY);
           
            SRS srs = null;
            try {
                srs = SRS.getSRS(nativeSRSName);
            } catch (GeoWebCacheException e) {
                e.printStackTrace();
            }
           
            String gridSetKey = nativeSRSName + "_" + layerName;
           
            GridSet gs = GridSetFactory.createGridSet(
                    gridSetKey, srs,
                    nativeBounds, false,
                    25, null,
                    0.00028,
                    256, 256);
           
            gridSetBroker.put(gs);
           
            GridSubset gsub = GridSubsetFactory.createGridSubSet(
                   gs, nativeBounds, 0, 24 );
           
            grids.put(gridSetKey, gsub);
           
        }
View Full Code Here

        List<String> formatList = new LinkedList<String>();
        formatList.add("image/png");
       
        Hashtable<String,GridSubset> grids = new Hashtable<String,GridSubset>();

        GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.WORLD_EPSG4326, new BoundingBox(-30.0,15.0,45.0,30), 0,10);
       
        grids.put(grid.getName(), grid);
        int[] metaWidthHeight = {3,3};
       
        WMSLayer layer = new WMSLayer("test:layer", urls, "aStyle", "test:layer", formatList, grids, null, metaWidthHeight, "vendorparam=true", false);
       
        layer.initialize(gridSetBroker);
View Full Code Here

    }

    private void writeSiteMap() throws GeoWebCacheException, IOException {
        TileLayer layer = tile.getLayer();
       
        GridSubset gridSubset = layer.getGridSubset(gridSetBroker.WORLD_EPSG4326.getName());
       
        writeSiteMapHeader();
       
        long[] gridRect = gridSubset.getCoverageBestFit();
       
        // Check whether we need two tiles for world bounds or not
        if(gridRect[4] > 0 && (gridRect[2] != gridRect[0] || gridRect[3] != gridRect[1])) {
            throw new GeoWebCacheException(
                    layer.getName() + " is too big for the sub grid set for "
                    + gridSubset.getName() + ", allow for smaller zoom levels.");
        } else if(gridRect[0] != gridRect[2]) {
            long[] gridLocWest = {0,0,0};
            long[] gridLocEast = {1,0,0};

           
View Full Code Here

    public static GeometryRasterMaskBuilder buildSampleFilterMatrix(final TileLayer layer,
            final String gridsetId, final int maxMaskLevel) throws Exception {

        final Geometry entries[] = createSampleEntries();

        final GridSubset gridSubset = layer.getGridSubset(layer.getGridSubsets().keySet()
                .iterator().next());
        final int[] metaTilingFactors = layer.getMetaTilingFactors();
        GeometryRasterMaskBuilder matrix = new GeometryRasterMaskBuilder(gridSubset,
                metaTilingFactors, maxMaskLevel);
View Full Code Here

                throw new ServiceException("No SRS specified");
            }
            srs = SRS.getSRS(requestSrs);
        }

        GridSubset gridSubset = tileLayer.getGridSubsetForSRS(srs);
        if (gridSubset == null) {
            throw new ServiceException("Unable to match requested SRS " + srs
                    + " to those supported by layer");
        }

        final BoundingBox bbox;
        {
            String requestBbox = paramValues.get("bbox");
            try {
                bbox = new BoundingBox(requestBbox);
                if (bbox == null || !bbox.isSane()) {
                    throw new ServiceException("The bounding box parameter (" + requestBbox
                            + ") is missing or not sane");
                }
            } catch (NumberFormatException nfe) {
                throw new ServiceException("The bounding box parameter (" + requestBbox
                        + ") is invalid");
            }
        }

        final int tileWidth = Integer.parseInt(values.get("width"));
        final int tileHeight = Integer.parseInt(values.get("height"));

        if (fullWMS) {
            // If we support full WMS we need to do a few tests to determine whether
            // this is a request that requires us to recombine tiles to respond.
            long[] tileIndex = null;
            try {
                tileIndex = gridSubset.closestIndex(bbox);
            } catch (GridMismatchException gme) {
                // Do nothing, the null is info enough
            }

            if (tileIndex == null || gridSubset.getTileWidth() != tileWidth
                    || gridSubset.getTileHeight() != tileHeight
                    || !bbox.equals(gridSubset.boundsFromIndex(tileIndex), 0.02)) {
                log.debug("Recombinining tiles to respond to WMS request");
                ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
                tile.setHint("getmap");
                tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
                return tile;
            }
        }

        long[] tileIndex = gridSubset.closestIndex(bbox);

        gridSubset.checkTileDimensions(tileWidth, tileHeight);

        return new ConveyorTile(sb, layers, gridSubset.getName(), tileIndex, mimeType,
                fullParameters, request, response);
    }
View Full Code Here

        String[] keys = { "x", "y", "srs", "info_format", "bbox", "height", "width" };
        Map<String, String> values = ServletUtils.selectedStringsFromMap(
                tile.servletReq.getParameterMap(), tile.servletReq.getCharacterEncoding(), keys);

        // TODO Arent we missing some format stuff here?
        GridSubset gridSubset = tl.getGridSubsetForSRS(SRS.getSRS(values.get("srs")));

        BoundingBox bbox = null;
        try {
            bbox = new BoundingBox(values.get("bbox"));
        } catch (NumberFormatException nfe) {
            log.debug(nfe.getMessage());
        }

        if (bbox == null || !bbox.isSane()) {
            throw new ServiceException("The bounding box parameter (" + values.get("srs")
                    + ") is missing or not sane");
        }

        // long[] tileIndex = gridSubset.closestIndex(bbox);

        MimeType mimeType;
        try {
            mimeType = MimeType.createFromFormat(values.get("info_format"));
        } catch (MimeException me) {
            throw new GeoWebCacheException("The info_format parameter ("
                    + values.get("info_format") + ")is missing or not recognized.");
        }

        ConveyorTile gfiConv = new ConveyorTile(sb, tl.getName(), gridSubset.getName(), null,
                mimeType, null, tile.servletReq, tile.servletResp);
        gfiConv.setTileLayer(tl);

        int x, y;
        try {
View Full Code Here

            throws GeoWebCacheException {

        // int idx = this.getSRSIndex(tile.getSRS());
        long[] gridLoc = tile.getTileIndex();

        GridSubset gridSubset = subSets.get(tile.getGridSetId());

        // GridCalculator gridCalc = getGrid(tile.getSRS()).getGridCalculator();

        MimeType mimeType = tile.getMimeType();
        Map<String, String> fullParameters = tile.getFullParameters();
View Full Code Here

    public void testLoadPre10() throws Exception {
        List<TileLayer> layers = loadResource("geowebcache_pre10.xml");
        TileLayer layer = findLayer(layers, "topp:states");
        assertTrue(layer != null);
        TileLayer layer2 = findLayer(layers, "topp:states2");
        GridSubset grid = layer2.getGridSubsetForSRS(SRS.getSRS(2163));
        assertTrue(layer2 != null);
        assertTrue(grid != null);
    }
View Full Code Here

        List<TileLayer> layers = loadResource("geowebcache_10.xml");
        TileLayer layer = findLayer(layers, "topp:states");
        assertTrue(layer != null);
        //assertEquals(layer.getCachePrefix(), "/var/lib/geowebcache/topp_states");
        TileLayer layer2 = findLayer(layers, "topp:states2");
        GridSubset grid = layer2.getGridSubsetForSRS(SRS.getSRS(2163));
        assertTrue(layer2 != null);
        assertTrue(grid != null);
    }
View Full Code Here

TOP

Related Classes of org.geowebcache.grid.GridSubset

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.