This model takes an input image file and derives a polygon encompassing all pixels which are not "Background", effectively building a footprint for the real image data. The footprint is created as a Shapefile in the same directory as the input imagery and with the same root name, but with a user definable suffix appended to the root name. An attribute is also written into the Shapefile capturing the original filename (including path) of the input image.
|Left View shows the input ortho-rectified image, the right View shows the derived footprint polygon|
The model acts as an example of using the Convert to Features operator, introduced with ERDAS IMAGINE 2016, which provides the equivalent of "Raster to Vector" functionality. The vast majority of processing and analysis which is applied in Spatial Modeler (currently) occurs in the raster domain. But you often want the "features you've identified" in that processing to be used in a vector-based GIS system and so you need them to be converted into feature-based geometries. In the past this "Raster to Vector" conversion would have to be applied outside of the Spatial Modeler environment. However with the introduction of the Convert to Features operator this can now be incorporated into your Spatial Models, including further processing of the data in the features environment (such as buffering, measurement of attributes, etc.)
The upper "branch" is the main path for generating the footprint geometry. It takes the input image, checks to see at each pixel if all of the input bands contain DN 0 and if they do treats that pixel as Background. This does assume that the input image does not have NoData set. If NoData has been set, then a pixel where any band is NoData will also be treated as Background. All non-Background pixels are then converted to DN 1. Class 1 is then converted to a polygonal feature, an attribute field called Filename is appended and populated with the full pathname of the input image, and the feature written out as a Shapefile.
Note that since this model considers Background the resulting footprint is not necessarily a rectangle - it can be an irregular shape and can contain holes.
The lower branch is what analyses the input pathname to automatically derive the output Shapefile name and location. The full input pathname is deconstructed in order to strip off the extension (and "dot"), the user-specified Suffix is appended, as is ".shp", and this full, reconstructed pathname is passed onto the Features Output operator FilenameIn port. This provides a good example to follow for models where the output file name needs to be automatically generated based on the input filename,
An alternative would have been to use the Get Containing Directory operator for part of the reconstruction process, but this way provides an interesting example of how to go about manipulating strings.
Input Image: Name of the image from which to derive a non-background footprint polygon
Suffix: The suffix to append to the input file root name to create the name of the output Shapefile. For example, if the Input Image filename is "C:\Demo Data\Hickory_Flats\Landsat\Landsat 8\lc80190362014046lgn00-msi.img" and the Suffix is defined as _fpt, the output shapefile will be automatically generated as "C:\Demo Data\Hickory_Flats\Landsat\Landsat 8\lc80190362014046lgn00-msi_fpt.shp".
|Auto-generated dialog for Generate_Footprint-v16-0-4.gmdx|