[postgis-users] PostGIS and GML

Silke Reimer Silke.Reimer at intevation.de
Wed Feb 23 09:04:42 PST 2005


On Wed, Feb 23, 2005 at 02:08:02PM +0100, TECHER Jean David wrote:
> Hi 
> 
> I tried to export PostGIS data to GML using (ogr2ogr with support for GML (only version 2.0 is supported from this tool))
> ad AsGML function from postgis...
> 
> example:
> 
> ogr2ogr -f GML building.gml PG:dbname=madatabase -sql "SELECT id,data,asgml(the_geom) FROM  buildings"
> 
> then do few replacements in buildings.gml using cat/sed (cut
> '<asgml' , '</asgml>' and son on..;)
> 
> This method is no very nice ...Did someone have a better idea to
> export from PostGIS => GML
> 
> or does exist tools for that???

I would still try to use ogr2ogr for your needs. With your ogr2ogr
command you are converting the data to gml twice: once by postgis
and again by ogr2ogr. Hence ogr does not recognize the geometry as
geometry data any more but only as a text field. If you don't use
the asgml-function any more it should work:

ogr2ogr -f GML building.gml PG:dbname=madatabase -sql "SELECT id,data,the_geom from buildings"

or even
ogr2ogr -f GML building.gml PG:dbname=madatabase -sql "SELECT * from buildings"

Many greetings,
	Silke


-- 
Intevation GmbH

Georgstrasse 4                    49074 Osnabrück, Germany
http://intevation.de              http://intevation.de/~silke
FreeGIS.org                       http://freegis.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050223/afc63669/attachment.pgp>


More information about the postgis-users mailing list