Where your geometries come from? Are they in some kind of spatial storage like 
a shapefile, Oracle Spatial, PostGIS, etc?

The way to obtain the featurecollection from your storage medium is to use a 
DataStore (think of it as the JDBC driver for your database, but in GIS)
So, depending on where your features are, you have to use one or another. 
There are plenty of them on geotools and hopefully you'll find one 
appropriate.

Read the following section on the user guide on how to use DataStores:
http://docs.codehaus.org/display/GEOTOOLS/Data+Reading

You may find a couple API differencies depending on if you're using version 
2.2 or 2.3+

I can't remember if DefaultMapLayer expects a FeatureResults or a 
FeatureCollection, but anyways you can get the FeatureCollection from the 
FeatureResults.getFeatures()

regards,

Gabriel

PS: I could have written something wrong, since I'm writing from the top of my 
head, but I guess you'll easily find the way through the user docs pointed 
out above.

On Wednesday 11 October 2006 10:51, Jan Gregor wrote:
> Hi,
>
>  I want to export my geometries that are located outside datasource to
> svg format.
> In geotools is class org.geotools.svg.GenerateSVG and method go to do
> that, but i don't know how to put features in DefaultMapLayer.
>
> this link could help, but i can't find class PFeatureCollection :
> http://docs.codehaus.org/display/GEOTOOLS/How+to+create+a+simple+FeatureCol
>lection+from+Scratch?showComments=false
>
> my target is to put polygons in svg, each with different color. so
> just geometries. any help would be welcomed.
>
> thanks,
> Jan
>
>
>         GenerateSVG genSVG = new GenerateSVG();
>
>         MapLayer[] layers = new DefaultMapLayer[1];
>         layers[0] = new DefaultMapLayer(features, new BasicPolygonStyle());
>
>         MapContext mapContext = new DefaultMapContext(layers);
>         Envelope envelope = new Envelope();
>
>         FileOutputStream fout = new FileOutputStream("c:/pokus.svg");
>         genSVG.go(mapContext, envelope, fout);
>
> -------------------------------------------------------------------------
> 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
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

-- 
Gabriel Roldán ([EMAIL PROTECTED])
Axios Engineering (http://www.axios.es)
Tel. +34 944 41 63 84
Fax. +34 944 41 64 90

-------------------------------------------------------------------------
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 Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to