More

Error Reading ESRI ArcGrid File using GeoTools?

Error Reading ESRI ArcGrid File using GeoTools?


I have a raster file in ESRI ArcGrid format (e.g. hdr.adf). I would like to run some analysis using GeoTools. I've never used the coverage classes before and I'm having a few problems out of the gates.

I can instantiate the AIGReader just fine and I get the correct values when I check the bounds. Example:

BaseGDALGridCoverage2DReader reader = new AIGReader(file); System.out.println(reader.getSource()); for (String coverage : reader.getGridCoverageNames()){ System.out.println(coverage); } System.out.println(reader.getOriginalEnvelope()); System.out.println(reader.getOriginalGridRange()); System.out.println(reader.getCoordinateReferenceSystem());

This is the stdout:

Jan 06, 2015 6:38:09 PM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL INFO: GDAL Native Library loaded (version: 1.11.1) Jan 06, 2015 6:38:09 PM org.geotools.coverageio.gdal.BaseGDALGridCoverage2DReader setCoverageProperties INFO: crs not found, proceeding with default crs K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000hdr.adf geotools_coverage GeneralEnvelope[(-180.0, -90.0), (179.99999999999858, 85.99999999999929)] GridEnvelope2D[0… 43199, 0… 21119] LOCAL_CS["Wildcard 2D cartesian plane in metric unit", LOCAL_DATUM["Unknown", 0], UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH], AUTHORITY["EPSG","404000"]]

When I call the BaseGDALGridCoverage2DReader.read() method, I get a null pointer exception:

GridCoverage2D gc = (GridCoverage2D) reader.read(null);

The read method throws the following Exception:

Exception in thread "main" java.lang.NullPointerException at org.geotools.coverageio.RasterLayerRequest.setBaseParameters(RasterLayerRequest.java:902) at org.geotools.coverageio.RasterLayerRequest.(RasterLayerRequest.java:206) at org.geotools.coverageio.BaseGridCoverage2DReader.read(BaseGridCoverage2DReader.java:400)

I tried passing in an array of GeneralParameterValue but I still get a null pointer exception. Example:

ParameterValue policy = AbstractGridFormat.OVERVIEW_POLICY.createValue(); policy.setValue(OverviewPolicy.IGNORE); ParameterValue gridsize = AbstractGridFormat.SUGGESTED_TILE_SIZE.createValue(); ParameterValue useJaiRead = AbstractGridFormat.USE_JAI_IMAGEREAD.createValue(); useJaiRead.setValue(true); reader.read(new GeneralParameterValue[]{policy, gridsize, useJaiRead});

I'm using Java 1.6 so I'm stuck with GeoTools 10.8.

Any suggestions?

UPDATE

QGIS and GDAL can open the file just file. Here's a rendering from QGIS.

Here's the output from gdalinfo. As you can see the projection is not set. I hope this isn't the cause. If it is, is there a way to tell the reader which projection to use?

Driver: AIG/Arc/Info Binary Grid Files: K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000 K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000.aux.xml K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000dblbnd.adf K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000hdr.adf K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000log K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000metadata.xml K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000sta.adf K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000vat.adf K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000w001001.adf K:LandscanLandScan_Archive_2000_2012LandScan2000lspop2000w001001x.adf Size is 43200, 21120 Coordinate System is"Origin = (-180.000000000000000,85.999999999999289) Pixel Size = (0.008333333333333,-0.008333333333333) Corner Coordinates: Upper Left (-180.0000000, 86.0000000) Lower Left (-180.0000000, -90.0000000) Upper Right ( 180.0000000, 86.0000000) Lower Right ( 180.0000000, -90.0000000) Center ( -0.0000000, -2.0000000) Band 1 Block=256x4 Type=Int32, ColorInterp=Undefined Description = lspop2000 Min=0.000 Max=159004.000 Minimum=0.000, Maximum=35453.000, Mean=14.586, StdDev=221.326 NoData Value=-2147483647 Metadata: LAYER_TYPE=athematic STATISTICS_MAXIMUM=35453 STATISTICS_MEAN=14.58631887449 STATISTICS_MINIMUM=0 STATISTICS_STDDEV=221.32624697214

While this doesn't actually help you I can read a Grid file using the following code:

