Thank you guys for the correction. <br>It seems I have copied an old polygon definition in my previous email (in my last script, I have changed odd &#39;,&#39; with &#39; &#39; to set couples). The issue was that I missed double brackets. However, the importFromWkt didn&#39;t work (Being undefined in the python bindings, I guess). <br>
Before sending the email, I had tried ogr.CreateGeometryFromWkt(wkt) as suggested by Even, but having
missformed WKT (single brackets), it gave me ERROR 5: OGR Error:
Corrupt data. Now my problem have been solved. Thank you all.<br><br>Best Regards,<br>Daniele<br><br><br><div class="gmail_quote">On Wed, Dec 16, 2009 at 7:43 PM, Frank Warmerdam <span dir="ltr">&lt;<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">Daniele Romagnoli wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi list,<br>
I&#39;m creating a shapefile using the OGR python bindings. (from  the 1.6.1 installer)<br>
I have some issues in creating the boundingBox for it.<br>
This is a snippet of the code I&#39;m using:<br>
-----------------------------------------------------<br>
from osgeo import ogr<br>
from osgeo import osr<br>
....<br>
....<br>
northings_llc = dd[&#39;northings_llc&#39;]<br>
northings_urc = dd[&#39;northings_urc&#39;]<br>
eastings_llc = dd[&#39;eastings_llc&#39;]<br>
eastings_urc = dd[&#39;eastings_urc&#39;]<br>
t_srs = osr.SpatialReference()<br>
t_srs.SetFromUserInput(&#39;EPSG:32632&#39;)<br>
drv = ogr.GetDriverByName(&#39;ESRI Shapefile&#39;)<br>
ds = drv.CreateDataSource(fileout)<br>
x0, y0, x1, y1 = str(eastings_llc[0][0]), str(northings_llc[0][0]), str(eastings_urc[0][0]), str(northings_urc[0][0])<br>
<br>
layer = ds.CreateLayer(ds.GetName(), geom_type = ogr.wkbPolygon, srs = t_srs)<br>
geom = ogr.Geometry(type = layer.GetLayerDefn().GetGeomType())<br>
geom.AssignSpatialReference(t_srs)<br>
wkt = &#39;POLYGON(&#39;+x0+&#39;,&#39;+y0+&#39;,&#39;+ x0+&#39;,&#39;+ y1+&#39;,&#39;+ x1+&#39;,&#39; +y1+&#39;,&#39;+ x1+&#39;,&#39; +y0+&#39;,&#39;+ x0+&#39;,&#39; +y0+&#39;)&#39;<br>
</blockquote>
<br></div>
Daniele,<br>
<br>
You are not formatting your WKT right. There should be spaces between<br>
x and y.  The commas are only between tuples.<br>
<br>
eg.<br>
<br>
POLYGON ((479819.84375 4765180.5,479690.1875 4765259.5,...<br>
<br>
Best regards,<br><font color="#888888">
-- <br>
---------------------------------------+--------------------------------------<br>
I set the clouds in motion - turn up   | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
and watch the world go round - Rush    | Geospatial Programmer for Rent</font><div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-------------------------------------------------------<br>Eng. Daniele Romagnoli <br>Software Engineer<br><br>GeoSolutions S.A.S.<br>Via Carignoni 51<br>55041 Camaiore (LU)<br>
Italy<br><br>phone: +39 0584983027<br>fax:     +39 0584983027<br>mob:   +39 328 0559267<br><br><br><a href="http://www.geo-solutions.it">http://www.geo-solutions.it</a><br><br>-------------------------------------------------------<br>
<br>