openindexmaps-workshop

Exercise 4: Create a polygon index map using virtual layer magic

QGIS has many powerful tools for manipulating data. Virtual Layers are a way of generating new dynamic layers that are the result of using spatial SQL on existing layers. Virtual Layers do not need a spatial database like PostGIS or SpatiaLite, but can be used on any layer, including shapefiles or geojson.

In this exercise, we will query the NationalMap to get a CSV of all the 1 arc-second DEM tiles for the entire United States, and then turn it into an index map. These tiles are 1-degree squares, and there are nearly 3400 of them.

1. Download the tile info

I’ll demo this in the workshop, but the CSV has already been downloaded for you. But this same technique could be used to make index maps of other National Map datasets.

2. Create the tile index

If you open the attribute table, you’ll see how the min/max x/y values are all jammed into a single field. This is not ideal, but we can extract each value using text-parsing functions in the SQL of QGIS Virtual Layers!

Note 1: “downloadURL AS downloadUrl” is necessary to get the capitalization correct for OpenIndexMaps. Note 2: We omit records for the old “rockyftp” server, which are for old duplicate tiles.