Pages

Tuesday 10 May 2011

WKT and ArcGrid

A couple of documentation updates from email this time.

CoordianteReferenceSystem and Formattable
The first is an example of how to take control over the generation of Well Known Text when describing a CoordinateRefererenceSystem; credit to aaime for the email/text:
CoordinateReferenceSystem crs = CRS.decode("EPSG:32735");
Formattable f = (Formattable) CRS.decode("EPSG:32735", true);
String wkt = f.toWKT(Citations.ESRI, 2);

ArcGrid
The second example comes from the user list and concerns the use of ArcGrid data (an ASCII format). The user guide did not have any specific code examples as this format is supported out of the box by GridFormatFinder:
File f = new File("ArcGrid.asc");
// Reading the coverage through a file
AbstractGridFormat format = GridFormatFinder.findFormat( f );
AbstractGridCoverage2DReader reader = format.getReader(f);

GridCoverage2D gc = reader.read(null);
I did dive into the test cases and actually found a wealth of additional capabilities reading from an ImageInputStream, InputStream, smooth handling of gzip, or just reading from a URL.

Documentation harmed in the making of this post:

No comments: