Skip to content

Ingesting imagery

Dave Johnson edited this page Jan 15, 2015 · 1 revision

In order for MrGeo to execute map algebra on images, raw imagery must be ingested into the MrsPyramid format. A MrGeo image can be ingested from a single raw image file or from a collection of raw image files. Ingesting images is done via the command line interface. The options available can be seen by running the command with no arguments:

mrgeo-cmd/src/main/scripts/mrgeo ingest

where you'll get the following output:

Missing required option: o
usage: ingest <options> <input>
 -c,--categorical                   Input [pixels] are categorical values
 -d,--debug                         Debug (very verbose) logging
 -l,--local-runner                  Use Hadoop's local runner (used for
                                    debugging)
 -lc,--local                        Use local files for ingest, good for
                                    small ingests
 -m,--mean                          Mean (Average) Pyramid Pixel
                                    Resampling Method
 -max,--maximum                     Maximum Pyramid Pixel Resampling
                                    Method
 -min,--minimum                     Minimum Pyramid Pixel Resampling
                                    Method
 -minavgpair,--miminumaveragepair   Minimum Average Pair Pyramid Pixel
                                    Resampling Method
 -n,--nearest                       Nearest Pyramid Pixel Resampling
                                    Method
 -nd,--nodata <arg>                 override nodata value
 -nr,--norecursion                  Do not recurse through sub-directories
 -nt,--notags                       Do not automatically load tags from
                                    source images
 -o,--output <arg>                  MrsImagePyramid image name
 -pl,--protectionLevel <arg>        Protection level
 -q,--quick                         Quick ingest (for small files only)
 -s,--sum                           Summing Pyramid Pixel Resampling
                                    Method
 -sp,--skippyramid                  Skip building pyramids
 -t,--tags <arg>                    tags (fmt: "k1,v:k2,v:..."
 -v,--verbose                       Verbose logging

You can ingest imagery that resides either on the local file system or in HDFS. In the simple case where there is a single raw image file being ingested, the command line to ingest from HDFS would look like:

# Push the raw image file into HDFS
hadoop fs -put /home/myself/myImage.tif /mrgeo/raw-images

# Ingest the raw image file into a MrsPyramid named "myImage"
mrgeo-cmd/src/main/scripts/mrgeo ingest -o myImage /mrgeo/raw-images/myImage.tif

and ingesting from the local file system would look like:

mrgeo-cmd/src/main/scripts/mrgeo ingest -o myImage file:///home/myself/myImage.tif

A MrGeo image can also be ingested from a directory into a single MrGeo image. It recurses through the directory, ingesting and tiling all of the image files. When ingesting multiple raw image files to a single MrsPyramid, if some of the raw images overlap, unfortunately there is no predictable ordering available in MrGeo yet. As it generates each tile, it will simply choose the pixel values from one of the files.

mrgeo-cmd/src/main/scripts/mrgeo ingest -o myImage file:///home/myself/myImage

You can disable the directory recursion with the -nr argument.