2

I have a manual QGIS system that starts when I load a GPX file into QGIS and perform a number of actions on it. It all works perfectly.

I want to automate this process using the QGIS Graphical Modeler, so I can batch process a whole directory of GPX files.

When I start the process manually the GPX import dialogue box asks which vector layers I want to load from the GPX file:enter image description here

I select the tracks layer and everything proceeds smoothly.

To automate my system I use the Vector Layer Input element in the Graphical Modeler. I define the import as Line so that it can be picked up by Polygonize.

enter image description here

However, when I try to polygonize this line layer the process fails - I am not sure why - maybe because there are no routes defined in my GPX files?

UPDATE: I swapped the <trk> and <trkpt> tags for <rte> and <rtept> tage in a GPX file and made a 'route layer'. Manually I was able to make a polygon from the route line but, once again, the automated model failed failed to make a polygon.

Is there a way to get around this problem? I have tried many different things including GPS Tools, Batch GPS Importer, Merging layers, Fixing geometries. I have run out of ideas.


As requested by Erik:

Here is an example track: enter image description here

I can polygonize the "loop" manually - but not with the Graphical Modeler: enter image description here

The Graphical Model: enter image description here

Sample GPX (of a shorter track) made with the same GPX tracker:

    <?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="Open GPX Tracker for iOS">
    <trk>
        <trkseg>
            <trkpt lat="50.92371170879427" lon="0.7082069478935639">
                <ele>1.6512947082519531</ele>
                <time>2020-05-16T15:12:17Z</time>
            </trkpt>
            <trkpt lat="50.923746284144855" lon="0.7085257116711777">
                <ele>17.26394271850586</ele>
                <time>2020-05-16T15:12:18Z</time>
            </trkpt>
            <trkpt lat="50.9237622516704" lon="0.7084496039903802">
                <ele>36.04580307006836</ele>
                <time>2020-05-16T15:12:20Z</time>
            </trkpt>
            <trkpt lat="50.92375919227574" lon="0.7084884960210961">
                <ele>35.53786849975586</ele>
                <time>2020-05-16T15:12:22Z</time>
            </trkpt>
            <trkpt lat="50.923756803433335" lon="0.7085274718708438">
                <ele>33.56557846069336</ele>
                <time>2020-05-16T15:12:23Z</time>
            </trkpt>
            <trkpt lat="50.92375382785771" lon="0.7085764221853657">
                <ele>33.50826644897461</ele>
                <time>2020-05-16T15:12:24Z</time>
            </trkpt>
            <trkpt lat="50.92374808625404" lon="0.7086478360003872">
                <ele>33.09322738647461</ele>
                <time>2020-05-16T15:12:25Z</time>
            </trkpt>
            <trkpt lat="50.923741632188595" lon="0.7087280508137389">
                <ele>33.21499252319336</ele>
                <time>2020-05-16T15:12:26Z</time>
            </trkpt>
            <trkpt lat="50.923732915009296" lon="0.7088175695396111">
                <ele>33.34707260131836</ele>
                <time>2020-05-16T15:12:27Z</time>
            </trkpt>
            <trkpt lat="50.92372294054452" lon="0.708912452683513">
                <ele>32.77730941772461</ele>
                <time>2020-05-16T15:12:28Z</time>
            </trkpt>
            <trkpt lat="50.923710661056376" lon="0.7090169750160621">
                <ele>33.23983383178711</ele>
                <time>2020-05-16T15:12:29Z</time>
            </trkpt>
            <trkpt lat="50.92367763635788" lon="0.7091986946768213">
                <ele>33.10921859741211</ele>
                <time>2020-05-16T15:12:30Z</time>
            </trkpt>
            <trkpt lat="50.92366703325037" lon="0.7093041390187194">
                <ele>32.85805892944336</ele>
                <time>2020-05-16T15:12:31Z</time>
            </trkpt>
            <trkpt lat="50.92365525667641" lon="0.709406482056444">
                <ele>32.01839828491211</ele>
                <time>2020-05-16T15:12:32Z</time>
            </trkpt>
            <trkpt lat="50.923644611659384" lon="0.7094848528510979">
                <ele>31.03518295288086</ele>
                <time>2020-05-16T15:12:33Z</time>
            </trkpt>
            <trkpt lat="50.92363086533818" lon="0.7095674145973376">
                <ele>30.08053207397461</ele>
                <time>2020-05-16T15:12:34Z</time>
            </trkpt>
            <trkpt lat="50.92362126805905" lon="0.7096602022654467">
                <ele>29.83437728881836</ele>
                <time>2020-05-16T15:12:35Z</time>
            </trkpt>
            <trkpt lat="50.923615568364895" lon="0.7097575999803001">
                <ele>29.83669662475586</ele>
                <time>2020-05-16T15:12:36Z</time>
            </trkpt>
            <trkpt lat="50.923605845357216" lon="0.7098427601165229">
                <ele>28.89907455444336</ele>
                <time>2020-05-16T15:12:37Z</time>
            </trkpt>
            <trkpt lat="50.92359729581598" lon="0.7099391520029957">
                <ele>28.59688949584961</ele>
                <time>2020-05-16T15:12:38Z</time>
            </trkpt>
            <trkpt lat="50.923586525070405" lon="0.7100349571562465">
                <ele>27.77956771850586</ele>
                <time>2020-05-16T15:12:39Z</time>
            </trkpt>
            <trkpt lat="50.923579442362225" lon="0.7101314328617511">
                <ele>27.08919906616211</ele>
                <time>2020-05-16T15:12:40Z</time>
            </trkpt>
            <trkpt lat="50.923572862568236" lon="0.7102274056530653">
                <ele>26.73189926147461</ele>
                <time>2020-05-16T15:12:41Z</time>
            </trkpt>
            <trkpt lat="50.92356552840296" lon="0.7103212829685865">
                <ele>26.22274398803711</ele>
                <time>2020-05-16T15:12:42Z</time>
            </trkpt>
            <trkpt lat="50.92355702077124" lon="0.7104127295321881">
                <ele>25.90444564819336</ele>
                <time>2020-05-16T15:12:43Z</time>
            </trkpt>
            <trkpt lat="50.92354692057792" lon="0.7104945369071425">
                <ele>26.00008773803711</ele>
                <time>2020-05-16T15:12:44Z</time>
            </trkpt>
            <trkpt lat="50.92353874822233" lon="0.7105660345411957">
                <ele>25.42531967163086</ele>
                <time>2020-05-16T15:12:45Z</time>
            </trkpt>
            <trkpt lat="50.923535227822995" lon="0.7106451597071352">
                <ele>25.17019271850586</ele>
                <time>2020-05-16T15:12:46Z</time>
            </trkpt>
            <trkpt lat="50.92353975405071" lon="0.7107050064957801">
                <ele>25.48318099975586</ele>
                <time>2020-05-16T15:12:47Z</time>
            </trkpt>
            <trkpt lat="50.923565779860056" lon="0.7107523642486993">
                <ele>25.87997055053711</ele>
                <time>2020-05-16T15:12:48Z</time>
            </trkpt>
            <trkpt lat="50.923597547273076" lon="0.7107781805104676">
                <ele>26.64352035522461</ele>
                <time>2020-05-16T15:12:49Z</time>
            </trkpt>
            <trkpt lat="50.92363723558459" lon="0.710800141096777">
                <ele>26.77114486694336</ele>
                <time>2020-05-16T15:12:50Z</time>
            </trkpt>
            <trkpt lat="50.92368559916589" lon="0.7108232751495306">
                <ele>26.55404281616211</ele>
                <time>2020-05-16T15:12:51Z</time>
            </trkpt>
            <trkpt lat="50.92373806987975" lon="0.7108435593552057">
                <ele>26.42371265063997</ele>
                <time>2020-05-16T15:12:52Z</time>
            </trkpt>
            <trkpt lat="50.923790079588926" lon="0.7108614966279928">
                <ele>26.513888242322253</ele>
                <time>2020-05-16T15:12:53Z</time>
            </trkpt>
            <trkpt lat="50.9238404967365" lon="0.7108793500817482">
                <ele>26.586919717786287</ele>
                <time>2020-05-16T15:12:54Z</time>
            </trkpt>
            <trkpt lat="50.92388940514151" lon="0.7109026517725651">
                <ele>26.712211571288506</ele>
                <time>2020-05-16T15:12:55Z</time>
            </trkpt>
            <trkpt lat="50.923939528922475" lon="0.7109227683401768">
                <ele>26.646315398652504</ele>
                <time>2020-05-16T15:12:56Z</time>
            </trkpt>
            <trkpt lat="50.92398944315586" lon="0.7109460700309937">
                <ele>26.812293484046307</ele>
                <time>2020-05-16T15:12:57Z</time>
            </trkpt>
            <trkpt lat="50.924041620503104" lon="0.7109681144363349">
                <ele>26.935579841771272</ele>
                <time>2020-05-16T15:12:58Z</time>
            </trkpt>
            <trkpt lat="50.924096941064036" lon="0.7109971158213084">
                <ele>26.841609091149223</ele>
                <time>2020-05-16T15:12:59Z</time>
            </trkpt>
            <trkpt lat="50.92415268072013" lon="0.711021674797601">
                <ele>26.70317091815926</ele>
                <time>2020-05-16T15:13:00Z</time>
            </trkpt>
            <trkpt lat="50.924199954654014" lon="0.7110448926693862">
                <ele>26.326055522758892</ele>
                <time>2020-05-16T15:13:01Z</time>
            </trkpt>
            <trkpt lat="50.92423033905301" lon="0.7110583875334925">
                <ele>26.234783411730035</ele>
                <time>2020-05-16T15:13:02Z</time>
            </trkpt>
            <trkpt lat="50.92426047199491" lon="0.7110602315521902">
                <ele>26.599450027210423</ele>
                <time>2020-05-16T15:13:04Z</time>
            </trkpt>
            <trkpt lat="50.924281594390905" lon="0.711052939296431">
                <ele>26.626202238266302</ele>
                <time>2020-05-16T15:13:11Z</time>
            </trkpt>
            <trkpt lat="50.9243085422096" lon="0.7110593095428414">
                <ele>26.705974181921235</ele>
                <time>2020-05-16T15:13:12Z</time>
            </trkpt>
            <trkpt lat="50.92434609313581" lon="0.7110718823975987">
                <ele>26.476546600781703</ele>
                <time>2020-05-16T15:13:13Z</time>
            </trkpt>
            <trkpt lat="50.92438896657053" lon="0.7110841199762291">
                <ele>26.389641832245104</ele>
                <time>2020-05-16T15:13:14Z</time>
            </trkpt>
            <trkpt lat="50.92443494130943" lon="0.7111029792583651">
                <ele>26.39299468498554</ele>
                <time>2020-05-16T15:13:15Z</time>
            </trkpt>
            <trkpt lat="50.9244670859081" lon="0.7111246045685476">
                <ele>25.983006228342646</ele>
                <time>2020-05-16T15:13:16Z</time>
            </trkpt>
            <trkpt lat="50.92448661574249" lon="0.7111314777291483">
                <ele>25.776633927711288</ele>
                <time>2020-05-16T15:13:17Z</time>
            </trkpt>
            <trkpt lat="50.92450761240993" lon="0.7111342437571949">
                <ele>26.322726107985773</ele>
                <time>2020-05-16T15:13:20Z</time>
            </trkpt>
            <trkpt lat="50.924539170275374" lon="0.7111429609364933">
                <ele>26.3746936109047</ele>
                <time>2020-05-16T15:13:21Z</time>
            </trkpt>
            <trkpt lat="50.92458472591911" lon="0.7111588865525192">
                <ele>26.311654116876127</ele>
                <time>2020-05-16T15:13:22Z</time>
            </trkpt>
            <trkpt lat="50.92463686135684" lon="0.7111830264336534">
                <ele>26.393013106595703</ele>
                <time>2020-05-16T15:13:23Z</time>
            </trkpt>
            <trkpt lat="50.924699725630624" lon="0.7112086750573583">
                <ele>26.803824915226585</ele>
                <time>2020-05-16T15:13:24Z</time>
            </trkpt>
            <trkpt lat="50.92477088798855" lon="0.7112377602613635">
                <ele>27.228360667459697</ele>
                <time>2020-05-16T15:13:25Z</time>
            </trkpt>
            <trkpt lat="50.92484557074581" lon="0.7112668454653688">
                <ele>27.43562472881267</ele>
                <time>2020-05-16T15:13:26Z</time>
            </trkpt>
            <trkpt lat="50.92492469591175" lon="0.7112973555929133">
                <ele>27.43098550910068</ele>
                <time>2020-05-16T15:13:27Z</time>
            </trkpt>
            <trkpt lat="50.92500277333979" lon="0.711321579293079">
                <ele>27.49138827920848</ele>
                <time>2020-05-16T15:13:28Z</time>
            </trkpt>
            <trkpt lat="50.92507657599722" lon="0.7113477308309742">
                <ele>27.451959210587603</ele>
                <time>2020-05-16T15:13:29Z</time>
            </trkpt>
            <trkpt lat="50.925148744183524" lon="0.7113661710179516">
                <ele>27.602713514843146</ele>
                <time>2020-05-16T15:13:30Z</time>
            </trkpt>
            <trkpt lat="50.92521760151808" lon="0.7113836891955801">
                <ele>27.470555512322647</ele>
                <time>2020-05-16T15:13:31Z</time>
            </trkpt>
            <trkpt lat="50.92527971142058" lon="0.7114070747054287">
                <ele>27.28972217239543</ele>
                <time>2020-05-16T15:13:32Z</time>
            </trkpt>
            <trkpt lat="50.92533654072408" lon="0.711419396103091">
                <ele>27.322261897605046</ele>
                <time>2020-05-16T15:13:33Z</time>
            </trkpt>
            <trkpt lat="50.92538347938184" lon="0.7114233355975816">
                <ele>27.41228642262091</ele>
                <time>2020-05-16T15:13:34Z</time>
            </trkpt>
            <trkpt lat="50.92542178467934" lon="0.7114251796162794">
                <ele>27.281445691244983</ele>
                <time>2020-05-16T15:13:35Z</time>
            </trkpt>
            <trkpt lat="50.925448606769486" lon="0.7114093378192851">
                <ele>27.410578074520643</ele>
                <time>2020-05-16T15:13:36Z</time>
            </trkpt>
            <trkpt lat="50.92546595730905" lon="0.7113708648837277">
                <ele>27.494117849573428</ele>
                <time>2020-05-16T15:13:37Z</time>
            </trkpt>
            <trkpt lat="50.92547890734945" lon="0.7113188970840642">
                <ele>27.796823929969776</ele>
                <time>2020-05-16T15:13:38Z</time>
            </trkpt>
            <trkpt lat="50.92548879799519" lon="0.7112524285919137">
                <ele>27.8311520680854</ele>
                <time>2020-05-16T15:13:39Z</time>
            </trkpt>
            <trkpt lat="50.925493743318064" lon="0.7111727166927524">
                <ele>28.091817772829202</ele>
                <time>2020-05-16T15:13:40Z</time>
            </trkpt>
            <trkpt lat="50.92549994592641" lon="0.7110786717391676">
                <ele>28.115254965504917</ele>
                <time>2020-05-16T15:13:41Z</time>
            </trkpt>
            <trkpt lat="50.92551582963292" lon="0.7109762448824113">
                <ele>28.404458949296526</ele>
                <time>2020-05-16T15:13:42Z</time>
            </trkpt>
            <trkpt lat="50.92552521736447" lon="0.7108576409525339">
                <ele>28.404458949296526</ele>
                <time>2020-05-16T15:13:43Z</time>
            </trkpt>
            <trkpt lat="50.92553569474344" lon="0.7107356842613879">
                <ele>28.765100453409175</ele>
                <time>2020-05-16T15:13:44Z</time>
            </trkpt>
            <trkpt lat="50.925543196546776" lon="0.7106285635388555">
                <ele>29.02086428383049</ele>
                <time>2020-05-16T15:13:45Z</time>
            </trkpt>
            <trkpt lat="50.92555639804427" lon="0.7105218619114817">
                <ele>29.021046839134954</ele>
                <time>2020-05-16T15:13:46Z</time>
            </trkpt>
            <trkpt lat="50.925570228184505" lon="0.7104164175695836">
                <ele>29.306733480633625</ele>
                <time>2020-05-16T15:13:47Z</time>
            </trkpt>
            <trkpt lat="50.92557928063993" lon="0.7103227078921257">
                <ele>29.366689521210844</ele>
                <time>2020-05-16T15:13:48Z</time>
            </trkpt>
            <trkpt lat="50.92558917128567" lon="0.7102509588009773">
                <ele>29.248758605981294</ele>
                <time>2020-05-16T15:13:49Z</time>
            </trkpt>
            <trkpt lat="50.92559566726063" lon="0.7101974822587428">
                <ele>29.323455952395108</ele>
                <time>2020-05-16T15:13:50Z</time>
            </trkpt>
            <trkpt lat="50.925597134093685" lon="0.7101650442934689">
                <ele>29.275892498933956</ele>
                <time>2020-05-16T15:13:51Z</time>
            </trkpt>
            <trkpt lat="50.925600989769144" lon="0.7101222965872941">
                <ele>29.5390771562233</ele>
                <time>2020-05-16T15:13:53Z</time>
            </trkpt>
            <trkpt lat="50.925606438006206" lon="0.710090780631369">
                <ele>29.76854427084851</ele>
                <time>2020-05-16T15:13:54Z</time>
            </trkpt>
            <trkpt lat="50.92561188624327" lon="0.7100362144417223">
                <ele>30.087300664874476</ele>
                <time>2020-05-16T15:13:55Z</time>
            </trkpt>
            <trkpt lat="50.92561821458016" lon="0.7099637947983201">
                <ele>30.082460252814357</ele>
                <time>2020-05-16T15:13:56Z</time>
            </trkpt>
            <trkpt lat="50.92562709939752" lon="0.7098750304437335">
                <ele>30.08410891198342</ele>
                <time>2020-05-16T15:13:57Z</time>
            </trkpt>
            <trkpt lat="50.925640133256955" lon="0.7097749505198652">
                <ele>30.30020222428348</ele>
                <time>2020-05-16T15:13:58Z</time>
            </trkpt>
            <trkpt lat="50.92565262229268" lon="0.7096758764243775">
                <ele>30.29191205534073</ele>
                <time>2020-05-16T15:13:59Z</time>
            </trkpt>
            <trkpt lat="50.92566628479485" lon="0.7095677498734645">
                <ele>30.48165290340839</ele>
                <time>2020-05-16T15:14:00Z</time>
            </trkpt>
            <trkpt lat="50.92567521152173" lon="0.7094554323709658">
                <ele>30.75058839918728</ele>
                <time>2020-05-16T15:14:01Z</time>
            </trkpt>
            <trkpt lat="50.92569130477582" lon="0.7093446236110379">
                <ele>31.003867646600924</ele>
                <time>2020-05-16T15:14:02Z</time>
            </trkpt>
            <trkpt lat="50.92570161451672" lon="0.709234401584332">
                <ele>31.185400645787922</ele>
                <time>2020-05-16T15:14:03Z</time>
            </trkpt>
            <trkpt lat="50.925711756619556" lon="0.7091231737292456">
                <ele>31.163211255802523</ele>
                <time>2020-05-16T15:14:04Z</time>
            </trkpt>
            <trkpt lat="50.92571971942757" lon="0.709017897025411">
                <ele>31.0581810836147</ele>
                <time>2020-05-16T15:14:05Z</time>
            </trkpt>
            <trkpt lat="50.925726131583495" lon="0.7089133746928619">
                <ele>31.221614812314073</ele>
                <time>2020-05-16T15:14:06Z</time>
            </trkpt>
            <trkpt lat="50.92573082544927" lon="0.7088148035115645">
                <ele>31.285306546649053</ele>
                <time>2020-05-16T15:14:07Z</time>
            </trkpt>
            <trkpt lat="50.925736147957785" lon="0.7087381090975448">
                <ele>30.661844930116203</ele>
                <time>2020-05-16T15:14:08Z</time>
            </trkpt>
            <trkpt lat="50.92573983599518" lon="0.7086849678314372">
                <ele>30.504748044531183</ele>
                <time>2020-05-16T15:14:09Z</time>
            </trkpt>
            <trkpt lat="50.92574440413241" lon="0.7086551282561464">
                <ele>30.156179157525685</ele>
                <time>2020-05-16T15:14:10Z</time>
            </trkpt>
            <trkpt lat="50.92573744715278" lon="0.7086213491863651">
                <ele>34.83034896850586</ele>
                <time>2020-05-16T15:14:12Z</time>
            </trkpt>
            <trkpt lat="50.9257171629471" lon="0.7085593231028957">
                <ele>33.22182846069336</ele>
                <time>2020-05-16T15:14:14Z</time>
            </trkpt>
            <trkpt lat="50.925685144076986" lon="0.7085423916584891">
                <ele>33.23159408569336</ele>
                <time>2020-05-16T15:14:15Z</time>
            </trkpt>
            <trkpt lat="50.92564415657048" lon="0.7085309922701758">
                <ele>33.00887680053711</ele>
                <time>2020-05-16T15:14:16Z</time>
            </trkpt>
            <trkpt lat="50.92559139249001" lon="0.7085196767008942">
                <ele>32.80520248413086</ele>
                <time>2020-05-16T15:14:17Z</time>
            </trkpt>
            <trkpt lat="50.92554248408501" lon="0.7085091993219298">
                <ele>33.41360092163086</ele>
                <time>2020-05-16T15:14:18Z</time>
            </trkpt>
            <trkpt lat="50.92548578051005" lon="0.7084827963269394">
                <ele>33.48092269897461</ele>
                <time>2020-05-16T15:14:19Z</time>
            </trkpt>
            <trkpt lat="50.92541935392742" lon="0.7084625121212643">
                <ele>33.80752182006836</ele>
                <time>2020-05-16T15:14:20Z</time>
            </trkpt>
            <trkpt lat="50.925348233479006" lon="0.7084397133446377">
                <ele>33.83517074584961</ele>
                <time>2020-05-16T15:14:21Z</time>
            </trkpt>
            <trkpt lat="50.92528260317717" lon="0.7084162440157573">
                <ele>33.77938461303711</ele>
                <time>2020-05-16T15:14:22Z</time>
            </trkpt>
            <trkpt lat="50.925204274292035" lon="0.7083810400224368">
                <ele>34.43001937866211</ele>
                <time>2020-05-16T15:14:23Z</time>
            </trkpt>
            <trkpt lat="50.92513126791541" lon="0.7083602529025714">
                <ele>35.03786849975586</ele>
                <time>2020-05-16T15:14:24Z</time>
            </trkpt>
            <trkpt lat="50.9250611952049" lon="0.7083409745252769">
                <ele>35.45528793334961</ele>
                <time>2020-05-16T15:14:25Z</time>
            </trkpt>
            <trkpt lat="50.92499845665966" lon="0.7083209417766969">
                <ele>35.97408676147461</ele>
                <time>2020-05-16T15:14:26Z</time>
            </trkpt>
            <trkpt lat="50.924932826357825" lon="0.7083055190748612">
                <ele>36.54256820678711</ele>
                <time>2020-05-16T15:14:27Z</time>
            </trkpt>
            <trkpt lat="50.92488270257686" lon="0.708293784410421">
                <ele>36.89150619506836</ele>
                <time>2020-05-16T15:14:28Z</time>
            </trkpt>
            <trkpt lat="50.92484565456484" lon="0.7082810439176003">
                <ele>37.06985092163086</ele>
                <time>2020-05-16T15:14:29Z</time>
            </trkpt>
            <trkpt lat="50.92481807810341" lon="0.7082791160798708">
                <ele>36.89364242553711</ele>
                <time>2020-05-16T15:14:30Z</time>
            </trkpt>
            <trkpt lat="50.924780066172524" lon="0.7082658726728598">
                <ele>37.16598129272461</ele>
                <time>2020-05-16T15:14:32Z</time>
            </trkpt>
            <trkpt lat="50.924750100868685" lon="0.70826050825483">
                <ele>36.89645004272461</ele>
                <time>2020-05-16T15:14:33Z</time>
            </trkpt>
            <trkpt lat="50.924709742004914" lon="0.7082420680678526">
                <ele>36.52462387084961</ele>
                <time>2020-05-16T15:14:34Z</time>
            </trkpt>
            <trkpt lat="50.924652786972864" lon="0.7082252204424778">
                <ele>36.94649887084961</ele>
                <time>2020-05-16T15:14:35Z</time>
            </trkpt>
            <trkpt lat="50.92459122189407" lon="0.7082003261900583">
                <ele>37.16677474975586</ele>
                <time>2020-05-16T15:14:36Z</time>
            </trkpt>
            <trkpt lat="50.92453254857187" lon="0.7081769406802096">
                <ele>37.36825180053711</ele>
                <time>2020-05-16T15:14:37Z</time>
            </trkpt>
            <trkpt lat="50.924468846107764" lon="0.7081636972731986">
                <ele>37.80276107788086</ele>
                <time>2020-05-16T15:14:38Z</time>
            </trkpt>
            <trkpt lat="50.924402796710766" lon="0.7081545609987416">
                <ele>37.84731674194336</ele>
                <time>2020-05-16T15:14:39Z</time>
            </trkpt>
            <trkpt lat="50.924334903295076" lon="0.708150034771029">
                <ele>38.59402084350586</ele>
                <time>2020-05-16T15:14:40Z</time>
            </trkpt>
            <trkpt lat="50.92425866988573" lon="0.7081266492611804">
                <ele>36.628197377484</ele>
                <time>2020-05-16T15:14:41Z</time>
            </trkpt>
            <trkpt lat="50.92418340039525" lon="0.7081135734922328">
                <ele>38.73598861694336</ele>
                <time>2020-05-16T15:14:42Z</time>
            </trkpt>
            <trkpt lat="50.92409568377856" lon="0.7080856617546716">
                <ele>38.46114730834961</ele>
                <time>2020-05-16T15:14:43Z</time>
            </trkpt>
            <trkpt lat="50.92402041428808" lon="0.7080589234835543">
                <ele>37.87435531616211</ele>
                <time>2020-05-16T15:14:44Z</time>
            </trkpt>
            <trkpt lat="50.92394598298792" lon="0.7080362923449911">
                <ele>37.57210922241211</ele>
                <time>2020-05-16T15:14:45Z</time>
            </trkpt>
            <trkpt lat="50.923880646052694" lon="0.7080253120518364">
                <ele>37.73440170288086</ele>
                <time>2020-05-16T15:14:46Z</time>
            </trkpt>
            <trkpt lat="50.923820757354534" lon="0.7080272398895658">
                <ele>37.27346420288086</ele>
                <time>2020-05-16T15:14:47Z</time>
            </trkpt>
            <trkpt lat="50.92378425416622" lon="0.7080532237893976">
                <ele>36.86080551147461</ele>
                <time>2020-05-16T15:14:48Z</time>
            </trkpt>
            <trkpt lat="50.923749930272734" lon="0.7081028446561732">
                <ele>36.31332015991211</ele>
                <time>2020-05-16T15:14:49Z</time>
            </trkpt>
            <trkpt lat="50.92373723168943" lon="0.7081779465085902">
                <ele>36.37917709350586</ele>
                <time>2020-05-16T15:14:50Z</time>
            </trkpt>
            <trkpt lat="50.923732328276074" lon="0.7082662917680184">
                <ele>36.24892807006836</ele>
                <time>2020-05-16T15:14:51Z</time>
            </trkpt>
            <trkpt lat="50.923727676319814" lon="0.7083582412458103">
                <ele>36.28762435913086</ele>
                <time>2020-05-16T15:14:52Z</time>
            </trkpt>
            <trkpt lat="50.923739494803286" lon="0.7084759231663388">
                <ele>36.51101303100586</ele>
                <time>2020-05-16T15:14:53Z</time>
            </trkpt>
            <trkpt lat="50.92373765078459" lon="0.70858396589822">
                <ele>36.99831771850586</ele>
                <time>2020-05-16T15:14:54Z</time>
            </trkpt>
            <trkpt lat="50.92372771822933" lon="0.7086977921432897">
                <ele>37.05367660522461</ele>
                <time>2020-05-16T15:14:55Z</time>
            </trkpt>
            <trkpt lat="50.923713804270065" lon="0.7087969500578091">
                <ele>37.34432601928711</ele>
                <time>2020-05-16T15:14:56Z</time>
            </trkpt>
            <trkpt lat="50.92370634437624" lon="0.708906836808388">
                <ele>37.07345199584961</ele>
                <time>2020-05-16T15:14:57Z</time>
            </trkpt>
            <trkpt lat="50.923700435134506" lon="0.7090118620551275">
                <ele>33.618792790869634</ele>
                <time>2020-05-16T15:14:58Z</time>
            </trkpt>
            <trkpt lat="50.92368874237958" lon="0.7091062422848391">
                <ele>33.216994895181244</ele>
                <time>2020-05-16T15:14:59Z</time>
            </trkpt>
            <trkpt lat="50.92367512178693" lon="0.7092047296471048">
                <ele>32.84795945060941</ele>
                <time>2020-05-16T15:15:00Z</time>
            </trkpt>
            <trkpt lat="50.92367005073551" lon="0.709284525365298">
                <ele>32.697421165695346</ele>
                <time>2020-05-16T15:15:01Z</time>
            </trkpt>
            <trkpt lat="50.923659363808966" lon="0.7093410193926741">
                <ele>32.87653969279934</ele>
                <time>2020-05-16T15:15:02Z</time>
            </trkpt>
            <trkpt lat="50.92365739406172" lon="0.7093771453953435">
                <ele>33.09877055580819</ele>
                <time>2020-05-16T15:15:08Z</time>
            </trkpt>
        </trkseg>
    </trk>
</gpx>

Data Log: With QGIS Graphical Modeler:

Prepare algorithm: qgis:polygonize_1
Running Polygonize [1/6]
Input Parameters:
{ INPUT: '/Users/peqi/Downloads/GPX/16-May-2020-1531.gpx', KEEP_FIELDS: False, OUTPUT: 'memory:Polygons from lines' }
Processing lines…
Noding lines…
Polygonizing…
No polygons were created!
OK. Execution took 0.165 s (1 outputs).

Manually:

Processing algorithm…
Algorithm 'Polygonize' starting…
Input parameters:
{ 'INPUT' : '/Users/peqi/Downloads/GPX/16-May-2020-1531.gpx|layername=tracks', 'KEEP_FIELDS' : False, 'OUTPUT' : 'TEMPORARY_OUTPUT' }

Processing lines…
Noding lines…
Polygonizing…
Saving polygons…
Execution completed in 0.10 seconds
Results:
{'OUTPUT': 'Polygons_from_lines_44578c71_16a0_40b5_827e_a6ce3393bfe5'}

Loading resulting layers
Algorithm 'Polygonize' finished

Model script: https://pastebin.com/m8uSnARj


Compare manual input:

'INPUT' : '/Users/peqi/Downloads/GPX/16-May-2020-1531.gpx|layername=tracks'

