QGIS - extract orthophotos via WMTS

Discussion in 'Tutorials' started by barf, Feb 28, 2019.

  1. barf

    barf Member

    Aug 6, 2018
    Likes Received:
    This tutorial describes extracting ortho-photos from Web Mapping Tile Services (WMTS) using QGIS.

    Finding aerial and satellite imagery sources can be the most difficult part of this process. High-resolution photos are often copyrighted and not free for re-use, leaving LandSat or expensive commercial imagery as the only option. Things are improving though, with thanks to open source initiatives like OpenStreetMap and OpenAerialMap.

    This tutorial uses examples from the Land Information New Zealand (LINZ) data service APIs, but the process is similar for other WMTS/WMS services.

    WMTS connection setup:
    1. Download and install QGIS.
    2. Create a new project using a localised map projection (eg; EPSG:2193 for New Zealand).
    3. To add a new WMTS source, go to the Layer menu -> Add Layer -> WMTS.
    4. Click 'New' to add a new connection.
    5. Enter a name for your own reference, and the URL of the WMTS server's "WMTSCapabilities.xml" file.
    6. Click 'Connect'. If the connection is successful, the Layers tab will show and list the available layers. Pay attention to the CRS column -- use tile sets which are in your local projection wherever possible (or harmonise the project CRS with available tile CRS).
    7. Click 'Add' on the layers you want to import and then 'Close'. The QGIS map window should now update. If you do not see it, right click it in the layers window and select 'Zoom to layer'.
    Now, to export some photos we must define the area to be exported. There are probably many ways, such as writing down four corner x,y values and typing them in again, but my preferred method is to create rectangular polygons around a point of interest and use them like cookie cutters (which also helps extract the same extents from a DEM), so I will share that method.
    1. Layer -> Create Layer -> New Shapefile Layer.
    2. Select the Project CRS, layer type 'Polygon' and choose a filename for the new .shp file that will be saved.
    3. Click the pencil icon to 'Toggle editing'.
    4. Click 'Add point feature' then click on the map where the origin/centre of the rectangle will be. It will ask for an id, but just click OK because we only want the position information here.
    5. (Optional, but a good idea: round the origin to whole units in the CRS). Click 'Vertex Tool' and right-click the point you just added. Truncate the fractional units to zero, or enter a more sensible origin by hand.
    6. Click 'Save layer edits' and the 'Toggle editing' button to leave edit mode.
    7. Plugins -> Manage and install plugins. Install the plugin called 'Shape Tools'. This plugin can create a rectangle around the point we just made.
    8. Click 'Create Polygon' and a window will appear asking for the parameters.
    9. Select the input point layer, number of sides is 4. Starting angle is 45. Radius in kilometers, and the radius.
    10. For the Output Layer, choose to Save to file and choose a filename for the .shp file.
    11. Click 'Run' and bask in the glory of your first virtual cookie cutter! Right click and edit the layer properties to make it extra colourful, cool and transparent.
    Last, but not least, we export the WMTS region, defined by the cookie cutter polygon.
    1. Right click the WMTS layer, and go to Export -> Save As.
    2. Select format: GeoTIFF and un-tick 'Create VRT' - we don't want a VRT.
    3. Choose a filename for the .tif file output, and select the project CRS.
    4. Set extents manually, or calculate extents from the layer we created earlier:
    5. Set export resolution. Horizontal and vertical values here are in meters/pixel, or alternatively, set the columns and rows in pixels (and meters/pixel will be computed). To find the WMTS layer's supported zoom levels/resolutions, look up the service's documentation or metadata.
    6. Click OK to export. A progress bar should appear down the bottom. If it fails, check your requested resolution and size, some WMTS services might say noooo if you try and pull 2GB in one request. YMMV.
    You can now do what you want with the resulting GeoTIFF. It can be imported onto a plane using blenderGIS, and used like a stencil in orthographic views, or draped over a DEM to create a photo-real terrain base to build on.
    Last edited: Feb 28, 2019
    luchian likes this.
  2. luchian

    luchian Administrator Staff Member Pilot RLR

    Jun 3, 2014
    Likes Received:
    Thank you !
  3. fughettaboutit

    fughettaboutit New Member

    Jul 21, 2014
    Likes Received:
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice