Examples of Envelope2D


Examples of org.geotools.geometry.Envelope2D

    @GET @Path("/tile/{layer}/{z}/{x}/{y}.{ext}")
    @Produces("image/*")
    public Response tileGet() throws Exception {

        // Re-use analyst
        Envelope2D env = SlippyTile.tile2Envelope(x, y, z);
        TileRequest tileRequest = new TileRequest(routerId, env, 256, 256);

        BufferedImage image = otpServer.tileRendererManager.renderTile(tileRequest, layer);

        MIMEImageFormat format = new MIMEImageFormat("image/" + ext);
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

            double minx = Double.parseDouble(tokens[0]);
            double miny = Double.parseDouble(tokens[1]);
            double maxx = Double.parseDouble(tokens[2]);
            double maxy = Double.parseDouble(tokens[3]);
            // null crs, set later from another parameter
            env = new Envelope2D(null, minx, miny, maxx-minx, maxy-miny);
        } catch (Exception e) {
            throw new WebApplicationException(fail(param, e));
        }
    }
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

    public Response tileGet(@PathParam("surfaceId") Integer surfaceId,
                            @PathParam("x") int x,
                            @PathParam("y") int y,
                            @PathParam("z") int z) throws Exception {

        Envelope2D env = SlippyTile.tile2Envelope(x, y, z);
        TimeSurface surfA = server.surfaceCache.get(surfaceId);
        if (surfA == null) return badRequest("Unrecognized surface ID.");
         
        TileRequest tileRequest = new TileRequest(surfA.routerId, env, 256, 256);
      
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

    public static Envelope2D tile2Envelope(final int x, final int y, final int zoom) {
        double maxLat = tile2lat(y, zoom);
        double minLat = tile2lat(y + 1, zoom);
        double minLon = tile2lon(x, zoom);
        double maxLon = tile2lon(x + 1, zoom);
        return new Envelope2D(DefaultGeographicCRS.WGS84, minLon, minLat, maxLon-minLon, maxLat-minLat);
    }
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

        // The best place for caching tiles may be here
        BufferedImage image = new BufferedImage(tileRequest.width, tileRequest.height,
                renderer.getColorModel());
        context.graphics = image.createGraphics();
        Envelope2D trbb = tileRequest.bbox;
        context.bbox = new Envelope(trbb.x, trbb.x + trbb.width, trbb.y, trbb.y + trbb.height);
        context.transform = new AffineTransformation();
        double xScale = tileRequest.width / trbb.width;
        double yScale = tileRequest.height / trbb.height;
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

    @QueryParam("format"@DefaultValue("image/png"MIMEImageFormat format;

    @GET @Produces("image/*")
    public Response tileGet() throws Exception {
       
        Envelope2D env = SlippyTile.tile2Envelope(x, y, z);
        TileRequest tileRequest = new TileRequest("", env, 256, 256);
        RoutingRequest sptRequestA = buildRequest(0);
        RoutingRequest sptRequestB = buildRequest(1);

        Layer layer = layers.get(0);
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

           @QueryParam("format") @DefaultValue("image/geotiff") MIMEImageFormat format,
           @QueryParam("crs") @DefaultValue("EPSG:4326") CRSParameter crs
           ) throws Exception {
       
        // BoundingBox is a subclass of Envelope, an Envelope2D constructor parameter
        Envelope2D bbox = new Envelope2D(index.getBoundingBox(crs.crs));
        if (resolution != null) {
            width  = (int) Math.ceil(bbox.width  / resolution);
            height = (int) Math.ceil(bbox.height / resolution);
        }
       
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

        final CoordinateReferenceSystem crs2D = CRS.getHorizontalCRS(crs);
        if (crs2D == null)
            throw new MismatchedDimensionException(Errors.format(ErrorKeys.CANT_SEPARATE_CRS_$1,
                    crs));

        return new Envelope2D(crs2D, envelope.getMinX(), envelope.getMinY(), envelope.getWidth(),
                envelope.getHeight());
    }
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

        GridCoverageReaderHelper helper = new GridCoverageReaderHelper(reader, new Rectangle(720,
                180), mapExtent, Interpolation.getInstance(Interpolation.INTERP_NEAREST));

        // read single coverage with no projection handling
        GridCoverage2D coverage = helper.readCoverage(null);
        Envelope2D envelope = coverage.getEnvelope2D();
        assertEquals(-180, envelope.getMinX(), EPS);
        assertEquals(180, envelope.getMaxX(), EPS);
        assertEquals(-90, envelope.getMinY(), EPS);
        assertEquals(90, envelope.getMaxY(), EPS);

        // try multiple coverage with projection handling, should not make a difference
        // since we are already reading everything in a single shot, just in need of coverage
        // replication
        // (which has to be performed after the eventual reprojection, so not here in the reader)
View Full Code Here

Examples of org.geotools.geometry.Envelope2D

        GridCoverageReaderHelper helper = new GridCoverageReaderHelper(reader, new Rectangle(100,
                100), mapExtent, Interpolation.getInstance(Interpolation.INTERP_NEAREST));

        // read single coverage with no projection handling, the geotiff reader gives us all
        GridCoverage2D coverage = helper.readCoverage(null);
        Envelope2D envelope = coverage.getEnvelope2D();
        assertEquals(-180, envelope.getMinX(), EPS);
        assertEquals(180, envelope.getMaxX(), EPS);
        assertEquals(-90, envelope.getMinY(), EPS);
        assertEquals(90, envelope.getMaxY(), EPS);

        // now read with projection handling instead, we must get two at the
        // two ends of the dateline
        ProjectionHandler handler = ProjectionHandlerFinder.getHandler(mapExtent,
                reader.getCoordinateReferenceSystem(), true);
        List<GridCoverage2D> coverages = helper.readCoverages(null, handler);
        // System.out.println(coverages);
        assertEquals(2, coverages.size());
        Envelope2D firstEnvelope = coverages.get(0).getEnvelope2D();
        assertEquals(169.2, firstEnvelope.getMinX(), EPS);
        assertEquals(180, firstEnvelope.getMaxX(), EPS);
        assertEquals(69.3, firstEnvelope.getMinY(), EPS);
        assertEquals(80.1, firstEnvelope.getMaxY(), EPS);
        Envelope2D secondEnvelope = coverages.get(1).getEnvelope2D();
        assertEquals(-180, secondEnvelope.getMinX(), EPS);
        assertEquals(-169.2, secondEnvelope.getMaxX(), EPS);
        assertEquals(69.3, secondEnvelope.getMinY(), EPS);
        assertEquals(80.1, secondEnvelope.getMaxY(), EPS);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.