From: Alessio F. <ale...@gm...> - 2006-04-30 08:19:04
|
To render a GridCoverage you have to put a RasterSymbolizer in your Style otherwise the Renderer will not recognize it. Moreover you have to use a renderer (StreamingRenderer for instance) to paint the coverage (or feature= ) into the graphic object. Alessio. On 4/30/06, malesch <ma...@gm...> wrote: > > Hello GeoTools-Users > > I have a quite simple beginners problem. > > I create a GridCoverage2D object by accessing my GeoServer > running locally. The created Coverage actually contains something > useful, as I can see by calling the show()-method on it. > > I now want to add some feature and so I add it to a mapContext > and display it using a StyledMapPane: > > > -------------------------------------------------------------------------= -------------------- > [...] > gc.show(); // -> displays me the accessed geometries from GeoServer! :) > > StyleBuilder styleBuilder =3D new StyleBuilder(); > Style gcStyle =3D new BasicLineStyle(styleBuilder.createStroke(Color.BLAC= K > )); > MapContext mapContext =3D new DefaultMapContext(); > mapContext.addLayer(gc, gcStyle); > > final StyledMapPane mapPane =3D new StyledMapPane(); > mapPane.setMapContext(context); > mapPane.setPaintingWhileAdjusting(false); > mapPane.getRenderer().addLayer(new RenderedMapScale()); > > final JFrame frame =3D new JFrame(context.getTitle()); > frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > final Container container =3D frame.getContentPane(); > container.setLayout(new BorderLayout()); > container.add(mapPane.createScrollPane(), BorderLayout.CENTER); > container.add(new StatusBar(mapPane), BorderLayout.SOUTH); > frame.pack(); > frame.show(); > > -------------------------------------------------------------------------= -------------------- > > What I get finally is the displayed envelope (with the legend) where I > can pan, zoom and so on, but with an empty canvas...I see simpy > no geometries! > > Am I doing something wrong with the styles? Its strange that I can displa= y > the geometries of the GridCoverage (show()) but am not able to display > them in the MapContext. > > Thanks for any tipps or code snippets! > > PS: I can access maps and features using udig without any problem, just > to be sure, things are alright with the data sources. > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmdlnk&kid=120709&bid&3057&dat=121642 > _______________________________________________ > Geotools-gt2-users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- --------------------------------------------------------- Alessio Fabiani Software Engineer http://afabiani.wordpress.com --------------------------------------------------------- |