[FWTools] Fw: ogr2ogr -f "CSV" fileout filein.gml -select ...

E.Stefanakis eipd at otenet.gr
Tue Nov 6 12:07:58 EST 2007


I tried the command

ogr2ogr -f CSV out.csv in.gml -sql 'select *,OGR_GEOM_WKT from srclayername'

where 'srclayername' the name of the layer in GML

however I got the following error message:

*** layer names ignored in combination with -sql.
*** Error 1: SQL: Missing FROM clause in SELECT statement



----- Original Message ----- 
From: "Frank Warmerdam" <warmerdam at pobox.com>
To: "E.Stefanakis" <eipd at otenet.gr>
Cc: <fwtools at lists.maptools.org>
Sent: Tuesday, November 06, 2007 6:02 PM
Subject: Re: [FWTools] Fw: ogr2ogr -f "CSV" fileout filein.gml -select ...


> E.Stefanakis wrote:
>> Hello
>>  I wish to include in the reported items (-select item_list) the geometry
>> as given in GML 
>> <gml:geometryProperty><gml:geometryType:Point><gml:coordinates>x,y...</....></...>
>>  is this possible under the command
>>  ogr2ogr -f "CSV" fileout filein.gml -select ...
>
> Emmanuel,
>
> This is not supported with ogr2ogr, though in theory you could write a
> script that would turn the geometry back into GML and writing it in a
> file.  However, it wouldn't generally be the exact original GML since it
> would have been converted to an OGRGeometry internally and then turned 
> back.
>
> What you can do with ogr2ogr is write the geometry as a string attribute
> in WKT format.
>
> eg.
>
> ogr2ogr -f CSV out.csv in.gml -sql 'select *,OGR_GEOM_WKT from 
> srclayername'
>
> Best regards,
> -- 
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam, 
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | President OSGeo, http://osgeo.org
>
> 



More information about the FWTools mailing list