[Geoserver-users] converting postgis geometry to gml 2.1.2 geometry ?


Hi,

How can i convert a postgis geometry object e.g a linestring to its gml 2.1.2 replica. I need to this to the result of a pgrouting query so i can use geoserver’s inline feature request to request a wms base road map and render a route (the gml linestring) with its own sld on it.

Also, how does geoserver do this ? I am curious ?

Thanks,

Roman

Roman Isitua ha scritto:

Hi,
How can i convert a postgis geometry object e.g a linestring to its gml 2.1.2 replica. I need to this to the result of a pgrouting query so i can use geoserver's inline feature request to request a wms base road map and render a route (the gml linestring) with its own sld on it.

Hummm... maybe have a look at the postgis supported function, it
may have what you need. Otherwise you can use ogr2ogr.

Also, how does geoserver do this ? I am curious ?

You can use the GeoTools GeometryTransformer to turn a JTS geometry
into GML2, and use the Postgis data store to actually read the
geometry out of postgis into a JTS object (well, actually into a
GeoTools features, from where you'll extract the geometry attribute
which is a jts geometry).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.