<div dir="ltr"><div class="gmail-post-text">

<p>Dear all,<br></p><p>I have a kml file which is like a zip kml file available in here (<a href="https://www.eorc.jaxa.jp/ALOS-2/obs/map/world_asc/kml/A_Cycle06.kml" rel="nofollow noreferrer">https://www.eorc.jaxa.jp/ALOS-2/obs/map/world_asc/kml/A_Cycle06.kml</a>)
 which has several satellite polygon footprint for Alos/Palsar images. I am in need to
 convert all these files from KML to SHAPEFILE, saving the SHP files using 
the layer ID.</p>

<p>I am trying to use the piece of code bellow (PyQGIS), but I do not 
know how to unzip this kml and save the shapefiles using the layer ID 
information</p>

<pre class="gmail-default gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pln">vlayer </span><span class="gmail-pun">=</span><span class="gmail-pln"> </span><span class="gmail-typ">QgsVectorLayer</span><span class="gmail-pun">(</span><span class="gmail-str">"D:/KML-Images/A_Cycle06.kml"</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-str">"line"</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-str">"ogr"</span><span class="gmail-pun">)</span><span class="gmail-pln">

writer </span><span class="gmail-pun">=</span><span class="gmail-pln"> </span><span class="gmail-typ">QgsVectorFileWriter</span><span class="gmail-pun">.</span><span class="gmail-pln">writeAsVectorFormat</span><span class="gmail-pun">(</span><span class="gmail-pln">vlayer</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-str">"D:/KML-Images/<layer ID>.shp"</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-str">"utf-8"</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-kwd">None</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-str">"ESRI Shapefile"</span><span class="gmail-pun">)</span></code></pre>

<p>Any help on that will be very appreciated.</p><p>Kind regards</p><p><br></p><p>Julierme<br></p><p><br></p>
    </div></div>