stitching_etopos
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
stitching_etopos [2023/07/08 10:23] – bushwalking | stitching_etopos [2023/08/31 08:55] (current) – Add link bushwalking | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Stitching e-Topos ====== | ====== Stitching e-Topos ====== | ||
- | I recently went to considerable effort to stitch together NSW 1:25k e-Topo (PDF) maps, for use in OziExplorer. I figured it would be worthwhile to document the steps, with a bit of background. The same process may be useful for stitching other georeferenced maps with collars. | + | I recently went to considerable effort to stitch together NSW 1:25k e-Topo (PDF) maps into one big raster, for use in OziExplorer. I figured it would be worthwhile to document the steps, with a bit of background. The same process may be useful for stitching other georeferenced maps with collars. |
+ | |||
+ | Note that it is skewed towards Windows users, and assumes a certain level of technical knowledge (eg running commands on the command line), and that you have GDAL installed and the path to the binaries in your PATH. | ||
+ | |||
+ | The following answer from GIS Stack Exchange has more details on resampling and compression options: | ||
+ | https:// | ||
+ | |||
+ | ===== 0. Background on UTM and map dimensions ===== | ||
First thing is, it's worth remembering that the UTM system slices the world up into a series of 6 degree zones, which are shaped like sections of an orange. These are flattened, and any grid is overlaid on this. For NSW (and many other places), individual maps are a fixed number of degrees wide. In the case of standard NSW 1:25k maps, they are 0.25 degrees wide. But 6 degrees at the equator is much wider than 6 degrees at 80 degrees south. Or, in the case of NSW, 0.25 degrees at Murwillumbah (24.5km) in the north of the state is wider than 0.25 degrees at Eden (22.2km) in the south. | First thing is, it's worth remembering that the UTM system slices the world up into a series of 6 degree zones, which are shaped like sections of an orange. These are flattened, and any grid is overlaid on this. For NSW (and many other places), individual maps are a fixed number of degrees wide. In the case of standard NSW 1:25k maps, they are 0.25 degrees wide. But 6 degrees at the equator is much wider than 6 degrees at 80 degrees south. Or, in the case of NSW, 0.25 degrees at Murwillumbah (24.5km) in the north of the state is wider than 0.25 degrees at Eden (22.2km) in the south. | ||
Line 13: | Line 20: | ||
The upshot of all of this is that maps are not nice rectangles that can just have the borders stripped off and dropped into a grid. However, there are some tools in the GDAL toolkit that will help us. | The upshot of all of this is that maps are not nice rectangles that can just have the borders stripped off and dropped into a grid. However, there are some tools in the GDAL toolkit that will help us. | ||
- | First step is to strip off the border of the PDF and convert to a raster format. We can do this for a single image using gdalwarp, by setting a few options, including: | + | ===== 1. Download eTopos ===== |
- | * -t_srs <target spatial reference> | + | These can be downloaded from [[https:// |
+ | |||
+ | While there is a 5 map per day limit, this can be naughtily bypassed by grabbing a copy of the {{ : | ||
+ | |||
+ | While you're there, also grab the {{ : | ||
+ | |||
+ | There is also a [[https:// | ||
+ | |||
+ | ===== 2. Remove borders ===== | ||
+ | |||
+ | Once you have the PDFs, the next step is to strip off the border of the PDF and convert to a raster format. We can do this for a single image using gdalwarp, by setting a few options, including: | ||
+ | * -t_srs <target spatial reference> | ||
* -r < | * -r < | ||
* -cutline - applies a mask to the raster (confusingly, | * -cutline - applies a mask to the raster (confusingly, | ||
Line 20: | Line 38: | ||
* -crop_to_cutline - crops to the mask applied under " | * -crop_to_cutline - crops to the mask applied under " | ||
* -dstalpha - sets an output alpha band so that the pixels that are outside the cutline but inside the bounding box are transparent. This is needed when merging in the next step | * -dstalpha - sets an output alpha band so that the pixels that are outside the cutline but inside the bounding box are transparent. This is needed when merging in the next step | ||
+ | * -co COMPRESS=LZW (optional) - will reduce the size of the intermediate GeoTiffs | ||
Sample command in full - you'll need to set your own directories, | Sample command in full - you'll need to set your own directories, | ||
Line 36: | Line 55: | ||
</ | </ | ||
- | You now have a directory of GeoTiffs. In Windows, you can run the following at the command line to create a list of all the files in a text document: | + | ===== 3. Generate file list ===== |
+ | |||
+ | You now have a directory of GeoTiffs. In Windows, you can run the following at the command line to create a list of all the .TIF files in a text document: | ||
< | < | ||
- | Unfortunately, | + | Unfortunately, |
< | < | ||
+ | |||
+ | ===== 4. Merge files ===== | ||
Finally, you can run gdal_merge, using the list from the previous step to create one huge GeoTiff. Note that normal GeoTiffs max out at 4GB, so you need to be selective about how many files you include in the merge. If you try to include too many, you will get errors, and a partially completed output. I got away with 56 1:25k maps, but the actual number will depend on various factors. There is a BIGTIFF=YES option that can be added to the -co option, but I don't know how this works in downstream processes/ | Finally, you can run gdal_merge, using the list from the previous step to create one huge GeoTiff. Note that normal GeoTiffs max out at 4GB, so you need to be selective about how many files you include in the merge. If you try to include too many, you will get errors, and a partially completed output. I got away with 56 1:25k maps, but the actual number will depend on various factors. There is a BIGTIFF=YES option that can be added to the -co option, but I don't know how this works in downstream processes/ | ||
Line 46: | Line 69: | ||
< | < | ||
- | For OziExplorer, | + | The GeoTiff file can be used as is in many applications. |
+ | |||
+ | There are other compression options ('' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | ===== 5. Create OZFX4 file for OziExplorer ===== | ||
+ | |||
+ | For OziExplorer, |
stitching_etopos.1688775781.txt.gz · Last modified: 2023/07/08 10:23 by bushwalking