File raster = new File("… /… /data/nzdem/nzdem500/hdr.adf"); AbstractGridFormat format = GridFormatFinder.findFormat(raster); AbstractGridCoverage2DReader reader = format.getReader(raster); GridCoverage2D cov; try { cov = reader.read(null); } catch (IOException giveUp) { throw new RuntimeException(giveUp); }

I get the following log file notes:

Jan 07, 2015 10:06:10 AM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL INFO: GDAL Native Library loaded (version: 1.9.2)

Jan 07, 2015 10:06:10 AM org.geotools.coverageio.gdal.BaseGDALGridCoverage2DReader setCoverageProperties

INFO: crs not found, proceeding with default crs

Error: Could not find mediaLib accelerator wrapper classes. Continuing in pure Java mode. Occurs in: com.sun.media.jai.mlib.MediaLibAccessor


Introduction to open source GIS

Geos (geometry engine open source) is a class library for space topology analysis based on C ++ and is released following the lgpl protocol. The geos Class Library provides a wide range of spatial topology operation functions to determine the relationships between geometric objects and form new geometric objects after spatial analysis operations. The relationship between points, lines, and surface elements, including consistency, separation, intersection, coincidence, inclusion, and adjacent locations, you can use the functions provided in the geos class library for analysis and judgment. The geos Class Library provides buffer, convexhull, intersection, union, and difference ), analysis operations covered by set theory, such as symdifference.

C ++ open source GIS System

Desktop GIS projects include grass, ossim, and quantum GIS.

Quantum GIS (qgis) is a project that has many origins with grass. It focuses more on graphic interface identification and map visualization.

Open-source GIS middleware in the Java camp

Geotools provides a wide range of class libraries for GIS data processing and spatial analysis. The underlying layer uses JTs (Java topology suite) to implement spatial topology and analysis functions.

Java open source GIS System

Refractions research, a leader in open-source GIS, presided over the development of a number of GIS projects, including postgis, geotools, and geoserver. udig is also an important open-source desktop GIS project.

Udig follows OpenGIS standards and provides support for data sources such as postgis, DB2, ArcSDE, and Oracle spatial. In terms of network GIS services, udig provides excellent support. WMS and WFS of Network Map services can be read and displayed directly in udig, in addition, udig integrates the Web search function of the map service. You can query the related map service on the network and drag it to the layer for display. As udig uses the RCP platform for development, the interface style and operation method are consistent with the existing layout of Eclipse, which makes users who are used to eclipse feel more cordial.

Jump using the GPL protocol is also developed based on Java. Jump also provides flexible plug-in structure design, and supports the display, editing, and output of vector and raster data formats, as well as common spatial analysis operations. Jump is widely used in teaching and quick prototype development. Jump fans have also started related jump pilot projects and their subprojects, such as openjump, which have made a lot of useful work for studying jump.

Computational geometric C ++ library cgal

Shapelib, an open source library for processing shapefile vector files

Projection conversion proj.4

Category GIS open source software GIS commercial software
GIS Desktop System Udig, jump, qgis ArcMAP, ArcGIS
GIS analysis tools Grass, ossim ArcInfo and arcgrid
Geographic Statistics Gnur ArcGIS geostatistical Analyst
3D Virtual Earth Worldwing, earth3d, ossimplanet Arcglobal, Google Earth
Spatial Data Engine Postgis ArcSDE, Oracle Spatial
Relational Database Service Pstgresql, MySQL, INGRES Oracle and DB2
Metadata Service Isite ArcIMS metadata service
Map Service Mapserver, geoserver ArcIMS, mapguide Enterprise
Grid vector Library Gdal, OGR
Map Projection Proj.4

Gdal (raster)/OGR (vector) provides various types of read/write support

Geos (geometry engine open source) is a class library for space topology analysis based on C ++ and is released following the lgpl protocol. The geos Class Library provides a wide range of spatial topology operation functions to determine the relationships between geometric objects and form new geometric objects after spatial analysis operations. The relationship between points, lines, and surface elements, including consistency, separation, intersection, coincidence, inclusion, and adjacent locations, you can use the functions provided in the geos class library for analysis and judgment. The geos Class Library provides buffer, convexhull, intersection, union, and difference ), analysis operations covered by set theory, such as symdifference.

C ++ open source GIS System

Desktop GIS projects include grass, ossim, and quantum GIS.

