-
Notifications
You must be signed in to change notification settings - Fork 43
Codap-335 geotiffs #1885
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
base: main
Are you sure you want to change the base?
Codap-335 geotiffs #1885
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1885 +/- ##
===========================================
- Coverage 86.36% 69.86% -16.51%
===========================================
Files 673 675 +2
Lines 34737 34887 +150
Branches 9841 9864 +23
===========================================
- Hits 30000 24373 -5627
- Misses 4579 10356 +5777
Partials 158 158
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
codap-v3
|
||||||||||||||||||||||||||||
| Project |
codap-v3
|
| Branch Review |
codap-335-geotiff
|
| Run status |
|
| Run duration | 01m 44s |
| Commit |
|
| Committer | Scott Cytacki |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
3
|
| View all changes introduced in this branch ↗︎ | |
|
I took a look at this more: the PR, the libraries, Leaflet, the NEO files, and the projection standards. Now it makes sense that we can't just use the png images directly in Leaflet. @tealefristoe you might have figured this all out already, but I'll summarize here for the record. Leaflet always works in the spherical mercator projection where the image get stretched both vertically and horizontally as you move towards the poles so angles are preserved and the aspect ratio is more maintained when zoomed in. This projection is defined with the code The NEO images are in basic Additionally the transform of the GeoTIFF raster to the leaftlet projection can't be done via simple html5 canvas or CSS transforms. So my idea that the NEO pngs would be better because we could render them directly onto a cavas without reading through the pixels ourselves is not possible. I suspect there are some WebGL shader based transforms which can do this kind of conversion very efficiently. There was hint at this in the docs of one of the leaflet libraries. Notes on the libraries:
So given all of this. I think it would be best for me to spend a bit more time on My concern as before is that this approach will be too slow when we are trying to animate 250 images on the map. For each frame the code will have to decode the image, and project it. So if this proves to be a problem, then I think we'll need to "pre-project" the images and store those on the server. This way all the animation is doing is loading in the images using the browsers built in native decompression. But even though this is a concern it still seems best to put a little more time into the slower options because I'm hopeful there will be a small bug to fix and we can have something for people to play with sooner. |
Jira story: https://concord-consortium.atlassian.net/browse/CODAP-335
This PR Is about displaying geotiff files over maps in Codap.
The first step was introducing a
geotiffUrlfield toMapContentModel. When this field is set, the map will download and display the geotiff at the specified url.Currently, there is no UI in Codap to set this field. The only way to set it is to make an
update mapAPI request. Unfortunately, the map API handlers were very bare bones before this PR, so I had to expand them quite a bit to even get this working.The next step is actually displaying the geotiff in
leaflet, which has proven to be quite challenging. I was able to find two libraries that accomplish this. I also experimented with displaying a PNG or JPEG map inleaflet. Unfortunately, none of these methods worked particularly well. Code has been left inmap-interior.tsxto easily try any of the three options--just comment out the two you don't want to use.Testing
geotiffUrlvalue. See below for instructions.Geotiff Data
Data can be found here: https://neo.gsfc.nasa.gov/dataset_index.php#atmosphere
Datasets of interest are:
To get the url for a particular dataset:
geotiffUrl.georaster-layer-for-leaflet
Results:
Errors:
Invalid array length
This error occurs while running
parseGeorasterfrom thegeorasterlibrary.Invalid byte order
This error occurs while running
parseGeorasterfrom thegeorasterlibrary.Failed to fetch
This error occurs irregularly (once while trying Land Surface Temperature .1 degrees during recent testing). It happens while running
response.arrayBuffer()ingetGeorasteringeotiff-utils.ts.leaflet-geotiff-2
Note: An earlier test version used the
geotifflibrary to access the geotiff's color map, but I'm now usinggeorasterinstead. That means that the color version of this library no longer works with dataset/resolution combos that fail due togeoraster.While doing this thorough test, I was surprised to see that things worked differently than they did previously. My best guess why is the
geotiff->georasterchange (even though I turned off color for these tests). In any case, Active Fires used to work forleaflet-geotiff-2, but no longer.Results:
Errors:
Invalid typed array length
This error occurs when calling
L.leafletGeotiff.Invalid array length
this.tiff.getImage is not a function
When this error occurs, the geotiff is rendered over the map, but it is improperly placed and projected. The rendered geotiff is even in color when the
ColorMapRendereris set to render in black and white.This seems to be the result of the same error seen in
georaster-layer-for-leaflet:PNG and JPEG
These are easy to display using basic
leaflet. Unfortunately, without the projection provided with geotiff renders, these maps do not fit the Codap maps properly.