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

Metadata/imagery does not always use a projected CRS, GSD units are inconsistent #170

Open
jveitchmichaelis opened this issue Apr 5, 2022 · 0 comments

Comments

@jveitchmichaelis
Copy link

I've crossposted this to oam-uploader-api but I'm not sure if that repository is monitored (nothing has been pushed in 5 years+). This is also relevant for metadata processing which may be a catalog operation.

I've been bulk processing some metadata from OAM and I noticed that the gsd parameter does not have consistent units. Some images report gsd in degrees (typically these are O(10^-6 to 10^-7)) and others are in metres as expected.

It seems like the browser handles this properly, as it'll show things like "2 cm" in the info panel. However looking in the metadata, this isn't always the case and it means that querying/filtering by GSD is not reliable. I'm not sure where this would need to be handled - perhaps in the uploader(?), as it's a fairly simple step to compute this for all uploads by default. I had a skim through the oam repos and couldn't see an obvious place where the meta gsd is obtained.

I'm also not sure if this is something that got fixed and there are just a bunch of outdated metadata files in the catalog? It would ideally need to be fixed at the ingest level, so that either images are checked to be in projected coordinates, or warping is performed to an appropriate CRS (but since that could vary depending on location it might be better to force users to do that).

For example, image ID: 59e62b703d6412ef72208f33

"_id": "59e62b703d6412ef72208f33",
 "uuid": "http://oin-hotosm.s3.amazonaws.com/1/0/55c3c39a2b67227a79b4f4e2.tif",
 "__v": 0,
 "title": "tacloban_part_2.tif",
 "projection": "GEOGCS[\"WGS84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]",
 "footprint": "POLYGON((124.99486944444445 11.250847222222223,125.01255555555555 11.250847222222223,125.01255555555555 11.240333333333332,124.99486944444445 11.240333333333332,124.99486944444445 11.250847222222223))",
 "gsd": 3.3787e-07,
 "file_size": 193758102,
 "acquisition_start": "2013-11-15T00:00:00.000Z",
 "acquisition_end": "2013-11-16T00:00:00.000Z",
 "platform": "UAV"

Note the GSD is teeny (and the metadata does state that the projection UNIT is degrees). Converting to metres using the script below, we get the correct answer (as an example):

>>> import rasterio
>>> from rasterio.warp import calculate_default_transform
>>> 
>>> # World Mercator
>>> dst_crs = "EPSG:3395"
>>> 
>>> img = "/data/oam/55c3c39a2b67227a79b4f4e2.tif"
>>>
>>> with rasterio.open(img) as src:
...     transform, width, height = calculate_default_transform(
...         src.crs, dst_crs, src.width, src.height, *src.bounds)
... 
>>> print(transform[0])
0.037854597087815925

Thanks!

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