Dear all,<br><br>I try to read fire polygon shapefile by ogr (beginner level), I referred to some sources online:<br><a href="http://geoinformaticstutorial.blogspot.fr/2012/10/accessing-vertices-from-polygon-with.html">http://geoinformaticstutorial.blogspot.fr/2012/10/accessing-vertices-from-polygon-with.html</a><br>
<a href="http://gis.stackexchange.com/questions/8144/get-all-vertices-of-a-polygon-using-ogr-and-python">http://gis.stackexchange.com/questions/8144/get-all-vertices-of-a-polygon-using-ogr-and-python</a><br><br>However, both the links are incomplete as I have polygons who have more than one linearring objects, which <br>
fianally turns out to have hole inside the polygon.<br><br>But I have another strange issue, is that there are some polygons with more than one linearring object,<br>but all the rings have zero points. However, the fire size of the polygon is not zero, and when I checked <br>
the same polygon in ArcGIS, there is really a shape! could anyone point out I miss something?<br>thanks!!<br><br><div class="input hbox"><div class="prompt input_prompt">In [28]:</div><div class="input_area box-flex1"><div class="CodeMirror">
<div style="overflow:hidden;width:3px;height:0px"><textarea style="padding:0px;width:1px;height:1em"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="height:64.8px"><div style><div class="CodeMirror-lines">
<div style="outline:medium none"><div style="width:100%;height:0;overflow:hidden;outline:5px auto none"><pre><span class="cm-variable"></span><span id="CodeMirror-temp-d55822"></span></pre></div><div style><pre><span class="cm-variable">feature</span> = <span class="cm-variable">layer.GetFeature</span>(<span class="cm-number">276</span>)</pre>
<pre><span class="cm-variable">geo</span> = <span class="cm-variable">feature.GetGeometryRef</span>()</pre><pre><span class="cm-variable">geo.GetGeometryCount</span>()</pre></div></div></div></div></div></div></div></div>
</div><div style="display:-moz-box" class="output vbox"><div class="hbox output_area"><div class="prompt output_prompt">Out[28]:</div><div class="box-flex1 output_subarea output_text"><pre>2<br><br></pre><div class="input hbox">
<div class="prompt input_prompt">In [29]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow:hidden;width:3px;height:0px"><textarea style="padding:0;width:1px;height:1em"></textarea></div>
<div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="height:47.2px"><div style><div class="CodeMirror-lines"><div style="outline:medium none"><div style="width:100%;height:0;overflow:hidden;outline:5px auto none">
<pre><span class="cm-variable"></span><span id="CodeMirror-temp-66874"></span></pre></div><div style><pre><span class="cm-variable">ring</span> = <span class="cm-variable">geo.GetGeometryRef</span>(<span class="cm-number">0</span>)</pre>
<pre><span class="cm-variable">ring.GetPointCount</span>()</pre></div></div></div></div></div></div></div></div></div><div style="display:-moz-box" class="output vbox"><div class="hbox output_area"><div class="prompt output_prompt">
Out[29]:</div><div class="box-flex1 output_subarea output_text"><pre>0<br><br></pre><div class="input hbox"><div class="prompt input_prompt">In [31]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow:hidden;width:3px;height:0px">
<textarea style="padding:0;width:1px;height:1em"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="height:47.2px"><div style><div class="CodeMirror-lines"><div style="outline:medium none">
<div style="width:100%;height:0;overflow:hidden;outline:5px auto none"><pre><span class="cm-variable"></span><span class="cm-variable"></span><span class="cm-number"></span><span id="CodeMirror-temp-8129e7"></span></pre></div>
<div style><pre><span class="cm-variable">ring</span> = <span class="cm-variable">geo.GetGeometryRef</span>(<span class="cm-number">1</span>)</pre><pre><span class="cm-variable">ring.GetPointCount</span>()</pre></div></div>
</div></div></div></div></div></div></div><div style="display:-moz-box" class="output vbox"><div class="hbox output_area"><div class="prompt output_prompt">Out[31]:</div><div class="box-flex1 output_subarea output_text"><pre>
0<br><br></pre><div class="input hbox"><div class="prompt input_prompt">In [34]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow:hidden;width:3px;height:0px"><textarea style="padding:0;width:1px;height:1em"></textarea></div>
<div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="height:29.6px"><div style><div class="CodeMirror-lines"><div style="outline:medium none"><div style="width:100%;height:0;overflow:hidden;outline:5px auto none">
<pre><span class="cm-variable"></span><span id="CodeMirror-temp-b9b96d"></span></pre></div><div style><pre><span class="cm-variable">feature.items</span>()[<span class="cm-string">'SIZE_HA'</span>]</pre></div></div>
</div></div></div></div></div></div></div><div style="display:-moz-box" class="output vbox"><div class="hbox output_area"><div class="prompt output_prompt">Out[34]:</div><div class="box-flex1 output_subarea output_text"><pre>
13041.187<br><br></pre></div></div></div></div></div></div></div></div></div></div></div></div> <br clear="all">Chao<br>-- <br><div>***********************************************************************************</div>
<div>Chao YUE<br>Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)<br>UMR 1572 CEA-CNRS-UVSQ<br>Batiment 712 - Pe 119<br>91191 GIF Sur YVETTE Cedex</div>
<div>Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16<br></div>
<div>************************************************************************************</div>