Package org.geoserver.wms

Examples of org.geoserver.wms.GetMapRequest


        assertEquals(3, document.getElementsByTagName("Placemark").getLength());
    }

    @Test
    public void testExternalImageSize() throws Exception {
        GetMapRequest req = createGetMapRequest(MockData.STREAMS);
        req.setWidth(256);
        req.setHeight(256);

        WMSMapContent mapContent = new WMSMapContent(req);
        mapContent.addLayer(createMapLayer(MockData.STREAMS, "big-local-image"));
       
        mapContent.getViewport().setBounds(new ReferencedEnvelope(-180, 0, -90, 90,
View Full Code Here


        Boolean superoverlay = (Boolean) fo.get("superoverlay");
        if (superoverlay == null) {
            superoverlay = Boolean.FALSE;
        }
        transformer.setEncodeAsRegion(superoverlay);
        GetMapRequest request = mapContent.getRequest();
        boolean cachedMode = "cached".equals(KMLUtils.getSuperoverlayMode(request, wms));
        transformer.setCachedMode(cachedMode);

        String mimeType = request.getFormat();
        XMLTransformerMap wmsResponse = new XMLTransformerMap(mapContent, transformer, mapContent,
                mimeType);
        return wmsResponse;
    }
View Full Code Here

        super(OUTPUT_FORMATS, wms);
    }

    @Override
    public String getMimeType(Object value, Operation operation) throws ServiceException {
        GetMapRequest request = (GetMapRequest) operation.getParameters()[0];
        if (request.getFormat().contains("8")) {
            return MIME_TYPE_8BIT;
        } else {
            return MIME_TYPE;
        }
    }
View Full Code Here

            super(contentHandler, null, null);
        }

        public void encode(Object o) throws IllegalArgumentException {
            final WMSMapContent context = (WMSMapContent) o;
            final GetMapRequest request = context.getRequest();
            // restore target mime type for the network links
            if (NetworkLinkMapOutputFormat.KML_MIME_TYPE.equals(request.getFormat())) {
                request.setFormat(KMLMapOutputFormat.MIME_TYPE);
            } else {
                request.setFormat(KMZMapOutputFormat.MIME_TYPE);
            }

            if(standalone){
                start("kml");
            }
            if (!inline) {
                start("Folder");
                if (standalone) {
                    String kmltitle = (String) mapContent.getRequest().getFormatOptions().get("kmltitle");
                    element("name", (kmltitle != null ? kmltitle : ""));
                }
            }
            final List<MapLayerInfo> layers = request.getLayers();

            final KMLLookAt lookAt = parseLookAtOptions(request);

            ReferencedEnvelope aggregatedBounds;
            List<ReferencedEnvelope> layerBounds;
View Full Code Here

//            }
//        })[0]);
    }

    protected GetMapRequest createGetMapRequest(QName[] layerNames) {
        GetMapRequest request = super.createGetMapRequest(layerNames);
        request.setBbox(new Envelope(-180,180,-90,90));
        return request;
    };
View Full Code Here

        request.setBbox(new Envelope(-180,180,-90,90));
        return request;
    };
   
    WMSMapContent createMapContent(QName... layers) throws IOException {
        GetMapRequest mapRequest = createGetMapRequest(layers);
        WMSMapContent map = new WMSMapContent(mapRequest);
        for (QName l : layers) {
            map.addLayer(createMapLayer(l));
        }
        return map;
View Full Code Here

        e.setSrid(srid(request));
        e.getTileMatricies().addAll(matrices);
        LOGGER.fine("Creating tile entry" + e.getTableName());
        geopkg.create(e);
       
        GetMapRequest req = new GetMapRequest();
        OwsUtils.copy(request, req, GetMapRequest.class);
        req.setLayers(mapLayers);
       
        Map formatOpts = req.getFormatOptions();

        Integer minZoom = null;
        if (formatOpts.containsKey("min_zoom")) {
            minZoom = Integer.parseInt(formatOpts.get("min_zoom").toString());
        }

        Integer maxZoom = null;
        if (formatOpts.containsKey("max_zoom")) {
            maxZoom = Integer.parseInt(formatOpts.get("max_zoom").toString());
        } else if (formatOpts.containsKey("num_zooms")) {
            maxZoom = minZoom + Integer.parseInt(formatOpts.get("num_zooms").toString());
        }
       
        if (minZoom != null || maxZoom != null) {
            matrixSet = matrixSet.subMap(minZoom, maxZoom);
        }

        String imageFormat = formatOpts.containsKey("format") ? parseFormatFromOpts(formatOpts)
                : findBestFormat(request);
               
        CoordinateReferenceSystem crs = getCoordinateReferenceSystem(request);
        if (crs==null) {
            String srs = getSRS(request);
            try {
                crs = CRS.decode(srs);
            } catch (Exception ex) {
                throw new ServiceException(ex);
            }
        }
        double xSpan = crs.getCoordinateSystem().getAxis(0).getMaximumValue() - crs.getCoordinateSystem().getAxis(0).getMinimumValue();
        double ySpan = crs.getCoordinateSystem().getAxis(1).getMaximumValue() - crs.getCoordinateSystem().getAxis(1).getMinimumValue();
        double xOffset = crs.getCoordinateSystem().getAxis(0).getMinimumValue();
        double yOffset = crs.getCoordinateSystem().getAxis(1).getMinimumValue();
   
       
        req.setFormat(imageFormat);
        req.setCrs(crs);
       
        //column and row bounds
        Integer minColumn = null, maxColumn = null, minRow = null, maxRow = null;
        if (formatOpts.containsKey("min_column")) {
            minColumn = Integer.parseInt(formatOpts.get("min_column").toString());
        }
        if (formatOpts.containsKey("max_column")) {
            maxColumn = Integer.parseInt(formatOpts.get("max_column").toString());
        }
        if (formatOpts.containsKey("min_row")) {
            minRow = Integer.parseInt(formatOpts.get("min_row").toString());
        }
        if (formatOpts.containsKey("max_row")) {
            maxRow = Integer.parseInt(formatOpts.get("max_row").toString());
        }

        for (TileMatrix matrix : matrixSet.values()) {

            req.setWidth(matrix.getTileWidth());
            req.setHeight(matrix.getTileHeight());
           
            //long[] intersect = gridSubset.getCoverageIntersection(z, bbox);
            double resX = xSpan / matrix.getMatrixWidth();
            double resY = ySpan / matrix.getMatrixHeight();
           
            long minX = Math.round(Math.floor((bbox.getMinX()-xOffset) / resX));
            long minY = Math.round(Math.floor((bbox.getMinY()-yOffset) / resY));
            long maxX = Math.round(Math.ceil((bbox.getMaxX()-xOffset) / resX));
            long maxY = Math.round(Math.ceil((bbox.getMaxY()-yOffset) / resY));
           
            minX = minColumn == null? minX : Math.max(minColumn, minX);
            maxX = maxColumn == null? maxX : Math.min(maxColumn, maxX);
            minY = minRow == null? minY : Math.max(minRow, minY);
            maxY = maxRow == null? maxY : Math.min(maxRow, maxY);
           
            for (long x = minX; x < maxX; x++) {
                for (long y = minY; y < maxY; y++) {
                    req.setBbox(new Envelope( xOffset + x * resX , xOffset + (x+1) * resX, yOffset + y * resY, yOffset + (y+1) * resY));
                    WebMap result = webMapService.getMap(req);
                    Tile t = new Tile();
                    t.setZoom(matrix.getZoomLevel());
                    t.setColumn((int) x);
                    t.setRow((int) y);
View Full Code Here

    }

    @Test
    public void testDifferentBbox() throws NoSuchAuthorityCodeException, FactoryException{
        // Instantiate a request
        GetMapRequest req = new GetMapRequest();
        // Define CRS
        CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
        // Create the first bbox
        ReferencedEnvelope bbox1 = new ReferencedEnvelope(0, 1, 0, 1, crs);
        req.setBbox(bbox1);
        req.setCrs(crs);
        ReferencedEnvelope bounds1 = format.bounds(req);
        // Create the second bbox
        ReferencedEnvelope bbox2 = new ReferencedEnvelope(1, 2, 1, 2, crs);
        req.setBbox(bbox2);
        ReferencedEnvelope bounds2 = format.bounds(req);
        // Ensure that the 2 generated bbox are not the same so that they are not cached
        double tolerance = 0.1d;
        assertNotSame(bounds1, bounds2);
        assertNotEquals(bounds1.getMinX(),bounds2.getMinX(), tolerance );
View Full Code Here

       
        return new MBTilesFile(f);
    }

    protected GetMapRequest createGetMapRequest(QName[] layerNames) {
        GetMapRequest request = super.createGetMapRequest(layerNames);
        request.setBbox(new Envelope(-180,180,-90,90));
        return request;
    };
View Full Code Here

        request.setBbox(new Envelope(-180,180,-90,90));
        return request;
    };
   
    WMSMapContent createMapContent(QName... layers) throws IOException {
        GetMapRequest mapRequest = createGetMapRequest(layers);
        WMSMapContent map = new WMSMapContent(mapRequest);
        for (QName l : layers) {
            map.addLayer(createMapLayer(l));
        }
        return map;
View Full Code Here

TOP

Related Classes of org.geoserver.wms.GetMapRequest

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.