Quantum GIS (qgis) is a project that has many origins with grass. It focuses more on graphic interface identification and map visualization.

Open-source GIS middleware in the Java camp

Geotools provides a wide range of class libraries for GIS data processing and spatial analysis. The underlying layer uses JTs (Java topology suite) to implement spatial topology and analysis functions.

Java open source GIS System

Refractions research, a leader in open-source GIS, presided over the development of a number of GIS projects, including postgis, geotools, and geoserver. udig is also an important open-source desktop GIS project.

Udig follows OpenGIS standards and provides support for data sources such as postgis, DB2, ArcSDE, and Oracle spatial. In terms of network GIS services, udig provides excellent support. WMS and WFS of Network Map services can be read and displayed directly in udig, in addition, udig integrates the Web search function of the map service. You can query the related map service on the network and drag it to the layer for display. As udig uses the RCP platform for development, the interface style and operation method are consistent with the existing layout of Eclipse, which makes users who are used to eclipse feel more cordial.

Jump using the GPL protocol is also developed based on Java. Jump also provides flexible plug-in structure design, and supports the display, editing, and output of vector and raster data formats, as well as common spatial analysis operations. Jump is widely used in teaching and quick prototype development. Jump fans have also started related jump pilot projects and their subprojects, such as openjump, which have made a lot of useful work for studying jump.


Background & Summary

The data sets presented in this paper were essentially generated in the framework of a European research project entitled ‘EnviroGRIDS: Building Capacity for a Black Sea Catchment Observation and Assessment System supporting Sustainable Development’ that took place between 2009 and 2013 with the participation of more than one hundred scientists from thirty different partner institutions from fifteen countries 1 .

This project addressed the gap between scientific information available in the Black Sea catchment (BSC) and the environmental policy needs of the Commission for the Protection of the Black Sea against Pollution and the International Commission for the Protection of the Danube River 2 . The main aim of the project was to build capacity on new Earth Observation techniques and data sharing through web services as a European contribution to the Global Earth Observation System of Systems (GEOSS) 3 . In order to demonstrate the benefit of system interoperability and data sharing, the project developed a pipeline of analyses that produced many new and original data sets for the Black Sea (400,000 km 2 ) and its entire hydrological catchment (2.2 mio. km 2 ).

The enviroGRIDS project is rooted in and took its name from the intended use of computer grid technology to process large amount of environmental data through complex models 4 . This data processing followed a logical suit of analyses that is illustrated in Fig. 1.

The first part of the analyses aimed at setting the scene in terms of plausible climatic, demographic and landuse change scenarios for the entire BSC until 2050. Regionalized storylines were first developed to define four scenarios (BS-Hot, BS-Alone, BS-Coop, BS-Cool) according to their position on two axes of globalisation-regionalisation on the one hand, and liberalisation-policy control on the other hand. Climatic scenarios were derived from the Delta method in order to extrapolate temperature and precipitation according to different scenarios from the Intergovernmental Panel on Climate Changes (IPCC). Demographic scenarios were developed on the basis of the extrapolation census data by political units with urban and rural models 5 . Finally, landuse change was modelled with the Metronamica 6 software with an iterative yearly stochastic process taking into account the probability of change from one landuse to another and the accessibility by roads and trains 7 .

The second set of analyses is linked to hydrological models using the Soil and Water Assessment Tools (SWAT2009 ref. 8). This model was used to model and predict river flow and nutrient loads (NO3) into the Black Sea.

A third independent analysis was done on the outputs from the SWAT model that were used to assess agricultural water vulnerability 9 and blue water scarcity 10 .

Finally, beach erosion was modelled along the entire Black Sea coastline and across six countries by first digitizing manually every beach based on background satellite images, and then applying an ensemble of six erosion models on them 11 .

This coherent set of environment geospatial data sets on the BSC constitutes a regional contribution of the enviroGRIDS project to the GEOSS. These data sets and their corresponding metadata are made freely available (1) through direct download, (2) as web services, and (3) as map composition to ease visualisation on a GeoNode platform (http://blacksea.grid.unep.ch) that is a simple implementation of a typical Spatial Data Infrastructure 4 . Full copies of these data sets and metadata have been uploaded to Dryad (Data Citation 1).


Watch the video: SIG 2015 ArcGIS: Tuiles vectorielles