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

parseGeoraster .ovr detection #69

Open
sammertime opened this issue Aug 4, 2022 · 5 comments
Open

parseGeoraster .ovr detection #69

sammertime opened this issue Aug 4, 2022 · 5 comments

Comments

@sammertime
Copy link

sammertime commented Aug 4, 2022

Hi,

Great package! I'm using this along with georaster-layer-for-leaflet to overlay cloud optimized geotiffs on a leaflet map.

Going off of the various examples here https://github.com/GeoTIFF/georaster, when I use the "load from url on front-end"/arraybuffer example, it works fine. However, when I use the "load cloud optimized geotiff" example where no arraybuffer is used, I get a HEAD 403 error from the parseGeoraster function - it seems to be looking for a .ovr file that doesn't exist. My files have internal overviews and thus no .ovr files should exist, but the parseGeoraster function seems to automatically look for a .ovr file and throws an error if not found..

I see in the description for this method - "It will also attempt to automatically discover any available overview files." Will this method work with cog's with internal overviews vs external? Is there a way I can bypass this error or an option I can provide to specify that my files use internal overviews? I'd much prefer to avoid loading the whole file via the arraybuffer route for speed/efficiency purposes i.e. one of the main benefits of a cog.

Thanks much for any insight!

Best,
S

@DanielJDufour
Copy link
Member

DanielJDufour commented Aug 4, 2022 via email

@sammertime
Copy link
Author

sammertime commented Aug 5, 2022

Thanks for the prompt reply Daniel!! Much appreciated..

So it sounds like an error I can just ignore when using parseGeoraster on a cog? i.e. not going the arrayBuffer route.

I've switched over to that method but now it looks like the mins, maxs, and ranges are missing from georaster. Is that expected behavior i.e. do I need to extract that information using another method when using parseGeoraster without an arrayBuffer?

Sorry for doubling up on the question.

Thanks!!
S

@DanielJDufour
Copy link
Member

No prob. They are great questions and the answers will help others who read this, too!

Q: So it sounds like an error I can just ignore when using parseGeoraster on a cog?
A: Yes that is correct

Q: I've switched over to that method but now it looks like the mins, maxs, and ranges are missing from georaster. Is that expected behavior i.e. do I need to extract that information using another method when using parseGeoraster without an arrayBuffer?
A: It's expected because georaster wants to avoid calculating statistics which would require it to fetch all the pixel data. You don't need statistics to do a visualization as newer versions of GeoRasterLayer (if you are using LeafletJS) will dynamically calculate statistics from the user rendered pixels. It's not the true stats, but good enough for most visualization. Because it's JavaScript, you can also directly add mins, maxs and ranges properties to the georaster object as well. You could also just specify a pixelValuesToColorFn.

Note: I'm doing a big multi-year refactor of georaster and improving statistical calculations is definitely a part of that. I think currently, it won't read COG's GDAL stats metadata, but that will improve in the future.

Let me know if you have any other questions.

@sammertime
Copy link
Author

10-4! Understood - thanks again! I plan to use a pixelValuesToColorFn and was doing so using the min/max/ranges and the arrayBuffer method but now I just need to figure out how to do the same using parseGeoraster without arrayBuffer - working on that now : )

S

@sammertime
Copy link
Author

Hi again Daniel,

Another question regarding this packages .ovr file detection. Though my cog's are loading as expected, the performance/speed of load is not what I was hoping for. In looking into it via the "network" tab of the developer tools, I'm wondering if it's because of the query for the external overview files that don't exist on my end. Attached is a screenshot of the network tab when I load a single cog on the map. That top line in red is the query for the external overview and, as you can see, it's eating up the majority of time to load compared with the cog, which was in the browser cache for this example.

I *think I read elsewhere that there is no way around this at this time? If that's the case and considering performance is of a high priority for me, would I be better off for the time being going with another package? If so, any suggestions? i.e. should I go with geotiff.js instead?

I'd love to use this package but if I'm unable to get around the default query for external overviews, I'm wondering if it makes sense to use another package for now - understanding of course that there is an overhaul underway, as you mentioned.

Many thanks,
S

Screen Shot 2022-09-26 at 18 26 29

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

2 participants