Hi all,<br><br><br>I'm trying to set a value on an existing field and existing Shapefile with python-ogr but it doesn't seems to work.<br>Here is my works :<br><br>
-------------------------<br>import ogr<br>import math<br>import os<br><br>layerNameF = os.path.join("myShape.shp") <br>driver = ogr.GetDriverByName("ESRI Shapefile") <div id=":136" class="ii gt">
<br>Layer = driver.Open(layerNameF, True).GetLayer(0)<br>
<br>for i in range(Layer.GetFeatureCount()) :<br> feat = Layer.GetFeature(i) <br> u = feat.GetFieldAsDouble('u10m')<br> v = feat.GetFieldAsDouble('v10m') <br> vitesse = math.sqrt((u**2)+(v**2)) <br>
feat.SetField('wspeed',vitesse) <br> print type(feat.GetFieldAsDouble('wspeed'))<br> print feat.GetFieldAsDouble('wspeed')<br> feat.Destroy() <br><br>
-------------------------<br><br>the print feat.GetFieldAsDouble('wspeed') show me the good values. But when I open It again with Qgis or python the value is still 0.0.<br><br>Do you know what I'm doing wrong?<br>
<br>Thanks for any help<br><br><br>Regards<br><br>Arnaud</div>