with the Model:

{ INPUT: '/Users/peqi/Downloads/GPX/16-May-2020-1615.gpx', KEEP_FIELDS: False, OUTPUT: 'memory:Polygons from lines' }

Is that missing '... |layername=tracks' the problem?


10
  • You are wondering why you can't create polygons from non-closed lines? Why are you trying to polygonize in the first place? What result do you expect?
    – Erik
    Commented Aug 13, 2020 at 12:08
  • They are closed lines.
    – Peqi
    Commented Aug 13, 2020 at 12:14
  • The manual process works fine. I can't work out how to automate it with the Graphical Modeler.
    – Peqi
    Commented Aug 13, 2020 at 12:15
  • Can you share example data and the model?
    – Erik
    Commented Aug 13, 2020 at 12:17
  • Here you are. Thanks for helping.
    – Peqi
    Commented Aug 13, 2020 at 13:04

1 Answer 1

0

The GPX file needs to be converted into a .shp file before it can be processed by the Graphical Modeler.

Load the .gpx file as a layer in QGIS, right click on the layer in the layer browser >> export >> save as >> ESRI Shapefile (give it a name and select a writable destination directory).

This cannot be done as a QGIS batch process (as far as I know)

This .shp file can be opened and processed by the graphical modeler.

6
  • No - it's the start of a whole new heap of (unnecessary) pain.
    – Peqi
    Commented Aug 13, 2020 at 20:58
  • Isn't the answer enough?
    – Peqi
    Commented Aug 13, 2020 at 21:23
  • It is a complete answer.
    – Peqi
    Commented Aug 13, 2020 at 21:29
  • .shx is the offset information for a shapefile. No file geodata format could be converted into the fixed width feature offset file, so this makes no sense as a comment, much less as an answer.
    – Vince
    Commented Aug 13, 2020 at 21:30
  • With QGIS (open .gpx >> export as .shx) - but not with the Graphical Modeler.
    – Peqi
    Commented Aug 13, 2020 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.