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

Support "serverless" Cloud Optimized Geotiffs in EW #867

Closed
mapninja opened this issue May 23, 2022 · 3 comments
Closed

Support "serverless" Cloud Optimized Geotiffs in EW #867

mapninja opened this issue May 23, 2022 · 3 comments

Comments

@mapninja
Copy link

mapninja commented May 23, 2022

"As a researcher using drone acquired data at The Stanford Farm, I would like to deposit the data I create (orthophotography and digital elevation models), into the SDR, and make it available through Earthworks."

Cloud Optimized Geotiffs are quickly becoming the default archival and analysis-ready format for imagery-based geospatial data. A Cloud Optimized GeoTIFF (COG) is a regular GeoTIFF file, aimed at being hosted on a HTTP file server, with an internal organization that enables more efficient workflows on the cloud. It does this by leveraging the ability of clients issuing ​HTTP GET range requests to ask for just the parts of a file they need.

https://www.cogeo.org/

This work would support the addition of Cloud-optimized GeoTiffs, as a supported data deposit format for discovery in Earthworks. Scanned & Georeferenced Maps, Satellite & Drone Imagery, and any other pixel-based & georeferenced data can be deployed in this way. SDR is capable, at this point, of serving COGs without additional infrastructure.

This enhancement would also be a step toward future work to automatically harvest and archive imagery ordered through the Planet.com API by Stanford researchers (we have the right to re-download unmetered, and retain in perpetuity, any imagery accessed by Stanford researchers).

The work here, would be limited to geoblacklight/Earthworks work to recognize a COG record and enable Leaflet to display it on an item page.

This can be accomplished two ways, I think:
Geoserver intervention (using Geoserver would require addition of the COG Plugin), so that external COG sources (in our case, SDR-based) can be "passed through" Geoserver to our existing Leaflet previews on items pages.

Or directly in the Leaflet Preview map, using the library highlighted in the example, below.

Here's a COG direct from SDR, in a leaflet map:
https://web.stanford.edu/~maples/cog/leaflet_cog.html

Collection PURL:
https://purl.stanford.edu/vq494qx9344

Stacks URL for COG in Map:
https://stacks.stanford.edu/file/druid:vq494qx9344/odm_orthophoto_COG_d.tif

Using:
https://github.com/GeoTIFF/georaster-layer-for-leaflet

<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css"/>
    <style>
      #map {
        bottom: 0;
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
    <script src="https://unpkg.com/proj4"></script>
    <script src="https://unpkg.com/georaster"></script>
    <script src="https://unpkg.com/georaster-layer-for-leaflet"></script>
    <script>
      // initalize leaflet map
      var map = L.map('map').setView([37.42663274227526,-122.18297839164735], 19);

      // add OpenStreetMap basemap
      L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
          attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
      }).addTo(map);

      var url_to_geotiff_file = "https://stacks.stanford.edu/file/druid%3Avq494qx9344/odm_orthophoto_COG_d.tif";

      parseGeoraster(url_to_geotiff_file).then(georaster => {
        console.log("georaster:", georaster);

        /*
            GeoRasterLayer is an extension of GridLayer,
            which means can use GridLayer options like opacity.
            Just make sure to include the georaster option!
            http://leafletjs.com/reference-1.2.0.html#gridlayer
        */
        var layer = new GeoRasterLayer({
            attribution: "Planet",
            georaster: georaster,
            resolution: 128
        });
        layer.addTo(map);

        map.fitBounds(layer.getBounds());

    });

    </script>
  </body>
</html>
@mapninja
Copy link
Author

Complication for both approaches, above, is that Stacks URLs are apparently not guaranteed to be stable.

@thatbudakguy thatbudakguy moved this to Blocked in Geo Workcycles 2024 Nov 28, 2022
@thatbudakguy
Copy link
Member

blocked while we figure out how to best serve this content.

@thatbudakguy
Copy link
Member

Completed now that we're on GBLv5, since its viewers natively support displaying COGs and we can deposit them too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants