arma3:terrain:qgis-real-world-data-tutorial
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| arma3:terrain:qgis-real-world-data-tutorial [2019/01/20 10:01] – fixed typos. snakeman | arma3:terrain:qgis-real-world-data-tutorial [2024/08/02 18:53] (current) – links added. snakeman | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== QGIS Real World Data Tutorial ====== | + | ====== |
| - | ArmA 3 QGIS Real World Data Tutorial | + | [[https:// |
| + | |||
| + | **ArmA 3 QGIS Real World Data Tutorial** by Ross | ||
| This process has often been described using Global Mapper, but I wanted to detail the equivalent steps within the open source (free) GIS app - QGIS. | This process has often been described using Global Mapper, but I wanted to detail the equivalent steps within the open source (free) GIS app - QGIS. | ||
| Line 7: | Line 9: | ||
| The goal was to achieve an export satellite image and heightmap with the same or better quality than would be possible with Global Mapper. | The goal was to achieve an export satellite image and heightmap with the same or better quality than would be possible with Global Mapper. | ||
| - | The is my second revision of this process as I recently discovered that due to an update to GDAL (**2.4.0**) one of the key steps in the original tutorial using '**Clip Raster by Mask Layer**' | + | I've used GDAL command |
| - | + | ||
| - | So I reworked the process by getting a bit more under the hood, and using GDAL command | + | |
| - | This tutorial used the following software: | + | The following software |
| **[[https:// | **[[https:// | ||
| Line 36: | Line 36: | ||
| **For single tile export** | **For single tile export** | ||
| - | * Load in just the ' | + | * Load in just the ' |
| * Merge rasters | * Merge rasters | ||
| * Obtain extents from square feature | * Obtain extents from square feature | ||
| Line 43: | Line 43: | ||
| **For 4 tile export (large projects 40960 and above)** | **For 4 tile export (large projects 40960 and above)** | ||
| - | * Load in just the ' | + | * Load in just the ' |
| * Merge Rasters | * Merge Rasters | ||
| * Create grid -- 2 x 2 Feature | * Create grid -- 2 x 2 Feature | ||
| Line 54: | Line 54: | ||
| ===== Heightmap: ===== | ===== Heightmap: ===== | ||
| + | |||
| + | This tutorial covers single raster heightmap as per the kind you will find on [[https:// | ||
| **Drag and drop your heightmap ' | **Drag and drop your heightmap ' | ||
| - | This tutorial covers single raster heightmap as per the kind you will find on opentopo [[http://opentopo.sdsc.edu/ | + | If you do use opentopo |
| **Set QGIS to appropriate CRS for location of your HM** | **Set QGIS to appropriate CRS for location of your HM** | ||
| Line 66: | Line 68: | ||
| Select the CRS to match your real world data, in this example its ‘**WGS 84 UTM zone 20N**’ because the terrain is from the Montserrat in the Caribbean. See also [[https:// | Select the CRS to match your real world data, in this example its ‘**WGS 84 UTM zone 20N**’ because the terrain is from the Montserrat in the Caribbean. See also [[https:// | ||
| - | This will ensure your QGIS project space works appropriately with any other data you want to add - eg road shapefiles etc. Terrain Builder will only use UTM 31N but we'll get to that later. | + | This will ensure your QGIS project space works appropriately with any other data you want to add - eg road shapefiles etc. Terrain Builder will only use **UTM 31N** but we'll get to that later. |
| {{https:// | {{https:// | ||
| Line 106: | Line 108: | ||
| {{https:// | {{https:// | ||
| - | After the last **left mouse click** from the step above, the tool is still waiting to plot more points, so to finalise | + | After the last **left mouse click** from the step above, the tool is still waiting to plot more points, so to finalize |
| {{https:// | {{https:// | ||
| Line 113: | Line 115: | ||
| {{https:// | {{https:// | ||
| + | |||
| + | Save the above edits to the shapefile by clicking on the layer & selecting ‘**Toggle Editing**’ | ||
| **Obtain extents from square feature** | **Obtain extents from square feature** | ||
| Line 143: | Line 147: | ||
| import os\\ | import os\\ | ||
| - | os.system(r%%''' | + | os.system(r%%''' |
| Some explanation of the key parameters: | Some explanation of the key parameters: | ||
| Line 178: | Line 182: | ||
| ==== For single tile export ==== | ==== For single tile export ==== | ||
| - | **Load in just the ' | + | **Load in just the ' |
| {{https:// | {{https:// | ||
| Line 289: | Line 293: | ||
| And list them out for safe keeping - | And list them out for safe keeping - | ||
| - | TL - Extent: (576787.687480, | + | **TL - Extent**: (576787.687480, |
| - | TR - Extent: (587027.687480, | + | **TR - Extent**: (587027.687480, |
| - | BL - Extent: (576787.687480, | + | **BL - Extent**: (576787.687480, |
| - | BR - Extent: (587027.687480, | + | **BR - Extent**: (587027.687480, |
| **Run GDAL command for each quarter to set cell size and CRS and clip to shapefile square extents** | **Run GDAL command for each quarter to set cell size and CRS and clip to shapefile square extents** | ||
| Line 302: | Line 306: | ||
| ===== Loading your assets into Terrain Builder ===== | ===== Loading your assets into Terrain Builder ===== | ||
| + | I would recommend saving copies of any files to be used in **Terrain Builder** into a separate terrain project folder. This will prevent your source project files being adversely affected, and potentially no longer working within **QGIS** - particularly relevant to those changes mentioned below. | ||
| **Heightmap (.asc) edits** | **Heightmap (.asc) edits** | ||
| - | Open your asc and change the following: | + | Open your **asc** in notepad |
| {{https:// | {{https:// | ||
| - | Before loading the asc file into Terrain Builder, delete the .prj file. Otherwise it will not import into TB. | + | Save to a new asc, whilst maintaining the original for use in your QGIS project space |
| + | |||
| + | Before loading the asc file into **Terrain Builder**, delete the .prj file. Otherwise it will not import into TB. | ||
| {{https:// | {{https:// | ||
| Line 316: | Line 323: | ||
| - | Before loading the satellite image into Terrrain | + | Before loading the satellite image into Terrain |
| {{https:// | {{https:// | ||
| Line 332: | Line 339: | ||
| {{https:// | {{https:// | ||
| - | **Coming Soon:** | + | ===== Preparing Road Shapefile ===== |
| - | * Road shapefile | + | |
| - | * Assisted image classification | + | **Load into QGIS (drag and drop) road shapefile** |
| - | * 3d preview | + | |
| + | In this example I got a good dataset from - [[https:// | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | **Clip vector to square shape** | ||
| + | Top Menu - **Vector** > **Geoprocessing Tools** > **Clip** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Save features from clip to new shapefile - selecting appropriate CRS, in this example | ||
| + | |||
| + | Top Menu - **Layer** > **Save As** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | **Set road shapefile | ||
| + | |||
| + | RMB on road shapefile > **Set CRS** > **Set Layer CRS** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | **Set QGIS project CRS to UTM- 31N (bottom right corner): | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | **Collect extents from your square shapefile: | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Extent: (**576787.687480**, | ||
| + | |||
| + | The first two values will be used in the v.transform step below. | ||
| + | |||
| + | |||
| + | **v.transform on road shapefile using calculated extents from square shapefile** | ||
| + | |||
| + | Your heightmap asc must adhere to Terrain Builders required values | ||
| + | Your road shapefile also needs to line up to the same values - we will use **v.transform** to achieve this | ||
| + | |||
| + | So taking the extent values we grabbed in previous step -\\ | ||
| + | We will do the following calculations to bring these values to (**200000** and **0**):\\ | ||
| + | **Easting: | ||
| + | **Northing: 1841104.815839 - 1841104.815839 = 0**\\ | ||
| + | |||
| + | **-376787.68748**\\ | ||
| + | **-1841104.815839** | ||
| + | |||
| + | |||
| + | Having figured out the correct figures plug them into the **v.transform** process | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Drag and Drop into QGIS your heightmap asc - the one you are able to load into Terrain builder - already adjusted to (**200000**, | ||
| + | |||
| + | Set CRS on above asc to **UTM - 31N** | ||
| + | |||
| + | Right click on asc in **Layers** > **Zoom to Layer** | ||
| + | |||
| + | In **Layers** panel drag the asc below your **transformed road shapefile** - so you can see the roads layered above the asc | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Your roads should now be perfectly aligned above your heightmap | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | ==== Setting ID and ORDER fields ==== | ||
| + | |||
| + | RMB on transformed shapefile layer > Toggle **Editing** | ||
| + | |||
| + | RMB on transformed shapefile layer > Open **Attribute Table** | ||
| + | |||
| + | |||
| + | Click **Delete field** - select all fields and press **OK** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | New Field - Name ' | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | New Field - Name ' | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Toggle - **Multi Edit mode** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | ID - Enter **0** - click **Update All** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Select ORDER from drop down - Enter **1** - click **Update all** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Click - **Switch to table view** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Click **Save** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | RMB on transformed road shapefile - **Toggle Editing** to save the changes | ||
| + | |||
| + | |||
| + | **Switching to Terrain Builder -** | ||
| + | |||
| + | |||
| + | **Load your road shapefile** | ||
| + | |||
| + | Top menu - **File** > **Import** > **Shapes** | ||
| + | |||
| + | Click **OK** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Perfectly overlaid within **Terrain builder: | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | ===== 3D Preview using Qgis2threejs ===== | ||
| + | |||
| + | If you want to see an instant | ||
| + | |||
| + | First install it: | ||
| + | |||
| + | Top menu > **Plugins** > **Manage and Install Plugins** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | RMB on the Merged layer and select **Zoom to Layer** | ||
| + | |||
| + | Then select both the **Merged** raster, and the original source heightmap - deselect all other layers | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Start the Qgis2threejs plugin - Top Menu > **Web** > **Qgis2threejs** > **Qgis2threejs Exporter** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Select source heightmap and nothing else | ||
| + | |||
| + | RMB on heightmap > **Properties** | ||
| + | |||
| + | Set the **Resampling** level to **6** | ||
| + | |||
| + | Set **Resolution** to **400%** | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Enjoy browsing around your terrain in 3D: | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | You can also export your terrain to a browser interface if you want - **File** > **Export to web** | ||
arma3/terrain/qgis-real-world-data-tutorial.1547978476.txt.gz · Last modified: 2019/01/20 10:01 by snakeman
