TransWikia.com

Importing gpx track points as vector layer using PyQGIS

Geographic Information Systems Asked by Lay on August 13, 2021

I have a gpx track and want to import it to QGIS using PyQGIS.

When I add the gpx manually (add vector layer),
I select track points,
enter image description here
and get all the points and attributes with the new layer:
enter image description here

When using PyQGIS(method described here), tracks import fine, but route points seem replaced by tracks.
enter image description here

gpx_names = ["track_points", "tracks"]
for entry in inFolder:
    for name in gpx_names:
        layerName=((os.path.splitext(entry)[0])+' '+name)
        gpx_layer=iface.addVectorLayer(os.path.join(dataPath, entry)+"?type="+name, layerName, "gpx")               

(Using "|layername=" instead of "?type=" didn’t help

How can I fix this/add my gpx as route points using PyQGIS?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP