<html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"></head><body><div><div style="font-family:Calibri,sans-serif;font-size:11pt">If your going to do some OGR Python stuff, check out Fiona <a href="http://pypi.python.org/pypi/Fiona/0.8">http://pypi.python.org/pypi/Fiona/0.8</a> which is pretty nice API for working with OGR in Python.<br>
<br>- Nathan<br></div></div><hr><span style="font-family:Tahoma,sans-serif;font-size:10pt;font-weight:bold">From: </span><span style="font-family:Tahoma,sans-serif;font-size:10pt">Tyler Mitchell</span><br><span style="font-family:Tahoma,sans-serif;font-size:10pt;font-weight:bold">Sent: </span><span style="font-family:Tahoma,sans-serif;font-size:10pt">19/03/2012 3:31 PM</span><br>
<span style="font-family:Tahoma,sans-serif;font-size:10pt;font-weight:bold">To: </span><span style="font-family:Tahoma,sans-serif;font-size:10pt">OSGeo Discussions</span><br><span style="font-family:Tahoma,sans-serif;font-size:10pt;font-weight:bold">Subject: </span><span style="font-family:Tahoma,sans-serif;font-size:10pt">Re: [OSGeo-Discuss] Need for to to convert/deconstruct a shapefile to create a relational table</span><br>
<br></body></html><html><head></head><body style="word-wrap:break-word"><br><div><div>On 2012-03-18, at 6:46 PM, Stephen Woodbridge wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">Does this get you any closer to what you need:<br>
<br>SELECT OGR_GEOM_WKT, * FROM data;<br><br>-Steve</span></blockquote></div><br><div>That's some nice ogr-foo to learn :)</div><div><br></div><div>Simon, it sounds like you could wrap this up pretty quickly in a python script too.</div>
<div>A rough approach example:</div><div><br></div><div><div>from osgeo import ogr</div><div>ds = ogr.Open("/tmp/on_geoname.shp")</div><div>l1 = ds.GetLayerByIndex(0)</div><div>for f in range(l1.GetFeatureCount()):</div>
<div> printme = []</div><div> g1 = l1.GetFeature(f)</div><div> for fld in range(g1.GetFieldCount()):</div><div>  printme.append(g1.GetFieldAsString(fld))</div><div> gr1 = g1.GetGeometryRef()</div><div> printme.append(str(gr1.GetX()) + "-" + str(gr1.GetY()))</div>
<div> print printme</div></div><div><br></div><div>For what it's worth,</div><div>Tyler</div><div><br></div></body></html>