Re: [gdal-dev] Renaming a column's name in a Shapefile

2011-10-28 Thread Ralf Suhr
Hi António, one underscore was missing. ogrinfo print the needed words: Layer name: GPS_Project ele: Real (19.15) time: String (80.0) magvar: Real (19.15) geoidheigh: Real (19.15) name: String (80.0) cmt: String (80.0) desc_: String (80.0) src: String (80.0) -sql "SELECT el

Re: [gdal-dev] Renaming a column's name in a Shapefile

2011-10-28 Thread Chaitanya kumar CH
António, The field name 'desc' is one of the SQL keywords[1]. It needs to be quoted for OGR to process it. So the following command should work. ogr2ogr -f "esri shapefile" -sql "SELECT ele, time AS t, magvar,geoidheigh, name, cmt, 'desc', src FROM GPS_Project" new.shp GPS_Project.shp [1]: http:/

Re: [gdal-dev] Renaming a column's name in a Shapefile

2011-10-28 Thread António Rocha
Hi Ralf Thanks for the feedback but it did not work. I tried: ogr2ogr -f "esri shapefile" -sql "SELECT ele, time AS t, magvar,geoidheigh, name, cmt, desc, src FROM GPS_Project" new.shp GPS_Project.shp And I got: ERROR 1: SQL Expression Parsing Error: syntax error Even I tried: ogr2ogr -f "esri

Re: [gdal-dev] Renaming a column's name in a Shapefile

2011-10-28 Thread Ralf Suhr
ogr2ogr -f "esri shapefile" -sql "SELECT ele, time AS t, magvar, geoidheigh, name, cmt, desc, src FROM GPS_Project" new.shp GPS_Project.shp Gr Ralf On Freitag 28 Oktober 2011 13:54:37 António Rocha wrote: > ogr2ogr -sql "SELECT [ele AS ele, time AS t, magvar AS magvar, > geoidheigh AS geoidheig

Re: [gdal-dev] Renaming a column's name in a Shapefile

2011-10-28 Thread António Rocha
Hi I have tried qwhat you said: First: ogrinfo -al -so GPS_Project.shp INFO: Open of `GPS_Project.shp' using driver `ESRI Shapefile' successful. Layer name: GPS_Project Geometry: Point Feature Count: 135 Extent: (643712.710081, 7794078.321332) - (649554.409908, 7796057.897650) Layer SRS WKT:

Re: [gdal-dev] Renaming a column's name in a Shapefile

2011-10-26 Thread Chaitanya kumar CH
António, OGR comes as a part of GDAL. OGR utilities can be used like GDAL utilities. First, run ogrinfo on the shapefile with the options "-al" and "-so" to determine the field names in it. Next, use the ogr2ogr utility like this: ogr2ogr -sql "SELECT [field1a AS field1b, field2a AS field2b, fie

Re: [gdal-dev] Renaming a column's name in a Shapefile

2011-10-26 Thread Chaitanya kumar CH
António, The easiest way is to use the -sql option in ogr2ogr [1] and set a new name with the AS clause in the SQL statement [2]. [1]: http://www.gdal.org/ogr2ogr.html [2]: http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc 2011/10/26 António Rocha > Greetings > I have to shage a column name in a S

[gdal-dev] Renaming a column's name in a Shapefile

2011-10-26 Thread António Rocha
Greetings I have to shage a column name in a Shapefile. I'm not much familiar with OGR. How can I do that in OGR? THanks Best regards, Antonio __ Information from ESET NOD32 Antivirus, version of virus signature database 6574 (20111025) __ The message was checked by ESET NOD