<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Nyall,</div><div><br></div><div>I have been working on an alternative KML/KMZ importing tool and a tool to expand HTML tables
within the description field containing tag/value elements into fields in the table.  The reason for another importer is that the GDAL implementation is in some sense too smart. 
 The situation is that if there are many folders in a KML, QGIS imports 
each as a layer and is very slow at importing or crashes during the 
import if there happens to be hundreds of layers. This also happens 
using ArcGIS. I am assuming that both use GDAL and in some respects GDAL
 tries to do too much. Consequently, I wrote this KML plugin to 
import KML/KMZ files in the way we wanted them. The following is the capability prior to processing.</div><div><br></div><div><a href="https://github.com/NationalSecurityAgency/qgis-kmltools-plugin">https://github.com/NationalSecurityAgency/qgis-kmltools-plugin</a></div><div><br></div>
The biggest difference between the native import and this one is that rather than create multiple layers for 
each folder of KMLs, I create one point layer, one line layer and one 
polygon layer if required. I add an additional field that contains the 
folder structure for each feature.This makes the import very quick.</div><div dir="ltr"><br></div><div>I have already converted this importer to processing. The second function that expands HTML tables in the description field does a first pass to see if there are any tables and makes note of the tags/fields to be created. It then pops up a dialog box to allow the user to select what fields they want expanded. They only way you could do this in processing, since I can't pop up a selection box, is to expand all potential tags/fields, but the users don't want to do this. They want to select which fields they want added and they may not know which tags they want until they look at the list. This is why I wont be able to do it in processing.</div><div><br></div><div>I have debated whether I should make this a separate plugin in or add the functionality to Lat Lon Tools. I already have conversion routines such as MGRS conversion and "Plus Codes" in Lat Lon Tools. What are your thoughts? Should this be added to Lat Lon Tools or a separate plugin?</div><div><br></div><div>Calvin<br></div><div dir="ltr"><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 31, 2018 at 5:06 PM, Nyall Dawson <span dir="ltr"><<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, 31 Aug 2018 at 22:24, C Hamilton <<a href="mailto:adenaculture@gmail.com">adenaculture@gmail.com</a>> wrote:<br>
><br>
> Thanks Nyall!!! Unfortunately I was trying to make this a processing routine when I shouldn't have. It is good to know the boundaries. This function really requires user interactivity.<br>
<br>
</span>Mind sharing the general function of the plugin? There may still be a<br>
way to make this work within Processing.<br>
<br>
Regards,<br>
Nyall<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Calvin<br>
><br>
> On Thu, Aug 30, 2018 at 9:27 PM, Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com">nyall.dawson@gmail.com</a>> wrote:<br>
>><br>
>> On Thu, 30 Aug 2018 at 23:38, C Hamilton <<a href="mailto:adenaculture@gmail.com">adenaculture@gmail.com</a>> wrote:<br>
>> ><br>
>> > I have an algorithm that during execution gathers information from the data and then pops up a window for the user to select what the user would like to do.<br>
>> ><br>
>> > Is this possible in the Processing framework? I have tried doing this in processAlgorithm and it crashes QGIS. Here is how I call the popup window.<br>
>><br>
>> No - this is not supported and goes against the very fundamental<br>
>> design of Processing. Argggh! ;)<br>
>><br>
>> But seriously, Processing was designed with the intention that all<br>
>> user choices are made up-front. This allows algorithms to be nicely<br>
>> executed inside of models, without the model halting mid-way waiting<br>
>> for user input. It also allows algorithms, scripts, models, etc to be<br>
>> run from headless environments such as console scripts.<br>
>><br>
>> In this case, you're getting a crash because you're trying to create<br>
>> GUI components from your algorithm which is being executed in a<br>
>> background thread. This is a big no-no in Qt land, and usually results<br>
>> in a crash.<br>
>><br>
>> Nyall<br>
>><br>
>><br>
>> >         fieldsDialog = SelectionDialog(self.<wbr>tableFeatures)<br>
>> >         fieldsDialog.exec_()<br>
>> >         items = fieldsDialog.selected<br>
>> ><br>
>> > Here is the beginning of the SelectionDialong class.<br>
>> ><br>
>> > class SelectionDialog(QDialog, FIELDS_CLASS):<br>
>> >     def __init__(self, feat, parent=None):<br>
>> >         super(SelectionDialog, self).__init__(parent)<br>
>> >         self.setupUi(self)<br>
>> ><br>
>> > Prior to Processing I passed in iface.mainWindow() as the parent. Is there a proper parent in Processing to pass? Perhaps this is the reason it is crashing.<br>
>> ><br>
>> > class SelectionDialog(QDialog, FIELDS_CLASS):<br>
>> >     def __init__(self, iface, feat):<br>
>> >         super(SelectionDialog, self).__init__(iface.<wbr>mainWindow())<br>
>> >         self.setupUi(self)<br>
>> ><br>
>> > Thanks,<br>
>> ><br>
>> > Calvin<br>
><br>
><br>
</div></div></blockquote></div><br></div>