thank you Jody,
this was exactly what i want, i was a bit confused,
i also need it to produce SLD,
2007/7/4, Jody Garnett <[EMAIL PROTECTED]>:
There is a section on how to use Transformers in the GeoTools
documentation.
As I understand it a Transformer is a utility that goes through your
data structure ( a feature collection in this case) and issues SAX
events (as if a file was being parsed). Something on the other end takes
the events and writes out a new file, or builds up a DOM, or whatever ...
Here is the documentation:
http://docs.codehaus.org/display/GEOTDOC/03+XML+Transform
To answer your question a bit more directly - you need to provide some
additional information in order to have a valid GML document. GML only
defines some instructions on how to create an XML document for *your
application*. Your application will use its own XML Schema that extends
the GML schema in some way.
Our transformer will need to be told what your application schema is:
- tx.getFeatureTypeNamespaces().declareNamespace(ft,"wps",
ft.getNamespace().toASCIIString() );
Internally GeoTools uses CoordinateReferenceSystems to record what the
numbers mean; for a GML document they use a simple string called "SRS"
(ie Spatial Reference System).
-tx.setSrsName(ft.getDefaultGeometry
().getAuthority().getIdentifier().toString()
)
That line assumes that the identifier (something like "EPSG:4326" )
makes a good SRS. Only you know what your data is about - so you may
want to use something different?
Jody
> Hi,
>
> Can i generate a GML document from a Feature or Geometry with
> geotools? is there any example of this?
> I've been seen GeometryTransformer.GeometryTranslator buit i don't
> know what XMLSaxHandler pass...
>
> regards,
> ------------------------------------------------------------------------
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users