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

Fall back to footprint when COG isn't georeferenced #14

Open
m-mohr opened this issue Oct 14, 2021 · 9 comments
Open

Fall back to footprint when COG isn't georeferenced #14

m-mohr opened this issue Oct 14, 2021 · 9 comments
Labels
bug Something isn't working
Milestone

Comments

@m-mohr
Copy link
Collaborator

m-mohr commented Oct 14, 2021

Originates from radiantearth/stac-browser#101 and was written originally by @AsgerPetersen:

The Items in this demo catalog https://skraafotodistribution-stacfastapi.k8s-test-121.septima.dk/ have footprints, but their COGs are not georeferenced as they are not rectified.

It would be nice if the browser would fall back to the footprint in that case.

image

@DanielJDufour
Copy link
Member

I dug a little deeper and the issue is that I'm missing a try-catch in georaster which causes the promise to parse the GeoRaster to never complete when this error occurs. Here's a link to the line where I need to add a try/catch: https://github.com/GeoTIFF/georaster/blob/master/src/parseData.js#L83. When I manually throw the error, stac-layer works fine.

I'll fix georaster and this should fix the downstream issues.

@m-mohr
Copy link
Collaborator Author

m-mohr commented Oct 14, 2021

Sounds great, thanks. I thought this would be a new feature and not a bugfix :-)

@m-mohr m-mohr added bug Something isn't working and removed enhancement New feature or request labels Oct 14, 2021
@DanielJDufour
Copy link
Member

Small update. I tried to fix this in georaster with GeoTIFF/georaster@93d6491#diff-5369190f55138dab912f4f97bca88335d0f783f50e14cda286672c7e5821963aR83, but it didn't work. The issue is that georaster uses old school promises and not async/await, so I have to update the code not just there, but everywhere else along the promise chain to make sure the error is sent all the way up (not to mention that the promise rejection is inside a web worker, so the error has to be sent as a message to the main thread).

I'm working on a massive upgrade to georaster at the moment (including using async/await), but that probably won't be complete for still a couple months. I've already sank 2 hours into doing a hotfix to georaster, so I'm not optimistic about this path.

That said, I think there is an easier solution. I can just fetch the first 1k bytes and then check if the projection information is in there using geotiff.js or is-cog. If it's not, don't run parseGeoraster. I'll keep you updated.

@m-mohr m-mohr added this to the 1.1.0 milestone Oct 14, 2021
@DanielJDufour
Copy link
Member

This will hopefully be addressed by #13 whereby if the georaster doesn't finish parsing after 5 seconds, it will move onto the next load option. I know it's not perfect, but should hopefully be sufficient until the next major release of georaster (hopefully by the end of the year).

@m-mohr m-mohr modified the milestones: 1.1.0, 1.0.0 Apr 3, 2022
@m-mohr
Copy link
Collaborator Author

m-mohr commented Mar 2, 2023

The original data is not available anymore, is there a successor URL/file we could test with @AsgerPetersen?

@AsgerPetersen
Copy link

This is the production version of the STAC api: https://api.dataforsyningen.dk/skraafoto_api/v1.0/?token=6f27c9754e42e3ded6042f804203579b

The API and its data are free and open but requires a user token. I have created a token specifically for this issue, but I cannot guarantee for how long the token will survive. Ping me again if it stops working.

@m-mohr
Copy link
Collaborator Author

m-mohr commented Mar 3, 2023

@AsgerPetersen Thanks a lot! Would you be okay with us downloading one of the GeoTiffs and (maybe after cropping), putting it with attribution (CC-BY 4.0) on https://github.com/GeoTIFF/test-data so that we avoid the token issue?

@AsgerPetersen
Copy link

According to the license link on the items (https://dataforsyningen.dk/Vilkaar) CC-BY 4.0 is allowed. The name of the creator is "Styrelsen for Dataforsyning og Infrastruktur"

@m-mohr
Copy link
Collaborator Author

m-mohr commented Mar 3, 2023

@AsgerPetersen Thank you!

@DanielJDufour If you think this is a good idea, could you take care of this? I don't think I can push to the test-data repo...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants