Package org.geotools.coverage.grid.io

Examples of org.geotools.coverage.grid.io.AbstractGridFormat


                                regionString.append("\ncols=");
                                regionString.append(cols);

                                GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(cols, rows, north, south,
                                        east, west, mapEnvironment.getCoordinateReferenceSystem());
                                AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory().createFormat();
                                AbstractGridCoverage2DReader reader = format.getReader(mapEnvironment.getCELL());
                                geodata = ((GridCoverage2D) reader.read(readParams));
                                geodata = geodata.view(ViewType.GEOPHYSICS);
                            } else {
                                MessageDialog.openInformation(shell, "WARNING", "Unable to read format");
                                return;
View Full Code Here


        if (jGrassRegion == null)
            jGrassRegion = jGrassMapEnvironment.getActiveRegion();
        GeneralParameterValue[] readParams = JGrassCatalogUtilities.createGridGeometryGeneralParameter(jGrassRegion.getCols(),
                jGrassRegion.getRows(), jGrassRegion.getNorth(), jGrassRegion.getSouth(), jGrassRegion.getWest(),
                jGrassRegion.getEast(), crs);
        AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory().createFormat();
        GridCoverageReader reader = format.getReader(jGrassMapEnvironment.getCELL());
        GridCoverage2D mapCoverage = ((GridCoverage2D) reader.read(readParams));
        return mapCoverage;
    }
View Full Code Here

                                    JGrassRegion jGrassRegion = oldMapEnvironment.getActiveRegion();
                                    GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(
                                            jGrassRegion.getCols(), jGrassRegion.getRows(), jGrassRegion.getNorth(),
                                            jGrassRegion.getSouth(), jGrassRegion.getEast(), jGrassRegion.getWest(),
                                            oldMapEnvironment.getCoordinateReferenceSystem());
                                    AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
                                            .createFormat();
                                    AbstractGridCoverage2DReader reader = format.getReader(oldMapEnvironment.getCELL());
                                    GridCoverage2D geodata = ((GridCoverage2D) reader.read(readParams));
                                    geodata = geodata.view(ViewType.GEOPHYSICS);

                                    File mapsetFile = oldMapEnvironment.getMAPSET();
                                    JGrassMapEnvironment newMapEnvironment = new JGrassMapEnvironment(mapsetFile, newMapName);
                                    format = new GrassCoverageFormatFactory().createFormat();
                                    GridCoverageWriter writer = format.getWriter(newMapEnvironment.getCELL(), null);
                                    writer.write(geodata, null);

                                    JGrassCatalogUtilities.addMapToCatalog(mapsetFile.getParent(), mapsetFile.getName(),
                                            newMapName, JGrassConstants.GRASSBINARYRASTERMAP);
View Full Code Here

            for (GridFormatFactorySpi gridFormatFactorySpi : availableFormats) {
                if (gridFormatFactorySpi instanceof BaseGridFormatFactorySPI) {
                    // System.out.println(gridFormatFactorySpi.getClass().getName());
                    if (gridFormatFactorySpi.isAvailable()) {
                        AbstractGridFormat format = gridFormatFactorySpi.createFormat();

                        if (format != null && format instanceof BaseGDALGridFormat) {
                            getExtensionsForFormat(gridFormatFactorySpi,
                                    (BaseGDALGridFormat) format);
                        }
View Full Code Here

     * @return Reader linked to this service.
     */
    public synchronized AbstractGridCoverage2DReader getReader(IProgressMonitor monitor) {
        if (this.reader == null) {
            try {
                AbstractGridFormat frmt = (AbstractGridFormat) getFormat();
                ID id = getID();
                if( id.isFile() ){
                    File file = id.toFile();
                    if (file != null) {
                        // to force crs
                        // Hints hints = new Hints();
                        // hints.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, )
                        this.reader = (AbstractGridCoverage2DReader) frmt.getReader(file);
                        return this.reader;
                  }
                  else {
                    throw new FileNotFoundException( id.toFile().toString() );
                  }
                }
                this.reader = (AbstractGridCoverage2DReader) frmt.getReader( id.toURL() );
            } catch (Exception ex) {
                this.message = ex;
            }
        }
        return this.reader;
View Full Code Here

                                    GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(
                                            jGrassRegion.getCols(), jGrassRegion.getRows(), jGrassRegion.getNorth(),
                                            jGrassRegion.getSouth(), jGrassRegion.getEast(), jGrassRegion.getWest(),
                                            mapEnvironment.getCoordinateReferenceSystem());

                                    AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
                                            .createFormat();
                                    GridCoverageReader reader = format.getReader(mapEnvironment.getCELL());
                                    GridCoverage2D geodata = ((GridCoverage2D) reader.read(readParams));
                                    geodata = geodata.view(ViewType.GEOPHYSICS);

                                    final ArcGridFormat format1 = new ArcGridFormat();
                                    final ArcGridWriteParams wp = new ArcGridWriteParams();
View Full Code Here

    }

    if( found == null ){
        return Messages.ImageServiceExtension_geotoolsDisagrees;
    }
    final AbstractGridFormat format= getFormatForObject(id, file);

    /* Does this format accept file or URL? */
    if (format==null) {
      return Messages.ImageServiceExtension_geotoolsDisagrees;
    }
View Full Code Here

  private static GridFormatFactorySpi getFactoryForObject(URL id, File file) {
    for(GridFormatFactorySpi spi: GDALFormatProvider.factories.values())
    { 
      //we know that the factory is avaiable
      final AbstractGridFormat format = (AbstractGridFormat) spi.createFormat();
      if (file!=null&&format.accepts(file))
        return spi;
      if(id!=null&&format.accepts(id))
        return spi;
    }
    return null;
  }
View Full Code Here

        if (info.isEnabled()) {
            // store's enabled, make sure it works
            LOGGER.finer("Store " + info.getName() + " is enabled, verifying factory availability "
                    + "before saving it...");
            AbstractGridFormat gridFormat = resourcePool.getGridCoverageFormat(info);

            if (gridFormat == null) {
                throw new IllegalArgumentException(
                        "No grid format found capable of connecting to the provided URL."
                                + " To save the store disable it, and check the required libraries are in place");
View Full Code Here

    protected WorkspacePanel workspacePanel;

    private Form paramsForm;

    void initUI(final CoverageStoreInfo store) {
        AbstractGridFormat format = store.getFormat();
        if (format == null) {
            String msg = "Coverage Store factory not found";
            msg = (String) new ResourceModel("CoverageStoreEditPage.cantGetCoverageStoreFactory",
                    msg).getObject();
            throw new IllegalArgumentException(msg);
        }

        IModel model = new Model(store);

        // build the form
        paramsForm = new Form("rasterStoreForm", model);
        add(paramsForm);

        // the format description labels
        paramsForm.add(new Label("storeType", format.getName()));
        paramsForm.add(new Label("storeTypeDescription", format.getDescription()));

        // name
        PropertyModel nameModel = new PropertyModel(model, "name");
        final TextParamPanel namePanel = new TextParamPanel("namePanel", nameModel,
                new ResourceModel("dataSrcName", "Data Source Name"), true);
View Full Code Here

TOP

Related Classes of org.geotools.coverage.grid.io.AbstractGridFormat

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.