From: Jody G. <jga...@re...> - 2007-08-23 22:01:02
|
I am afraid I do not know much about raster support; I know it was slow in GeoTools 2.2 and I tell everyone to upgrade to 2.3 or better :-) So you are on the right track ... You can try contacting the module maintainer for the ArcGrid format (you can check in the pom.xml file in your source download). Are you sure your ArcGrid file has color? I would suspect that green was chosen as the default color and your arcgrid ascii file is single band? I think the mapping of data into colors is the work of a RasterSymbolizer (part of a Style) which you would have to supply. Looking at your example you *did* supply a raster symbolizer. Have you tried stepping through the code to see if your symbolizer is applied? I had a horrible time upgrading the uDig raster rendering code to GeoTools 2.4 (the "new" GridCoverageRenderer does not have good javadocs. I would check the @author tag on that file and start sending email). Simone, Martin, Andrea and Alessio are listed - these are the people best able to help. Jody > Dear Jody Garnett, > > I posted a message about my problem, but nobody answered. So, I am sending you a message about this issues. I believe that you might know about this matter. > > The following is the message I posted: > ---- > I used geotools 2.2.0 for rendering raster (ESRI ArcGrid Ascii file). > Now, I am upgrading to geotools 2.3.3 (or 2.3.4). Then, JMapPane > displays the raster with one color (green). I don't know what I am > doing wrong. The following is the code. Please help me out. > > > > mapPane = new JMapPane(); > > > GTRenderer renderer = new StreamingRenderer(); > > > > mapPane.setRenderer( renderer ); > > > mapPane.setSize( 400, 400 ); > > > // context = new DefaultMapContext( DefaultGeographicCRS.WGS84 ); > > > context = new DefaultMapContext(); > > > > setTitle( "raster test" ); > > > addWindowListener( new WindowAdapter() { > > > public void windowClosing( WindowEvent e ) > { > > > System.exit( 0 ); > > > } > > > } ); > > > > this.setBounds( 20, 20, 450, 450 ); > > > mapPane.setContext( context ); > > > getContentPane().add( mapPane ); > > > setVisible( true ); > > > > File f = new File( "D:\\works\\test.asc" ); > > > ArcGridReader reader = new ArcGridReader( f ); > > > > GridCoverage gcDem = reader.read( null ); > > > StyleBuilder sb = new StyleBuilder(); > > > > ColorMap cm = sb.createColorMap( new String[] { "0.5", > "0.7" }, new double[] { 0.5, 0.7 }, new Color[] { new Color( 255, 0, 0 > ), > > > new Color( 255, 255, 255 ) }, ColorMap.TYPE_RAMP ); > > > RasterSymbolizer rsDem = sb.createRasterSymbolizer( cm, 1 ); > > > Style demStyle = sb.createStyle( rsDem ); > > > > context.addLayer( gcDem, demStyle ); > > > > DirectPosition lowerCorner = gcDem.getEnvelope().getLowerCorner(); > > > DirectPosition upperCorner = gcDem.getEnvelope().getUpperCorner(); > > > Coordinate lowerCoord = new Coordinate( lowerCorner.getCoordinates()[0], lowerCorner.getCoordinates()[1] ); > > > Coordinate upperCoord = new Coordinate( upperCorner.getCoordinates()[0], upperCorner.getCoordinates()[1] ); > > > Envelope envelope = new Envelope( lowerCoord, upperCoord ); > > > > mapPane.setMapArea( envelope ); > > > mapPane.repaint(); > > > ---- > > Thank you for your help in advance. > > > > - Jong > > > > > |
From: Alessio F. <ale...@gm...> - 2007-08-24 08:14:08
|
Hi Gabriella, Simone is almost finishing a brand new RasterSymbolizer much more powerful than the actual implementation. It will allow you to assign colors to your custom categories, select color bands and more funcitonalities. So if you can wait some more few days, you can play with it very soon. For any further information on the RasterSymbolizer, at this time Simone is the best person who ask, I guess. On 8/24/07, Gabriella Turek <g....@ni...> wrote: > > The raster symbolizer is really a bear, I still don't think I have it > right. So more elucidations on this matter are always welcome :-) > gaby > > > > Looking at your example you *did* supply a raster symbolizer. Have you > > tried stepping through the code to see if your symbolizer is applied? I > > had a horrible time upgrading the uDig raster rendering code to GeoTools > > 2.4 (the "new" GridCoverageRenderer does not have good javadocs. > > > > I would check the @author tag on that file and start sending email). > > Simone, Martin, Andrea and Alessio are listed - these are the people > > best able to help. > > > > Jody > > > -- > *************************************************************** > ** Gabriella Turek g....@ni... ** > ** National Institute of Water & Atmospheric Research (NIWA) ** > ** PO Box 8602 Christchurch New Zealand +64-3-343-8067 ** > *************************************************************** > -- ------------------------------------------------------- Eng. Alessio Fabiani Vice-President /CTO GeoSolutions S.A.S. Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob: +39 349 8227000 http://www.geo-solutions.it ------------------------------------------------------- |
From: Jong L. <jon...@ya...> - 2007-08-24 18:06:21
|
Jody,=0A=0AThank you for your answer. I will contact some authors to find o= ut more...=0A=0A- Jong=0A=0A----- Original Message ----=0AFrom: Jody Garnet= t <jga...@re...>=0ATo: Jong Lee <jon...@ya...>; geotools-= users <geo...@li...>; Simone <sim...@gm...= m>; Martin Desruisseaux <mar...@ge...>; Andrea Aime <and= rea...@al...>; Alessio Fabiani <ale...@gm...>=0ASent= : Thursday, August 23, 2007 5:01:16 PM=0ASubject: Re: Geotools question abo= ut raster rendering=0A=0AI am afraid I do not know much about raster suppor= t; I know it was slow =0Ain GeoTools 2.2 and I tell everyone to upgrade to = 2.3 or better :-) So =0Ayou are on the right track ...=0A=0AYou can try con= tacting the module maintainer for the ArcGrid format (you =0Acan check in t= he pom.xml file in your source download).=0A=0AAre you sure your ArcGrid fi= le has color? I would suspect that green was =0Achosen as the default color= and your arcgrid ascii file is single band? =0AI think the mapping of data= into colors is the work of a =0ARasterSymbolizer (part of a Style) which y= ou would have to supply.=0A=0ALooking at your example you *did* supply a ra= ster symbolizer. Have you =0Atried stepping through the code to see if your= symbolizer is applied? I =0Ahad a horrible time upgrading the uDig raster = rendering code to GeoTools =0A2.4 (the "new" GridCoverageRenderer does not = have good javadocs.=0A=0AI would check the @author tag on that file and sta= rt sending email). =0ASimone, Martin, Andrea and Alessio are listed - these= are the people =0Abest able to help.=0A=0AJody=0A=0A> Dear Jody Garnett,= =0A>=0A> I posted a message about my problem, but nobody answered. So, I a= m sending you a message about this issues. I believe that you might know ab= out this matter.=0A>=0A> The following is the message I posted:=0A> ----=0A= > I used geotools 2.2.0 for rendering raster (ESRI ArcGrid Ascii file).=0A>= Now, I am upgrading to geotools 2.3.3 (or 2.3.4). Then, JMapPane=0A> disp= lays the raster with one color (green). I don't know what I am=0A> doing w= rong. The following is the code. Please help me out.=0A>=0A>=0A>=0A> = mapPane =3D new JMapPane();=0A>=0A>=0A> GTRenderer renderer =3D = new StreamingRenderer();=0A>=0A>=0A>=0A> mapPane.setRenderer( rende= rer );=0A>=0A>=0A> mapPane.setSize( 400, 400 );=0A>=0A>=0A> = // context =3D new DefaultMapContext( DefaultGeographicCRS.WGS84 );= =0A>=0A>=0A> context =3D new DefaultMapContext();=0A>=0A>=0A>=0A> = setTitle( "raster test" );=0A>=0A>=0A> addWindowListener( ne= w WindowAdapter() {=0A>=0A>=0A> public void windowClosing( Wind= owEvent e )=0A> {=0A>=0A>=0A> System.exit( 0 );= =0A>=0A>=0A> }=0A>=0A>=0A> } );=0A>=0A>=0A>=0A> = this.setBounds( 20, 20, 450, 450 );=0A>=0A>=0A> mapPane.setContext= ( context );=0A>=0A>=0A> getContentPane().add( mapPane );=0A>=0A>= =0A> setVisible( true );=0A>=0A>=0A>=0A> File f =3D new Fil= e( "D:\\works\\test.asc" );=0A>=0A>=0A> ArcGridReader reader =3D ne= w ArcGridReader( f );=0A>=0A>=0A>=0A> GridCoverage gcDem =3D reader= .read( null );=0A>=0A>=0A> StyleBuilder sb =3D new StyleBuilder();= =0A>=0A>=0A>=0A> ColorMap cm =3D sb.createColorMap( new String[] { = "0.5",=0A> "0.7" }, new double[] { 0.5, 0.7 }, new Color[] { new Color( 255= , 0, 0=0A> ),=0A>=0A>=0A> new Color( 255, 255, 255 ) }, Col= orMap.TYPE_RAMP );=0A>=0A>=0A> RasterSymbolizer rsDem =3D sb.create= RasterSymbolizer( cm, 1 );=0A>=0A>=0A> Style demStyle =3D sb.create= Style( rsDem );=0A>=0A>=0A>=0A> context.addLayer( gcDem, demStyle )= ;=0A>=0A>=0A>=0A> DirectPosition lowerCorner =3D gcDem.getEnvelope(= ).getLowerCorner();=0A>=0A>=0A> DirectPosition upperCorner =3D gcDe= m.getEnvelope().getUpperCorner();=0A>=0A>=0A> Coordinate lowerCoord= =3D new Coordinate( lowerCorner.getCoordinates()[0], lowerCorner.getCoordi= nates()[1] );=0A>=0A>=0A> Coordinate upperCoord =3D new Coordinate(= upperCorner.getCoordinates()[0], upperCorner.getCoordinates()[1] );=0A>=0A= >=0A> Envelope envelope =3D new Envelope( lowerCoord, upperCoord );= =0A>=0A>=0A>=0A> mapPane.setMapArea( envelope );=0A>=0A>=0A> = mapPane.repaint();=0A>=0A>=0A> ----=0A>=0A> Thank you for your help in ad= vance.=0A>=0A>=0A>=0A> - Jong=0A>=0A>=0A>=0A>=0A> =0A=0A=0A=0A |
From: Gabriella T. <g....@ni...> - 2007-08-23 22:54:01
|
The raster symbolizer is really a bear, I still don't think I have it right. So more elucidations on this matter are always welcome :-) gaby > Looking at your example you *did* supply a raster symbolizer. Have you > tried stepping through the code to see if your symbolizer is applied? I > had a horrible time upgrading the uDig raster rendering code to GeoTools > 2.4 (the "new" GridCoverageRenderer does not have good javadocs. > > I would check the @author tag on that file and start sending email). > Simone, Martin, Andrea and Alessio are listed - these are the people > best able to help. > > Jody -- *************************************************************** ** Gabriella Turek g....@ni... ** ** National Institute of Water & Atmospheric Research (NIWA) ** ** PO Box 8602 Christchurch New Zealand +64-3-343-8067 ** *************************************************************** |
From: Jody G. <jga...@re...> - 2007-08-24 16:15:16
|
Alessio Fabiani wrote: > Hi Gabriella, > Simone is almost finishing a brand new RasterSymbolizer much more > powerful than the actual implementation. It will allow you to assign > colors to your custom categories, select color bands and more > funcitonalities. > So if you can wait some more few days, you can play with it very soon. > For any further information on the RasterSymbolizer, at this time > Simone is the best person who ask, I guess. I did not know that work was going on ... is their any overlap with the categorization work done by Cory for Feature data? The concept of categories is represented there and used to generate SLD files. I also wonder if this is just a new RasterSymbolizer implementation - or if the SLD standard is consulted at all? |
From: linsco <lac...@ho...> - 2007-09-26 13:03:34
|
Hello, The troubles of ArcGridReader to render properly ASCII ArcGrid File come from the way it get the nodata value from the ascii file. I believe that th= e actual "no data" value (for instance) is never used in the resulting GridCoverage. It would be a good idea to review the code to settle that onc= e for all. Moreover, the RasterSymblolizerSupport need also an improvement. That class seem knowing nothing about org.geotools.styling.ColorMap. It is using a java.util.Map as ColorMap instead of the one provided in the Style. So The ColorMap in RasterSymbolizer does not affect layers styling just because the StreamingRenderer is using this RasterSymbolizerSupport via GridCoverageRenderer. Best Regards. C=C3=B4me LINSOUSSI. Jody Garnett wrote: >=20 > Alessio Fabiani wrote: >> Hi Gabriella, >> Simone is almost finishing a brand new RasterSymbolizer much more=20 >> powerful than the actual implementation. It will allow you to assign=20 >> colors to your custom categories, select color bands and more=20 >> funcitonalities. >> So if you can wait some more few days, you can play with it very soon.= =20 >> For any further information on the RasterSymbolizer, at this time=20 >> Simone is the best person who ask, I guess. > I did not know that work was going on ... is their any overlap with the= =20 > categorization work done by Cory for Feature data? The concept of=20 > categories is represented there and used to generate SLD files. > I also wonder if this is just a new RasterSymbolizer implementation - or= =20 > if the SLD standard is consulted at all? >=20 > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Geotools-gt2-users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >=20 >=20 --=20 View this message in context: http://www.nabble.com/Re%3A-Geotools-question= -about-raster-rendering-tf4320351.html#a12900523 Sent from the geotools-gt2-users mailing list archive at Nabble.com. |