@Override public <T> T create(Class<T> clazz) { return (T) new WCSInfoImpl(); } }
@Override public Object operationExecuted(Request request, Operation operation, Object result) { // collect the grid coverages that we'll have to dispose of at the // end of the request if (result instanceof GridCoverage) { addCoverages((GridCoverage) result); } else if (result instanceof GridCoverage[]) { addCoverages((GridCoverage[]) result); } return result; }
protected WCSInfo createServiceFromScratch(GeoServer gs) { WCSInfoImpl wcs = new WCSInfoImpl(); wcs.setName("WCS"); return wcs; }
public void encode( GridCoverage2D sourceCoverage, String outputFormat, Map<String, String> econdingParameters, OutputStream output) throws IOException { Utilities.ensureNonNull("sourceCoverage", sourceCoverage); Utilities.ensureNonNull("econdingParameters", econdingParameters); GeoTiffWriterHelper writerHelper = new GeoTiffWriterHelper(sourceCoverage); // compression handleCompression(econdingParameters, writerHelper); // tiling handleTiling(econdingParameters, sourceCoverage, writerHelper); // interleaving handleInterleaving(econdingParameters, sourceCoverage, writerHelper); if (geoserver.getService(WCSInfo.class).isLatLon()) { final ParameterValueGroup gp = writerHelper.getGeotoolsWriteParams(); gp.parameter(GeoTiffFormat.RETAIN_AXES_ORDER.getName().toString()).setValue(true); } try { writerHelper.write(output); } finally { sourceCoverage.dispose(false); } }
public void testDescribeDemCoverageKvp() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=" + getLayerId(TASMANIA_DEM)); // print(dom); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); checkDemCoverageDescription(dom); }
@Override protected WCSInfo initialize(WCSInfo service) { super.initialize(service); if (service.getExceptionFormats() == null) { ((WCSInfoImpl) service).setExceptionFormats(new ArrayList<String>()); } if (service.getVersions().isEmpty()) { service.getVersions().add(new Version("1.0.0")); service.getVersions().add(new Version("1.1.1")); } Version v201 = new Version("2.0.1"); if (!service.getVersions().contains(v201)) { service.getVersions().add(v201); } if (service.getSRS() == null) { ((WCSInfoImpl) service).setSRS(new ArrayList<String>()); } return service; } }
public WCSInfo load(LegacyServicesReader reader, GeoServer gs) throws Exception { WCSInfoImpl wcs = new WCSInfoImpl(); wcs.setId("wcs"); Map<String, Object> map = reader.wcs(); readCommon(wcs, map, gs); // wcs.setGMLPrefixing((Boolean)map.get( "gmlPrefixing")); wcs.getVersions().add(new Version("1.0.0")); wcs.getVersions().add(new Version("1.1.1")); return wcs; }
/** Clean up any coverages collected by {@link #addCoverages(GridCoverage...)} */ public void clean() { try { List<GridCoverage> coverages = COVERAGES.get(); if (coverages != null) { for (GridCoverage coverage : coverages) { try { disposeCoverage(coverage); } catch (Exception e) { LOGGER.log( Level.WARNING, "Failed to fully dispose coverage: " + coverage, e); } } } } finally { COVERAGES.remove(); } } }
public void testTimeKVPNow() throws Exception { String queryString ="request=getcoverage&service=wcs&version=1.0.0&format=image/geotiff" + "&bbox=0.237,40.562,14.593,44.558&crs=EPSG:4326&width=25&height=25&time=now" + "&coverage=" + getLayerId(WATTEMP); MockHttpServletResponse response = getAsServletResponse("wcs?" + queryString); checkTimeCurrent(response); }
public void testTimeSecond() throws Exception { String request = getWaterTempTimeRequest("2008-11-01T00:00:00.000Z"); MockHttpServletResponse response = postAsServletResponse("wcs", request); checkTimeCurrent(response); }
public void testGetBasic() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0"); // print(dom); checkValidationErrors(dom, WCS10_GETCAPABILITIES_SCHEMA); }
public void testPostBasic() throws Exception { String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\" " + "xmlns:wcs=\"http://www.opengis.net/wcs\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>"; Document dom = postAsDOM(BASEPATH, request); // print(dom); checkValidationErrors(dom, WCS10_GETCAPABILITIES_SCHEMA); }
throws WcsException { long limit = info.getMaxInputMemory() * 1024; if (limit <= 0) { return; OverviewPolicy policy = info.getOverviewPolicy(); double[] readResoutions = reader.getReadingResolutions(policy, resolutions); double[] baseResolutions =
protected void setOutputLimit(int kbytes) { GeoServer gs = getGeoServer(); WCSInfo info = gs.getService(WCSInfo.class); info.setMaxOutputMemory(kbytes); gs.save(info); }
/** * Returns the reader hints based on the current WCS configuration * * @param wcs */ public static Hints getReaderHints(WCSInfo wcs) { Hints hints = new Hints(); hints.add(new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE)); if (wcs.getOverviewPolicy() == null) { hints.add(new Hints(Hints.OVERVIEW_POLICY, OverviewPolicy.IGNORE)); } else { hints.add(new Hints(Hints.OVERVIEW_POLICY, wcs.getOverviewPolicy())); } hints.put( Hints.DECIMATION_POLICY, wcs.isSubsamplingEnabled() ? DecimationPolicy.ALLOW : DecimationPolicy.DISALLOW); return hints; }
/** * Checks the coverage described by the specified geometry and sample model does not exceeds the * output WCS limits * * @param info * @param gridRange2D * @param sampleModel */ public static void checkOutputLimits( WCSInfo info, GridEnvelope2D gridRange2D, SampleModel sampleModel) { // do we have to check a limit at all? long limit = info.getMaxOutputMemory() * 1024; if (limit <= 0) { return; } // compute the coverage memory usage and compare with limit long actual = getCoverageSize(gridRange2D, sampleModel); if (actual > limit) { throw new WcsException( "This request is trying to generate too much data, " + "the limit is " + formatBytes(limit) + " but the actual amount of bytes to be " + "written in the output is " + formatBytes(actual)); } }
@Override public void initXStreamPersister(XStreamPersister xp, GeoServer gs) { super.initXStreamPersister(xp, gs); initXStreamPersister(xp); }
long limit = info.getMaxInputMemory() * 1024; if (limit <= 0) { return;
@Override public void finished(Request request) { clean(); }
long limit = wcs.getMaxOutputMemory() * 1024; if (limit <= 0) { return;