[gdal-dev] Renaming a column's name in a Shapefile
Chaitanya kumar CH
chaitanya.ch at gmail.com
Wed Oct 26 07:46:57 EDT 2011
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, field 3a AS
field3b] FROM shapefileA" shapefileB.shp shapefileA.shp
This command changes the fields field1a, field2a and field3a in the original
shapefile, shapefileA.shp, to field1b, field2b and field3b respectively in
the new shapefile, shapefile.shp.
2011/10/26 António Rocha <antonio.rocha at deimos.com.pt>
> Hi
> THanks for the feedback. I'm a bit lost on this. Is there any examples and
> tutorials on using sql commands for OGR? I'm sorry but I'm not use to use
> Vectorial data and neither OGR (only GDAL)
> Thanks
> Antonio
> Chaitanya kumar CH wrote:
>
>> 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<http://www.gdal.org/ogr2ogr.html>
>> [2]: http://trac.osgeo.org/gdal/**wiki/rfc28_sqlfunc<http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc>
>>
>> 2011/10/26 António Rocha <antonio.rocha at deimos.com.pt <mailto:
>> antonio.rocha at deimos.**com.pt <antonio.rocha at deimos.com.pt>>>
>>
>>
>> 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 NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>> ______________________________**_________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.**org<gdal-dev at lists.osgeo.org>
>> >
>>
>> http://lists.osgeo.org/**mailman/listinfo/gdal-dev<http://lists.osgeo.org/mailman/listinfo/gdal-dev>
>>
>>
>>
>>
>> --
>> Best regards,
>> Chaitanya kumar CH.
>>
>> +91-9494447584
>> 17.2416N 80.1426E
>>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 6575 (20111026) __________
>
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
--
Best regards,
Chaitanya kumar CH.
+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111026/f0fb9fcf/attachment.html
More information about the gdal-dev
mailing list