Skip to content

Latest commit

 

History

History
130 lines (85 loc) · 5.9 KB

020-raster-demo.adoc

File metadata and controls

130 lines (85 loc) · 5.9 KB

Raster Demo

In this demo, we will be looking at Band 8 of Landsat raster data around Berlin, Germany. See USGS.gov for more information about Landsat 8.

Install GDAL

The Landsat 8 extension for GeoWave utilizes GDAL (Geospatial Data Abstraction Library), an image processing library, to process raster data. In order to use GDAL, native libraries need to be installed on the system. More info on GDAL can be found here.

GeoWave provides a way to install GDAL libraries with the following command:

$ geowave raster installgdal

Configure GeoWave Data Stores

Important

Before continuing the demo, make sure that your working directory is the current active directory in your command-line tool.

For this demo, we will be using two data stores. One will be used for vector data, and the other will be used for raster data. Again, replace $HOSTNAME with the Master public DNS of the EMR cluster:

  1. Accumulo

    $ geowave store add -t accumulo -z $HOSTNAME:2181 landsatraster --gwNamespace geowave.landsat_raster -i accumulo -u geowave -p geowave
    
    $ geowave store copycfg landsatraster landsatvector --gwNamespace geowave.landsat_vector
  2. HBase

    $ geowave store add -t hbase -z $HOSTNAME:2181 landsatraster --gwNamespace geowave.landsat_raster
    
    $ geowave store copycfg landsatraster landsatvector --gwNamespace geowave.landsat_vector
  3. Cassandra

    $ geowave store add -t cassandra --contactPoints $HOSTNAME:2181 landsatraster --gwNamespace geowave.landsat_raster --batchWriteSize 15
    
    $ geowave store copycfg landsatraster landsatvector --gwNamespace geowave.landsat_vector

These commands creates a store for the raster data, and then copies that store configuration, changing only the namespace for the vector data store. The result is that the data for both stores will be on the same key/value store, but under different namespaces, so GeoWave will treat them as separate data stores.

Add an Index

Before ingesting our raster data, we will add a spatial index to both of the data stores.

$ geowave index add -t spatial -c EPSG:3857 landsatraster spatial-idx
$ geowave index add -t spatial -c EPSG:3857 landsatvector spatial-idx

This is similar to the command we used to add an index in the vector demo, but we have added an additional option to specify the Coordinate Reference System (CRS) of the data. Geospatial data often uses a CRS that is tailored to the area of interest. This can be a useful option if you want to use a CRS other than the default. After these commands have been executed, we will have spatial indices named spatial-idx on both data stores.

Analyze Available Data

We can now see what Landsat 8 data is available for our area of interest.

$ geowave util landsat analyze --nbestperspatial true --nbestscenes 1 --usecachedscenes true --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" -ws ./landsat

This command tells GeoWave to analyze the B8 band of Landsat raster data over a bounding box that roughly surrounds Berlin, Germany. It prints out aggregate statistics for the area of interest, including the average cloud cover, date range, number of scenes, and the size of the data. Data for this operation is written to the landsat directory (specified by the -ws option), which can be used by the ingest step.

Ingest the Data

Now that we have analyzed the available data, we are ready to ingest it into our data stores.

$ geowave util landsat ingest --nbestperspatial true --nbestscenes 1 --usecachedscenes true --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" --crop true --retainimages true -ws ./landsat --vectorstore landsatvector --pyramid true --coverage berlin_mosaic landsatraster spatial-idx

There is a lot to this command, but you’ll see that it’s quite similar to the analyze command, but with some additional options. The --crop option causes the raster data to be cropped to our CQL bounding box. The --vectorstore landsatvector option specifies the data store to put the vector data (scene and band information). The --pyramid option tells GeoWave to create an image pyramid for the raster, this is used for more efficient rendering at different zoom levels. The --coverage berlin_mosaic option tells GeoWave to use berlin_mosaic as the type name for the raster data. Finally, we specify the output data store for the raster, and the index to store it on.

Visualizing the Data

We will once again use GeoServer to visualize our ingested data.

Configure GeoServer

GeoServer should already be configured from the previous demo, but if not, go ahead and configure it now:

$ geowave config geoserver "$HOSTNAME:8000"

Add Layers

Just like with the vector demo, we can use the GeoWave CLI to add our raster data to GeoServer. We will also add the vector metadata from the vector data store.

$ geowave gs layer add landsatraster --add all
$ geowave gs layer add landsatvector --add all

View the Layers

When we go back to the Layer Preview page in GeoServer, we will see three new layers, band, berlin_mosaic, and scene.

Click on the OpenLayers link by any of these layers to see them in an interactive map.

berlin_mosaic - Shows the mosaic created from the raster data that fit into our specifications. This mosaic is made of 5 images.

berlin mosaic preview
Figure 1. Preview of berlin_mosaic Layer

band/scene - Shows representations of the vector data associated with the images. The band and scene layers are identical in this demo.

scene preview
Figure 2. Preview of band and scene Layers