<div dir="ltr">A simple temporary fix is to use the -sql option and use the AS keyword to set the alias of the original field name into the truncated name.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sat, Mar 2, 2013 at 1:27 AM, Tamas Szekeres <span dir="ltr"><<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br><br><div class="gmail_quote">2013/3/1 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
</div>There's even a 4th option that doesn't require any code change. Create a OGR<br>
VRT file that renames the source fields to the truncated shapefile field names (or<br>
the reverse : creates a OGR VRT that renames the truncated shapefile field names<br>
to the original field names, since OGR VRT now supports since a few versions<br>
CreateFeature())<br>
</blockquote></div><div><br></div><div><br></div></div><div>This may probably work, but doesn't seem to be very user friendly. Actually I would prefer to include at least a flag to indicate that ogr2ogr should provide mapping the fields in the same order (don't lookup field index by name) for example:</div>
<div><br></div><div><span style="color:rgb(80,0,80);font-size:12.800000190734863px;font-family:arial,sans-serif">ogr2ogr -append -f "ESRI Shapefile" -nofieldreorder destination.shp [source]</span></div>
<div><span style="color:rgb(80,0,80);font-size:12.800000190734863px;font-family:arial,sans-serif"><br></span></div><div><span style="color:rgb(80,0,80);font-size:12.800000190734863px;font-family:arial,sans-serif">or with the previous fieldmap approach</span></div>
<div><span style="color:rgb(80,0,80);font-size:12.800000190734863px;font-family:arial,sans-serif"><br></span></div><div><span style="color:rgb(80,0,80);font-size:12.800000190734863px;font-family:arial,sans-serif">ogr2ogr -append -f "ESRI Shapefile" -fieldmap "default" destination.shp [source]</span></div>
<div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
<br>+91-9494447584<br>17.2416N 80.1426E
</div>