spatial-data-discovery / spatial-data-discovery.github.io

Organization website
https://spatial-data-discovery.github.io/
4 stars 0 forks source link

QGIS - Vector Points #14

Closed dt-woods closed 5 years ago

dt-woods commented 5 years ago

Where in the World?

Try to locate where the point coordinates are located in the world using your sandbox challenge script and QGIS.

Basemaps in QGIS

Example code for QGIS Python console

out_file = # path to your GPS coordinates text/csv file

# For QGIS 2.18.17 (on Mac/Linux)
uri = "file://%s?encoding=%s&delimiter=%s&xField=%s&yField=%s&crs=%s" % (out_file, "UTF-8",",", "LON", "LAT","epsg:4326")
csv_layer=QgsVectorLayer(uri,"points","delimitedtext")
QgsMapLayerRegistry.instance().addMapLayer(csv_layer)

# For QGIS 3.14 (on Windows)
out_file = out_file.replace("\\", "/")
uri = "file:///%s?encoding=%s&delimiter=%s&xField=%s&yField=%s&crs=%s" % (out_file, "UTF-8",",", "LON", "LAT","epsg:4326")
csv_layer=QgsVectorLayer(uri,"points","delimitedtext")
QgsProject.instance().addMapLayer(csv_layer)