<div dir="ltr">Hi Mnqweno<div><br></div><div> i realised i had some errors in the little idea i sent earlier...maybe try and modify this one i wrote quickly ..it might have some errors so just play around with it till it works and if i have time i will write someting for you tomorrow.</div><div><br></div><div><div>'''</div><div>Created on 15 Aug 2016</div><div><br></div><div>@author: NcubeZ</div><div>'''</div><div>"""</div><div> download and install your system specific GDAL binaries from <a href="https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries">https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries</a> </div><div> or ask through another email and gurus like Tim can help you</div><div> </div><div> """</div><div>from convertor import ogr2ogr</div><div>import os</div><div><br></div><div>from osgeo import ogr</div><div><br></div><div><br></div><div>def filePathNamesList(directoryPath, extension):</div><div>    """ List of all files of a specific extension within a specific directory</div><div>    </div><div>        path - directory in which the files are contained e.g C:\\dir\\subDir\\subSubDir\\subSubSubDir</div><div>        extension - file extension e.g. .txt</div><div>        </div><div>    """</div><div>    fileList=[]</div><div>    for f in os.listdir(directoryPath):</div><div>        if f.endswith(extension):</div><div>            fileList.append(directoryPath +"\\" +f)</div><div>            </div><div>    return fileList</div><div><br></div><div>def convertshptokml(outputPath,inputPath):</div><div>    """ OGR2OGR """    </div><div>    ogr2ogr.main(['-f', 'KML', outputPath,inputPath])</div><div>    </div><div>    #################</div><div>    #in your main<br></div><div>    #################</div><div>    </div><div>    </div><div>def main():</div><div><br></div><div>    #pathList=None</div><div>    </div><div>   '''</div><div>    you could add some method to iterate through sub directories and get all path names</div><div>    and returns a fullist of all shpfiles within your work directory instead of my smallanyana </div><div>    methodinyana i used as an example</div><div>   but for now it is just the input of directory where your shapefile are immediately contained, it will not search further in sub directories</div><div>'''</div><div><br></div><div>    pathList=filePathNamesList(r"C:\Users\Zibusiso\Desktop\TestShapefiles", extension)</div><div>    extension=".shp"<br></div><div><br></div><div>    #print(pathList)</div><div>    </div><div>    for shpPath in pathList:</div><div>        #remove .shp and add .kml to path name</div><div>        kmlPath=path[:-4]+".kml"</div><div>        convertshptokml(kmlPath, shpPath)</div><div>        outputPath=None</div><div><br></div><div>   </div><div>if __name__ == "__main__":</div><div>    main()</div><div>    </div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><span>Regards</span><br><br><span>Zibusiso M Ncube</span><br><br></div></div>
<br><div class="gmail_quote">On Mon, Aug 15, 2016 at 1:04 PM, Mnqweno Mnyengeza <span dir="ltr"><<a href="mailto:mnqwenom@statssa.gov.za" target="_blank">mnqwenom@statssa.gov.za</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:Helvetica,Arial,sans-serif;font-size:13px"><div><div>Dear All</div><br><div>I need to convert approximately thirteen million  points from shp2kml using QGIS. I have already split the points into their respective provinces, districts and the lowest level of demarcation which is an enumeration area (EA) here at Statistics South Africa. The output file of the split is the sub-folder named the EA reference number and containing the points and polygon of that particular EA. I now need to batch process this conversion using QGIS batch file processor if any is available or any other free open source tool that can easily serve the purpose.</div><br><div>Please assist</div><br><br><div>Kind regards</div><br><div style="clear:both"><div>Mnqweno Mnyengeza (Mr)</div><div> </div><div>Professional GIS Practitioner </div><div>Geography</div><div><a href="tel:082%209048267" value="+27829048267" target="_blank">082 9048267</a> (Mobile)</div><div>Statistics South Africa</div>"..<em>.people are very quick to notice the change in your attitude towards them but always ignore their unacceptable behavior that led to your change</em>....."</div><div><em><strong></strong></em> </div></div><br><br>
<img></div>
<br>______________________________<wbr>_________________<br>
Africa mailing list<br>
<a href="mailto:Africa@lists.osgeo.org">Africa@lists.osgeo.org</a><br>
You can UNSUBSCRIBE at <a href="http://lists.osgeo.org/mailman/listinfo/africa" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/africa</a><br></blockquote></div><br></div>