Examples of WPSResourceManager


Examples of org.geoserver.wps.resource.WPSResourceManager

    layer.setName(sName);
    return layer;
  }

  public DataStore createDatastore(String m_sFilename, SimpleFeatureType m_FeatureType) throws IOException {
      WPSResourceManager manager = GeoServerExtensions.bean(WPSResourceManager.class);
     
    File directory = IOUtils.createTempDirectory("sxttmp");
        File file = new File(directory, m_sFilename);

        try {
            ShapefileDataStore dataStore = new ShapefileDataStore(DataUtilities.fileToURL(file));
            dataStore.createSchema(m_FeatureType);
            manager.addResource(new ShapefileResource(dataStore, directory));
           
            return dataStore;
        } catch(Throwable t) {
            LOGGER.log(Level.SEVERE, "Could not create shapefile output ", t);
            IOUtils.delete(directory);
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

    @Test
    public void testGetFeaturesAsGML() throws Exception {
        // Estimator process for checking limits
        DownloadEstimatorProcess limits = new DownloadEstimatorProcess(
                new StaticDownloadServiceConfiguration(), getGeoServer());
        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);

        FeatureTypeInfo ti = getCatalog().getFeatureTypeByName(getLayerId(MockData.POLYGONS));
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

    @Test
    public void testGetFeaturesAsGeoJSON() throws Exception {
        // Estimator process for checking limits
        DownloadEstimatorProcess limits = new DownloadEstimatorProcess(
                new StaticDownloadServiceConfiguration(), getGeoServer());
        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);

        FeatureTypeInfo ti = getCatalog().getFeatureTypeByName(getLayerId(MockData.POLYGONS));
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

    @Test
    public void testDownloadRaster() throws Exception {
        // Estimator process for checking limits
        DownloadEstimatorProcess limits = new DownloadEstimatorProcess(
                new StaticDownloadServiceConfiguration(), getGeoServer());
        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);

        // test ROI
        Polygon roi = (Polygon) new WKTReader2()
                .read("POLYGON (( -127.57473954542964 54.06575021619523, -130.88669845369998 52.00807146727025, -129.50812897394974 49.85372324691927, -130.5300633861675 49.20465679591609, -129.25955033314003 48.60392508062591, -128.00975216684665 50.986137055052474, -125.8623089087404 48.63154492960477, -123.984159178178 50.68231871628503, -126.91186316993704 52.15307567440926, -125.3444367403868 53.54787804784162, -127.57473954542964 54.06575021619523 ))");
        roi.setSRID(4326);
        // ROI reprojection
        Polygon roiResampled = (Polygon) JTS.transform(
                roi,
                CRS.findMathTransform(CRS.decode("EPSG:4326", true),
                        CRS.decode("EPSG:900913", true)));
        // Download the coverage as tiff (Not reprojected)
        File rasterZip = downloadProcess.execute(getLayerId(MockData.USA_WORLDIMG), // layerName
                null, // filter
                "image/tiff", // outputFormat
                null, // targetCRS
                CRS.decode("EPSG:4326", true), // roiCRS
                roi, // roi
                true, // cropToGeometry
                new NullProgressListener() // progressListener
                );

        // Final checks on the result
        Assert.assertNotNull(rasterZip);
        GeoTiffReader reader = null;
        GridCoverage2D gc = null, gcResampled = null;
        try {
            final File[] tiffFiles = extractTIFFFile(rasterZip);
            Assert.assertNotNull(tiffFiles);
            Assert.assertTrue(tiffFiles.length > 0);
            reader = new GeoTiffReader(tiffFiles[0]);
            gc = reader.read(null);

            Assert.assertNotNull(gc);

            Assert.assertEquals(-130.88669845369998,
                    gc.getEnvelope().getLowerCorner().getOrdinate(0), 1E-6);
            Assert.assertEquals(48.611129008700004, gc.getEnvelope().getLowerCorner()
                    .getOrdinate(1), 1E-6);
            Assert.assertEquals(-123.95304462109999,
                    gc.getEnvelope().getUpperCorner().getOrdinate(0), 1E-6);
            Assert.assertEquals(54.0861661371, gc.getEnvelope().getUpperCorner().getOrdinate(1),
                    1E-6);

        } finally {
            if (gc != null) {
                CoverageCleanerCallback.disposeCoverage(gc);
            }
            if (reader != null) {
                reader.dispose();
            }

            // clean up process
            resourceManager.finished(resourceManager.getExecutionId(true));
        }
        // Download the coverage as tiff (Reprojected)
        File resampledZip = downloadProcess.execute(getLayerId(MockData.USA_WORLDIMG), // layerName
                null, // filter
                "image/tiff", // outputFormat
                CRS.decode("EPSG:900913", true), // targetCRS
                CRS.decode("EPSG:900913", true), // roiCRS
                roiResampled, // roi
                true, // cropToGeometry
                new NullProgressListener() // progressListener
                );
        // Final checks on the result
        Assert.assertNotNull(resampledZip);

        try {
            File[] files = extractTIFFFile(resampledZip);
            reader = new GeoTiffReader(files[files.length - 1]);
            gcResampled = reader.read(null);

            Assert.assertNotNull(gcResampled);

            Assert.assertEquals(-1.457024062347863E7, gcResampled.getEnvelope().getLowerCorner()
                    .getOrdinate(0), 1E-6);
            Assert.assertEquals(6209706.404894806, gcResampled.getEnvelope().getLowerCorner()
                    .getOrdinate(1), 1E-6);
            Assert.assertEquals(-1.379838980949677E7, gcResampled.getEnvelope().getUpperCorner()
                    .getOrdinate(0), 1E-6);
            Assert.assertEquals(7187128.139081598, gcResampled.getEnvelope().getUpperCorner()
                    .getOrdinate(1), 1E-6);

        } finally {

            if (gcResampled != null) {
                CoverageCleanerCallback.disposeCoverage(gcResampled);
            }
            if (reader != null)

                reader.dispose();
            // clean up process
            resourceManager.finished(resourceManager.getExecutionId(true));
        }

    }
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

        // Estimator process for checking limits
        DownloadEstimatorProcess limits = new DownloadEstimatorProcess(
                new StaticDownloadServiceConfiguration(), getGeoServer());
        ZipArchivePPIO ppio = new ZipArchivePPIO(
                DownloadServiceConfiguration.DEFAULT_COMPRESSION_LEVEL);
        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);
        // ROI as a BBOX
        Envelope env = new Envelope(-125.074006936869, -123.88300771369998, 48.5552612829, 49.03872);
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

                        DownloadServiceConfiguration.NO_LIMIT, 10,
                        DownloadServiceConfiguration.NO_LIMIT,
                        DownloadServiceConfiguration.NO_LIMIT,
                        DownloadServiceConfiguration.DEFAULT_COMPRESSION_LEVEL)), getGeoServer());

        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);
        // ROI as polygon
        Polygon roi = (Polygon) new WKTReader2()
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

                new StaticDownloadServiceConfiguration(new DownloadServiceConfiguration(
                        DownloadServiceConfiguration.NO_LIMIT,
                        DownloadServiceConfiguration.NO_LIMIT, 10, 10,
                        DownloadServiceConfiguration.DEFAULT_COMPRESSION_LEVEL)), getGeoServer());

        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);
        // ROI
        Polygon roi = (Polygon) new WKTReader2()
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

                new StaticDownloadServiceConfiguration(new DownloadServiceConfiguration(
                        DownloadServiceConfiguration.NO_LIMIT,
                        DownloadServiceConfiguration.NO_LIMIT,
                        DownloadServiceConfiguration.NO_LIMIT, 10,
                        DownloadServiceConfiguration.DEFAULT_COMPRESSION_LEVEL)), getGeoServer());
        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);
        try {
            // Download the features. It should throw an exception
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

        ProcessListener listener = new ProcessListener(new ExecutionStatus(null, "0",
                ProcessState.RUNNING, 0, null));
        // Estimator process for checking limits
        DownloadEstimatorProcess limits = new DownloadEstimatorProcess(
                new StaticDownloadServiceConfiguration(), getGeoServer());
        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);
        // ROI data
        Polygon roi = (Polygon) new WKTReader2()
View Full Code Here

Examples of org.geoserver.wps.resource.WPSResourceManager

                        DownloadServiceConfiguration.NO_LIMIT,
                        DownloadServiceConfiguration.NO_LIMIT,
                        DownloadServiceConfiguration.NO_LIMIT, 1,
                        DownloadServiceConfiguration.DEFAULT_COMPRESSION_LEVEL)), getGeoServer());

        final WPSResourceManager resourceManager = new WPSResourceManager();
        // Creates the new process for the download
        DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
                resourceManager);

        try {
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.