From: Rueben S. <r_j...@ya...> - 2005-03-09 06:43:17
|
Hi, There is also a WorldImage (and Geotiff) GridCoverageExchange (GCE) implementation that should load your image and create a grid coverage from it. For information about how to use it see: http://docs.codehaus.org/display/GEOTOOLS/Using+Grid+Coverage+Exchange The WorldImageReader is similar to the ArcGridReader demoed here, but I do not think it has any parameters to set. The GCE is used to load and display an image in two of the demos in svn, but they are currently broken. As Martin mentioned, the codebase is in transition. Unfortunately raster data access was not part of the stable 2.0 release, so you may want to wait until the current transition in the codebase is finished and released in geotools 2.1 (hopefully about a month). Rueben On Tue, 2005-08-03 at 22:32 +1100, Martin Desruisseaux wrote: > toddfx a écrit : > > So I'm wondering if anyone has a small code snippet that shows how to > > load georeferenced image files (jpg with worldfile or geotiff). An > > example of creating a layer and drawing a polygon on it would be great > > too. > > For loading a georeferenced image ("GridCoverage" in OpenGIS terms), you > catch us in a transition phase. You can use some classes right now, but > before it is worth to know the following: > > - org.geotools.gc contains a legacy implementation of GridCoverage. > This implementation was built on top of old standards (the > standards changed; not our fault!). > > - org.geotools.coverage.grid contains a partial port of GridCoverage > to new standards. It is partial only because it take in account the > ISO 19111 standard only (Coordinate Reference System). The > ISO 19123 standard (Grid Coverage itself) will be taken in account > later, in a second phase. > > > So you catch us right in a transition phase. > > How to built a GridCoverage. Step to follows: > > 1) Load yours image using the standard ImageIO API bundle in J2SE 1.4. > > 2) The hard part: Gets the envelope (the "real world" coordinate of the > bounding box of yours image) and the CRS (Coordinate Reference > System) of yours image. If those informations are bundle in a .prj > file, I don't know how hard it is to read it. Someone (Simone) is > just about to commit some code for reading .prj files, but it is > not done yet. In a first approach (for testing purpose), it may be > easier to hard code yours Envelope and CRS. > > 3) Construct a org.geotools.coverage.grid.GridCoverage2D object with > the image, the envelope and the CRS in arguments. A part that is a > little bit difficult to explain is the SampleDimension argument. > Basically, a SampleDimension is a band. Except that SampleDimension > is not that much about the color; it is more about the *meaning* of > pixel values. For example for a Digital Elevation Model, it may be > the height in meters. > > 4) Do some tests with GridCoverage2D.evaluate methods in order to see > if you gets the expected values. > > Next step will be to display the image. More on this topic tomorrow (the > J2D-renderer has not yet been ported to new CRS and GridCoverage API, > and the port will be quite long. But I will try to commit some bridges > as temporary patchs tomorrow). > > Martin. > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_ide95&alloc_id396&op=click > _______________________________________________ > Geotools-gt2-users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users |