<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 class="im"><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>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-family:arial,sans-serif;font-size:12.800000190734863px;background-color:rgb(255,255,255)">ogr2ogr -append -f "ESRI Shapefile" -nofieldreorder destination.shp  [source]</span></div>
<div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.800000190734863px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.800000190734863px;background-color:rgb(255,255,255)">or with the previous fieldmap approach</span></div>
<div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.800000190734863px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.800000190734863px;background-color:rgb(255,255,255)">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>