QGreenland Researcher Workshop 2023
It’s common for data to be missing metadata. We often see:
NoData
) not setIt’s also not uncommon for data or metadata to be incorrect or in conflict with the dataset’s user guide. Fixing these issues requires thought and judgment calls.
The best one for the job. Explore the alternatives available in the ecosystem you want to work!
It’s worth looking at the list of drivers for your datatype and reading the documentation. We’ll revisit this in a later slide.
Driver: GTiff/GeoTIFF
Files: dem_without_metadata.tif
Size is 301, 561
Metadata:
TIFFTAG_XRESOLUTION=1
TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 561.0)
Upper Right ( 301.0, 0.0)
Lower Right ( 301.0, 561.0)
Center ( 150.5, 280.5)
Band 1 Block=301x6 Type=Float32, ColorInterp=Gray
Use gdal_translate to edit the metadata with the information provided to us in the mock dataset landing page.
Driver: GTiff/GeoTIFF
Files: dem_with_metadata.tif
Size is 301, 561
Coordinate System is:
PROJCRS["unknown",
BASEGEOGCRS["unknown",
DATUM["unknown",
ELLIPSOID["unknown",6378137,298.257024882273,
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433,
ID["EPSG",9122]]]],
CONVERSION["Polar Stereographic (variant B)",
METHOD["Polar Stereographic (variant B)",
ID["EPSG",9829]],
PARAMETER["Latitude of standard parallel",71,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8832]],
PARAMETER["Longitude of origin",-39,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8833]],
PARAMETER["False easting",0,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",south,
MERIDIAN[90,
ANGLEUNIT["degree",0.0174532925199433,
ID["EPSG",9122]]],
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["(N)",south,
MERIDIAN[180,
ANGLEUNIT["degree",0.0174532925199433,
ID["EPSG",9122]]],
ORDER[2],
LENGTHUNIT["metre",1]]]
Data axis to CRS axis mapping: 1,2
Origin = (-802500.000000000000000,-597500.000000000000000)
Pixel Size = (5000.000000000000000,-5000.000000000000000)
Metadata:
AREA_OR_POINT=Area
TIFFTAG_XRESOLUTION=1
TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( -802500.000, -597500.000) ( 92d19'49.93"W, 80d48'38.29"N)
Lower Left ( -802500.000,-3402500.000) ( 52d16'15.67"W, 58d36'12.78"N)
Upper Right ( 702500.000, -597500.000) ( 10d37' 3.76"E, 81d31'36.98"N)
Lower Right ( 702500.000,-3402500.000) ( 27d20' 3.47"W, 58d47'17.98"N)
Center ( -50000.000,-2000000.000) ( 40d25'55.55"W, 71d44'12.84"N)
Band 1 Block=301x6 Type=Float32, ColorInterp=Gray
The gdal
VRT driver can be used.
Add a kcbcc_DS4_final_v2_final.vrt
with the following content:
<OGRVRTDataSource>
<OGRVRTLayer name="Sheet1">
<SrcDataSource>kcbcc_DS4_final_v2_final.xlsx</SrcDataSource>
<SrcLayer>Sheet1</SrcLayer>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>EPSG:4326</LayerSRS>
<GeometryField encoding="PointFromColumns" x="x" y="y" reportSrcColumn="FALSE" />
</OGRVRTLayer>
</OGRVRTDataSource>
Then, use ogr2ogr
:
{
"type": "FeatureCollection",
"name": "kcbcc",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features": [
{
"type": "Feature",
"properties": {
"cuteness_rating": 9.226,
"blood_acetone_grams_per_ml": 1.945e-05,
"blood_acetylcholine_grams_per_ml": 7.22e-08
},
"geometry": {
"type": "Point",
"coordinates": [
-63.3070952173288,
76.9630048613197
]
}
},
...<clipped for brevity>...
]
}
INFO: Open of `output.geojson'
using driver `GeoJSON' successful.
Layer name: kcbcc
Geometry: Point
Feature Count: 12
Extent: (-63.307095, 64.081793) - (-22.181734, 76.963005)
Layer SRS WKT:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
cuteness_rating: Real (0.0)
blood_acetone_grams_per_ml: Real (0.0)
blood_acetylcholine_grams_per_ml: Real (0.0)
Metadata may be undocumented or incorrectly documented; contact data producer!
Warning
It’s possible nobody living knows how to fix the problem!
See continued learning to learn more about how georegistration could help.