SRS curSRS = curGridSubSet.getSRS(); if (!srsSet.contains(curSRS)) { str.append(" <SRS>" + curSRS.toString() + "</SRS>\n"); + curGridSubSet.getSRS().toString() + "\" minx=\"" + bs[0] + "\" miny=\"" + bs[1] + "\" maxx=\"" + bs[2] + "\" maxy=\"" + bs[3] + "\"/>\n"); GridSubset epsg4326GridSubSet = layer.getGridSubsetForSRS(SRS.getEPSG4326()); if (null != epsg4326GridSubSet) { String[] bs = boundsPrep(epsg4326GridSubSet.getCoverageBestFitBounds());
public static SRS getSRS(String epsgStr) throws GeoWebCacheException { final String crsAuthPrefix = "EPSG:"; if (epsgStr.substring(0, 5).equalsIgnoreCase(crsAuthPrefix)) { int epsgNumber = Integer.parseInt(epsgStr.substring(5, epsgStr.length())); return getSRS(epsgNumber); } else { throw new GeoWebCacheException("Can't parse " + epsgStr + " as SRS string."); } }
SRS srs = null; if (env.getEPSGCode() != null) { srs = SRS.getSRS(env.getEPSGCode()); } 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());
public String backendSRSOverride(SRS srs) { if (sphericalMercatorOverride != null && srs.equals(SRS.getEPSG3857())) { return sphericalMercatorOverride; } else { return srs.toString(); } }
if (srs.equals(SRS.getEPSG4326()) && gridBounds.equals(BoundingBox.WORLD4326) && resolutions == null) { gridSet = gridSetBroker.getWorldEpsg4326(); } else if (srs.equals(SRS.getEPSG3857()) && gridBounds.equals(BoundingBox.WORLD3857) && resolutions == null) { gridSet = GridSetFactory.createGridSet( srs.toString(), srs, gridBounds, srs.toString(), srs, gridBounds,
CoordinateReferenceSystem getCRSForGridset(GridSubset gridSubset) throws NoSuchAuthorityCodeException, FactoryException { return CRS.decode(gridSubset.getSRS().toString()); }
public SRS[] getProjections() { SRS[] srsList = {SRS.getEPSG4326()}; return srsList; }
if (srs.equals(SRS.getEPSG4326())) { gridSet.setMetersPerUnit(EPSG4326_TO_METERS); } else if (srs.equals(SRS.getEPSG3857())) { gridSet.setMetersPerUnit(EPSG3857_TO_METERS); } else {
GridSetFactory.createGridSet( unprojectedName, SRS.getEPSG4326(), BoundingBox.WORLD4326, false, final SRS googleMapsCompatibleSRS = useEPSG900913 ? SRS.getEPSG900913() : SRS.getEPSG3857(); log.debug( "Adding " GridSetFactory.createGridSet( "GlobalCRS84Pixel", SRS.getEPSG4326(), BoundingBox.WORLD4326, true, GridSetFactory.createGridSet( "GlobalCRS84Scale", SRS.getEPSG4326(), BoundingBox.WORLD4326, true, GridSetFactory.createGridSet( "GoogleCRS84Quad", SRS.getEPSG4326(), BoundingBox.WORLD4326, true,
private static CoordinateReferenceSystem getGridsetCrs(GridSubset gridSubset) { final CoordinateReferenceSystem gridSetCrs; SRS srs = gridSubset.getGridSet().getSrs(); try { int epsgCode = srs.getNumber(); String epsgId = "EPSG:" + epsgCode; boolean longitudeFirst = true; // as used by geoserver gridSetCrs = CRS.decode(epsgId, longitudeFirst); } catch (Exception e) { throw new RuntimeException("Can't decode SRS ESPG:" + srs.getNumber()); } return gridSetCrs; }
private void layerWGS84BoundingBox(XMLBuilder xml, TileLayer layer) throws IOException { GridSubset subset = layer.getGridSubsetForSRS(SRS.getEPSG4326()); if (subset != null) { double[] coords = subset.getOriginalExtent().getCoords(); return; subset = layer.getGridSubsetForSRS(SRS.getEPSG900913()); if (subset != null) { double[] coords = subset.getOriginalExtent().getCoords();
/** @deprecated just use {@link #equals} */ public boolean equalsIncludingAlias(Object o) { return equals(o); }
public void testBoundingBoxEPSG3785() throws Exception { BoundingBox extent = new BoundingBox(-20037508.34, -20037508.34, 20037508.34, 20037508.34); GridSet gridSet = GridSetFactory.createGridSet( "test", SRS.getEPSG3857(), extent, false, 6, null, 0.00028, 256, 256, false); Grid grid0 = gridSet.getGridLevels()[0]; assertEquals((20037508.34 * 2) / 256, grid0.getResolution()); assertEquals(1L, grid0.getNumTilesWide()); assertEquals(1L, grid0.getNumTilesHigh()); Grid grid3 = gridSet.getGridLevels()[3]; assertEquals((long) Math.pow(2, 3), grid3.getNumTilesWide()); assertEquals((long) Math.pow(2, 3), grid3.getNumTilesHigh()); }
private void capabilityVendorSpecificTileset(StringBuilder str, TileLayer layer, GridSubset grid, String formatStr, String styleName) throws GeoWebCacheException { String srsStr = grid.getSRS().toString(); StringBuilder resolutionsStr = new StringBuilder(); double[] res = grid.getResolutions(); for (int i = 0; i < res.length; i++) { resolutionsStr.append(Double.toString(res[i]) + " "); } String[] bs = boundsPrep(grid.getCoverageBestFitBounds()); str.append(" <TileSet>\n"); str.append(" <SRS>" + srsStr + "</SRS>\n"); str.append(" <BoundingBox SRS=\"" + srsStr + "\" minx=\"" + bs[0] + "\" miny=\"" + bs[1] + "\" maxx=\"" + bs[2] + "\" maxy=\"" + bs[3] + "\" />\n"); str.append(" <Resolutions>" + resolutionsStr.toString() + "</Resolutions>\n"); str.append(" <Width>" + grid.getTileWidth() + "</Width>\n"); str.append(" <Height>" + grid.getTileHeight() + "</Height>\n"); str.append(" <Format>" + formatStr + "</Format>\n"); str.append(" <Layers>" + layer.getName() + "</Layers>\n"); str.append(" <Styles>").append(ServletUtils.URLEncode(styleName)) .append("</Styles>\n"); str.append(" </TileSet>\n"); }
public SRS[] getProjections() { SRS[] srsList = { SRS.getEPSG4326() }; return srsList; }
/** * Returns an immutable list of all the layer's {@link GridSubset} whose {@link GridSet} has a * SRS equal to {@code srs} (may be an alias), or the empty list of none matches. */ 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); } } return matches.isEmpty() ? matches : Collections.unmodifiableList(matches); }
public void testResolutionsArrayEPSG3785() throws Exception { BoundingBox extent = new BoundingBox(-20037508.34, -20037508.34, 20037508.34, 20037508.34); double[] resolutions = { (20037508.34 * 2) / 256, (20037508.34 * 2) / 512, (20037508.34 * 2) / 1024, (20037508.34 * 2) / 2048 }; GridSet gridSet = GridSetFactory.createGridSet( "test", SRS.getEPSG3857(), extent, false, resolutions, null, null, 0.00028, null, 256, 256, false); Grid grid0 = gridSet.getGridLevels()[0]; assertEquals((20037508.34 * 2) / 256, grid0.getResolution()); assertEquals(1L, grid0.getNumTilesWide()); assertEquals(1L, grid0.getNumTilesHigh()); Grid grid3 = gridSet.getGridLevels()[3]; assertEquals((long) Math.pow(2, 3), grid3.getNumTilesWide()); assertEquals((long) Math.pow(2, 3), grid3.getNumTilesHigh()); }
when(tld.getTileLayer(layerName)).thenReturn(tileLayer); when(tld.getLayerList()).thenReturn(Collections.singleton(tileLayer)); when(tileLayer.getGridSubsetsForSRS(SRS.getEPSG4326())) .thenReturn(Collections.singletonList(subset)); when(tileLayer.getInfoMimeTypes()).thenReturn(Collections.singletonList(XMLMime.gml)); req.addParameter("layers", layerName); req.addParameter("format", "image/png"); req.addParameter("srs", SRS.getEPSG4326().toString()); req.addParameter("bbox", "0,0,40,60"); req.addParameter("width", "40"); + layerName + "&format=image/png&srs=" + SRS.getEPSG4326().toString() + "&bbox=0,0,40,60&width=40&height=60&x=3&y=3");