Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save a custom CRS definition in a GeoTiff? #7

Open
scottyhq opened this issue Jan 8, 2025 · 0 comments
Open

How to save a custom CRS definition in a GeoTiff? #7

scottyhq opened this issue Jan 8, 2025 · 0 comments

Comments

@scottyhq
Copy link
Member

scottyhq commented Jan 8, 2025

After a conversation with @dshean I looked into saving a custom WKT within a geotiff, I was surprised to not come across any solutions today 😳, so I sent a message to gdal-dev, copied below. cc @ShashankBice

https://lists.osgeo.org/pipermail/gdal-dev/2025-January/060026.html


I’ve looked around for an answer to this one to no avail and would appreciate any insight from those more familiar with the GeoTiff format. I’d like to be able to store a custom WKT inside GeoTiff metadata rather than in an external PAM file. I’ve seen some solutions to add custom entries in the PROJ database to accomplish this, but is that really the only way?

Here is a motivating example, using a WKT that specifies a specific WGS84 realization for a given UTM zone:

INPUT=https://opentopography.s3.sdsc.edu/raster/COP30/COP30_hh/Copernicus_DSM_10_N38_00_W109_00_DEM.tif
OUTPUT=/tmp/Copernicus_DSM_10_N38_00_W109_00_DEM_UTM.tif

CPL_DEBUG=ON \
 GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR \
 gdalwarp -co GEOTIFF_VERSION=1.1 -overwrite -dstnodata 0 -r bilinear -tap -tr 30.0 30.0 -s_srs EPSG:7661 -t_srs utm12N_wgs1150.wkt $INPUT $OUTPUT

Here is the wkt, I’d like for it not to end up in a sidecar file where I might loose it, but embedded in the GTiff:

PROJCRS["WGS84 (G1150) / UTM zone 12N",
    BASEGEOGCRS["WGS 84 (G1150)",
        DYNAMIC[
            FRAMEEPOCH[2001]],
        DATUM["World Geodetic System 1984 (G1150)",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",7661]],
    CONVERSION["UTM zone 12N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",-111,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]],
        ID["EPSG",16012]],
    CS[Cartesian,3],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["ellipsoidal height (h)",up,
            ORDER[3],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
    USAGE[
        SCOPE["unknown"],
        AREA["Between 114°W and 108°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - Alberta; Northwest Territories (NWT); Nunavut; Saskatchewan. Mexico. United States (USA)."],
        BBOX[0,-114,84,-108]],
    REMARK["Custom WKT2 combining UTM_12N with WGS84 (G1150)”]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant