<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi,<BR>
&nbsp;<BR>
I am trying to create a basic polygon shapefile using OGR in Python.<BR>
Any help with fixing my code is appreciated.&nbsp; Currently, it creates a shapefile, but nothing shows up in ArcGIS.<BR>
&nbsp;<BR>
<BR># GDAL<BR>from osgeo import ogr, gdal<BR>from osgeo.gdalconst import *<BR>
&nbsp;<BR># sample data<BR>data = [[3333317.0,5684892.0],[3333417.0,5684892.0],\<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [3333317.0,5684992.0],[3333417.0,5684992.0]]<BR>
&nbsp;<BR># Create Shapefile named "polygon.shp" for output<BR>driver = ogr.GetDriverByName('ESRI Shapefile')<BR>output = "polygon.shp"<BR>&nbsp;<BR>datasource = driver.CreateDataSource(output)<BR>layer = datasource.CreateLayer(output, geom_type=ogr.wkbPolygon)<BR>
&nbsp;<BR>feature = ogr.Feature(layer.GetLayerDefn())<BR>
wkt = "POLYGON(" + str(data[0][0]) + " " + str(data[0][1]) + "," + str(data[1][0]) + " " + str(data[1][1]) + "," + str(data[2][0]) + " " + str(data[2][1]) + "," + str(data[3][0]) + " " + str(data[3][1]) + ")"<BR>
<BR>polygon = ogr.CreateGeometryFromWkt(wkt)<BR>layer.CreateFeature(feature)<BR>
&nbsp;<BR># Clean up<BR>feature.Destroy()<BR>datasource.Destroy()<BR>&nbsp;<BR>print "Feature &lt;" + str(output) + "&gt; successfully created."<BR>del output<BR>
&nbsp;<BR>                                               <br /><hr />The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. <a href='http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4' target='_new'>Get busy.</a></body>
</html>