António,<br><br>OGR comes as a part of GDAL. OGR utilities can be used like GDAL utilities.<br><br>First, run ogrinfo on the shapefile with the options "-al" and "-so" to determine the field names in it.<br>
<br>Next, use the ogr2ogr utility like this:<br><span style="font-family: courier new,monospace;">ogr2ogr -sql "SELECT [field1a AS field1b, field2a AS field2b, field 3a AS field3b] FROM shapefileA" shapefileB.shp shapefileA.shp</span><br style="font-family: courier new,monospace;">
<br>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.<br><br><div class="gmail_quote">
2011/10/26 António Rocha <span dir="ltr"><<a href="mailto:antonio.rocha@deimos.com.pt">antonio.rocha@deimos.com.pt</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi<br>
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)<br>
Thanks<br>
Antonio<br>
Chaitanya kumar CH wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
António,<br>
<br>
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].<br>
<br>
[1]: <a href="http://www.gdal.org/ogr2ogr.html" target="_blank">http://www.gdal.org/ogr2ogr.<u></u>html</a><br>
[2]: <a href="http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc" target="_blank">http://trac.osgeo.org/gdal/<u></u>wiki/rfc28_sqlfunc</a><br>
<br></div>
2011/10/26 António Rocha <<a href="mailto:antonio.rocha@deimos.com.pt" target="_blank">antonio.rocha@deimos.com.pt</a> <mailto:<a href="mailto:antonio.rocha@deimos.com.pt" target="_blank">antonio.rocha@deimos.<u></u>com.pt</a>>><div class="im">
<br>
<br>
Greetings<br>
I have to shage a column name in a Shapefile. I'm not much<br>
familiar with OGR. How can I do that in OGR?<br>
THanks<br>
Best regards,<br>
Antonio<br>
<br>
<br>
<br>
__________ Information from ESET NOD32 Antivirus, version of virus<br>
signature database 6574 (20111025) __________<br>
<br>
The message was checked by ESET NOD32 Antivirus.<br>
<br>
<a href="http://www.eset.com" target="_blank">http://www.eset.com</a><br>
<br>
<br>
______________________________<u></u>_________________<br>
gdal-dev mailing list<br></div>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a> <mailto:<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.<u></u>org</a>><div class="im"><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/gdal-dev</a><br>
<br>
<br>
<br>
<br>
-- <br>
Best regards,<br>
Chaitanya kumar CH.<br>
<br>
<a href="tel:%2B91-9494447584" value="+919494447584" target="_blank">+91-9494447584</a><br>
17.2416N 80.1426E<br>
</div></blockquote>
<br>
<br>
<br>
__________ Information from ESET NOD32 Antivirus, version of virus signature database 6575 (20111026) __________<div><div></div><div class="h5"><br>
<br>
The message was checked by ESET NOD32 Antivirus.<br>
<br>
<a href="http://www.eset.com" target="_blank">http://www.eset.com</a><br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>