WFS does not include any style information. If you want to use the style you defined for MapServer than you should access it as WMS.

Chris

Frederico wrote:
Hi, im using the WFSDataStore with MapServer( gt 2.2RC3 ) and i saw that i "have" to give the style to paint the Feature. - Why we have to put a style if we already said to MapServer (or geoserver) how to paint that feature? - Is there a way to add the layer direct from the MapServer, without creating a new style. Thx, Fred. here is the code: ... JMapPane mp = new JMapPane();

 ...

URL url = new URL("http://www.opengeo.com.br:8082/geoserver/wfs/GetCapabilities";);

HashMap m = new HashMap();

m.put( WFSDataStoreFactory./URL/.key, url );

m.put( WFSDataStoreFactory./TIMEOUT/.key, *new* Integer( 10000 ) )

DataStore wfs = (new WFSDataStoreFactory()).createDataStore(m);

Query query = *new* DefaultQuery( wfs.getTypeNames()[1] ); // i need only the first element returned by the MapServer

FeatureReader ft = wfs.getFeatureReader( query, Transaction.AUTO_COMMIT );
   FeatureCollection fc = FeatureCollections.newCollection();
   try
   {
        int count = 0;
        while( ft.hasNext() )
        {
             fc.add( ft.next() );
             count++;
        }
        System.out.println( "Found " + count + " features" );
   }

...

style = builder.createStyle( builder.createLineSymbolizer( Color./BLUE/, 1 ) ); /// WHY???????

...

MapContext context = *new* DefaultMapContext();

context.addLayer( fs, style );

context.getLayerBounds();

mp.setHighlightLayer( context.getLayer( 0 ) );

GTRenderer renderer = *new* StreamingRenderer();

mp.setRenderer( renderer );

mp.setContext( context );

...

!DSPAM:1003,44d23e3f104541116498154!


------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

!DSPAM:1003,44d23e3f104541116498154!


------------------------------------------------------------------------

_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


!DSPAM:1003,44d23e3f104541116498154!

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org
begin:vcard
fn:Chris Holmes
n:Holmes;Chris
org:The Open Planning Project
adr:;;377 Broadway, 11th Floor;New York;NY;10013;USA
email;internet:[EMAIL PROTECTED]
title:VP, Strategic Development
x-mozilla-html:FALSE
url:http://topp.openplans.org
version:2.1
end:vcard

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to