Friday, September 29, 2023

Tiling for Geo Map Referencing in QGIS




 QGIS on X11

I needed to convert a JPEG image into a georeferenced PDF, which I was able to do, finding things to fix later along the path.

The issue with starting at the top is the image is too big to share cleanly, so breaking the problem into parts led to tiles showing a fraction of the big picture.

Source of data I used to feed into QGIS were a history file of geo-tagged Panoramio images (such as this one of Oest Chapel; just kidding it's the Marble Hill campsite latrine).

QGIS versions

Turns out the Raspberry Pi 4 (aka 400) factory warranty operating system has an older QGIS release than other systems I tried to use. Windows had 3.32.2-Lima, OpenSUSE had QGIS 3.32.0-Lima, and a couple *BSD were at  qgis-3.28.11 or so. Raspbian had QGIS 3.10.14-A Coruña.

Thus, I worked on OpenSUSE and Windows. Would have like to do more on FreeBSD as that box has the best processors in the house. On the downside, OpenSUSE didn't have Viking, and I couldn't build the venerable XPaint (was able to use screengrab for the docs here in the house).

The "Georeferencer" button is either there or it isn't. I've looked on the older versions and despite the copious documentation pages the function escapes me.

One note I read said you could get away with only 3 control points; the program insisted on at least 4 per run. I used 10 in an earlier projection reference which was tedious but not too complex.

The icons are a little fuzzy to me and I tend to use the pull-down menus. Maybe after doing a few dozen I'll get the shortcuts down.

Georeference and the GCP table

The above image shows a map (loaded from a JPEG file) with 4 control points in the table at the bottom. I've circled those points on the image as there are no text labels in this view.

For this example, I chose the northeast (more or less) corners of a couple buildings - the main warehouse, and Prospect cabin, and the corner of the pool, and about where the water tower is. Even though the spots seem pretty close, there is definite warpage of the trails on different map levels.

After running the referencer code a TIFF image file is produced that contains the geotagging needed to correct use.

Broad_Creek 2023_225dpi-01-OEST-CHAPEL_modified.tif:     
TIFF image data, little-endian, direntries=16, height=477, bps=206, compression=none, PhotometricInterpretation=RGB, width=615

TIFF image data, little-endian, direntries=16, height=506, bps=206, compression=none, PhotometricInterpretation=RGB, width=508

The PDF production

I have not set the geo-PDF as a default so must check both of these boxes to get a PDF.

Then it just works.
Loading in Avenza is the best test, even better to run it within the map borders to get the location shown.