Satshot-API
[ class tree: Satshot-API ] [ index: Satshot-API ] [ all elements ]
Prev Next

Scenes and Analysis

Viewing scenes and analyzing objects

Avi Blackmore Head Programmer/Administrator 2013 Agri ImaGIS Technologies, Inc.

Table of Contents

Scenes and Images

In the API documentation, several methods refer to "scenes", while others refer to "images". The term "scenes" is used to describe the raw, full-sized satellite imagery: a scene is one picture taken by a satellite. The master scene index can be queried, and individual scenes displayed, using API methods. Scenes are very large, and except for displaying them, the API does not operate directly on them at all. Instead, the API extracts images from the scene, and then operates on those images. "Image" in the API is the term for small chunks of a scene, or for derived works made from those chunks. An image will be referred to as "extracted" if it is just a portion of the original scene, an "analysis" if it is the result of our analysis method or the customizing methods, or an "edited image" if it has been directly edited.

Determining what scene to use for analysis is a matter of searching the scenes database for scenes which lie within a set of extents, and then choosing one. This is often a visual process; a given scene which lies over a geospatial object may be cloudy, with a cloud directly over the object, or with a nearby cloud casting a shadow onto it. Either way, analyzing that scene would give bad results. So, to aid in the quality control aspects, and to allow browsing of the scene catalog, the API exports a number of methods for searching and displaying scenes.

Scenes are catalogued by year, so the first method, get_available_scene_years(), provides a list of years for which Satshot has scenes available. With that information, it's possible to filter to specific years, or even months, when calling get_available_scenes(). This method returns scenes which lie within the current extents of the given map context; if using a map context isn't desireable, or updating its extents to search different areas would be too time-consuming, there are several search methods which take extents structs instead: get_available_scenes_for_extent() takes an extents struct and year and month filtering parameters, while the two methods get_available_scenes_for_extent_and_date_range() and get_available_scenes_for_multiple_extents_and_date_range() allow searching the given extents (or sets of extents) within a range of time that can span multiple months, or even years. Be advised that searching a large span of time, or not filtering for years or months at all, can result in a large amount of data being returned.

Metadata about scenes can be retrieved with get_scene_info() (or get_multiple_scenes_info()). The scene information includes the satellite, number of bands, projection, and other data.

Displaying scenes is accomplished with display_scene(). Due to technical constraints, one map context can only display one scene at a time; if displaying multiple scenes at once is desired, consider opening multiple contexts. The display_scene() method only prepares a display layer; a call to draw_map(), or a WMS request, is necessary to actually retrieve the resulting map image. Multiple calls to display_scene() with different scene ids will change the displayed scene; to clear the scene display layer from the map, call clear_displayed_scene().

It should be noted that scenes, when displayed, are displayed using a color-stretch, which enhances the contrast of the image bands. This is both visually more interesting, and more useful, because it allows for visual inspection to determine relative vegetation density. The scenes are displayed with the following bands in the Red, Green, and Blue "slots" for display: NIR, Green, and Red. This combination results in vivid false-color images which show high-vegetation areas as intensely red or yellow, and low-vegetation areas as gray or blue. Water tends to appear black or green. This same color-stretch is applied to the display of extracted images (see below). The color-stretch is done dynamically, only for display purposes, and does not alter the raw data in the scene, or extracted portions of the scene; the analysis is performed on raw, unstretched data.

Extraction

The extraction and analysis methods operate as a sort of pipline-style workflow, although not all methods need be called every time. Here is the basic pipeline, with optional parts delimited by parentheses: extract, (georeference), analyze. After analysis, the options open up: a user can proceed to save that analysis to permanent storage, customize it, edit the image directly, create a downloadable export file from the analysis or edited image, or create a vector spreadmap (an export format, but one that is saveable as a separate data source) based on an analysis or edited image. These operations can be "mixed and matched" at will, with few restrictions (notably, an edited image cannot be "customized" like it was still an analysis; see Customizing and Editing below). However, all of these options depend on having an analysis ready, which is a linear process.

The basic analysis workflow starts with extraction: this is the process of taking a geospatial object, finding its extents (bounding box), padding that bounding box with a bit of extra area, and then copying the portion of a scene which falls within that bounding box to a new image. This image is the extracted image, represented by the handle returned from extract_image_around_hilited_shape() (or extract_image_set_around_hilited_shapes()). As the method names imply, the objects around which the users wishes to extract imagery must be hilited, using one of the hiliting methods; further, they must be permanent saved objects, and must be selected from one of the three object layers ("boundaries", "locations", or "paths").

When extracting around a boundary, the process is straightforward: boundaries have a defined area for which extents can be determined. Other object types, however, present a problem: how do you determine the extents of a point? Or a linestring, if it only lies along one axis? In order to deal with this issue, the extraction methods take a parameter, BUFFER, which determines how to buffer the object to determine the extraction area. The buffer will also be used for analysis; if using specialty imagery, the area of the resulting buffered object will be used to determine the charges.

After extraction, the user may optionally adjust the positioning of the extracted image: this is called "georeferencing", since it changes the geospatial reference point which locates the image on the Earth's surface. This is sometimes necessary if the image is not quite correctly positioned; some images can be "off" by a certain number of meters, which would throw off the analysis results if not corrected. This correction is done via georeference_extracted_image() (or georeference_extracted_image_set()). It's a visual process, so clients should always present the user with a view of the image (or a representative sample of the image set) to work with.

Extracted images can be displayed on the map using create_image_display_layer() (or create_multiple_image_display_layers()). The display layers can be removed using remove_image_display_layer() (or remove_multiple_image_display_layers()). Information about the extracted image can be obtained with {@link get_image_info()} (or get_multiple_images_info()). This information includes the width, height, coordinate system, resolution in projected units, and origin point (upper left corner) in projected coordinates.

Extracted images are not much good by themselves; while it's possible for a trained eye to look at an image and determine certain details, for really useful information, the image must be analyzed. Alternatively, the extracted image can be exported in a processed format (see Processed Imagery).

Analysis

Image analysis is performed by analyze_extracted_image_set(). This process slices up the range of pixel values in one of the image's raw bands (or in a derived band based off of one or more of the raw bands) into a set of discrete "zones". Each zone is colored differently, and represents a range of the values in one of the raw image's bands (or a derived band). Each "band" is a single 8-bit color channel; scenes and the extracted images produced from them can store arbitrary numbers of such bands (though only three are displayed at a time, as RGB colors). The bands in a scene or extracted image correspond to different wavelengths sensed by the satellite. It is this information that the analysis algorithm examines when it produces an analysis.

There are three main parameters for an analysis on a particular image: the type, the mode, and the number of zones. Number of zones is the simplest parameter to explain: it's simply how many "slices" to divide the range of values into. A high number of zones shows lots of fine detail in variation, but can be harder to manage; lower numbers of zones are easier to understand, but may miss detail.

Analysis type defines what band of the raw image to examine. There are currently three supported types (there will be more soon): Near Infrared (NIR), Normalized Difference Vegetation Index - Red Band (NDVIR), and Normalized Difference Vegetation Index - Green Band (NDVIG). The first, NIR, looks at a single band of the source image, that being the Near Infrared band; its values are sliced up directly into zones. An NIR analysis shows the levels of near infrared reflection in the image, as is. The other two, however, examine a "derived band": the system performs a calculation with the values of the NIR and the other specified band (red or green), and turns the results into a new band, which is then sliced up by the analysis algorithm. This calculation helps to correct for different soil types, normalizing the results. (Other types, which will be added later, would perform different calculations, possibly on more than two bands; these analysis types are used for different purposes by agronomists and farmers.)

The second parameter, the mode, determines how the slicing works; more specifically, how the minimum and maximum points for each zone, and the full range of zones, are determined. There are three possible modes: "standard", "minmax", and "minmaxgroup". The standard mode simply sets the minimum point for the lowest zone (zone 1) at 0, and the maximum point at 255. Thus, for a given analysis type, and number of zones, a particular zone in standard mode always represents the same range of values. This is very valuable for comparisons between images, or even between scenes. However, it has a tendency to show less variation, since most images do not have band values spread over the full 8-bit range. In fact, the range of actual values in an image band is usually much narrower. Thus, a standard analysis will often have "empty" zones.

To show full variation, and to make "prescription maps" for export (see Exports, below), most users will use the "minmax" mode. This mode selects as its minimum point for zone 1 the lowest band value in the image, and the maximum point the highest band value. This smaller range is then sliced up into the given number of zones, which makes it easier to see fine detail. However, since every extracted image has a different minimum and maximum of band values, minmax analyses cannot be compared with each other: a particular zone in minmax analysis A will not necessarily correspond to the same zone in minmax analysis B, and in fact should be assumed not to correspond. This is fine, because minmax images are not intended for comparisons to begin with. Instead, they're intended to slice up the actual range of values, which is useful for making a prescription map, or for seeing details of variation for other purposes.

A compromise between the standard and minmax modes, "minmaxgroup" is only meaningful for analyzing a group of images, all extracted from the same scene. This is like minmax, except that instead of choosing a minimum and maximum point for each individual image, the analyzer examines all of the images for their min and max points, and then sets the lowest zone min point to the lowest of the mins, and the highest zone max point to the highest of the maxes. This shows more variation than a standard analysis, but still allows comparisons between the analyses within this particular set of images: the zone colors in any of the analyses in a minmaxgroup-analyzed image set all have the same meaning. However, this DOES NOT hold with other minmaxgroup analyses that were not part of the same group of images! Also, the variation shown is still not as great as that with minmax, which means it's very possible to see "empty" zones in a minmaxgroup analysis set, as well.

A fourth parameter, which is optional, is the colortable to use for assigning colors to each zone. The colortables available can be obtained by calling get_available_colortables(). Each colortable is defined in terms of its descriptive name, its colors, the maximum number of zones available when using it, and the counting method used to select colors for a zone. The counting method can be either "scale", in which case the range of values in the image is scaled over the number of available colors; "countup", in which case the first zone is always color 1, second is color 2, etc; or "countdown", in which case the last zone is always the top color, second-to-last the second-from-top color, etc. Most of the time, using the default color table is fine.

Finally, the last parameter of importance is the BUFFER parameter; this is used when analyzing objects which are not boundaries. This exists for the same reason as given for the extraction methods.

Analyses and edited images are displayed using the same display layer methods as used for extracted images.

Customizing and Editing

The default analysis algorithm slices an image band into a number of equally-sized zones. Sometimes, this isn't what the user wants; they may want to combine zones into a larger range, or expand a zone so that it covers a slightly larger range of values. For this purpose, the API provides a few customizing methods, which alter the analysis in a controlled fashion. These are merge_analysis_zones(), which combines two or more zones into one, new zone, shift_analysis_zone_endpoints(), which shifts the "end points" between zones, and change_image_zone_color(), which changes the color representing a zone in an analysis (or edited image). Each of these methods creates a new image, and returns a new image handle, without modifying the original image.

There are also a few methods for editing the image directly: these methods do not modify the analysis parameters, but directly modify the image (or rather, directly modify a copy created from the existing image), which allows for much greater modifications. The methods paint_image_polygons_with_map_coordinates() and paint_image_polygons_with_pixel_points() fill in polygonal regions on the image with a specific zone color, while dissolve_image_regions() (or dissolve_image_regions_for_multiple_images()) merges small areas below a threshold size in pixels into larger neighboring regions. Again, each of these methods returns a new image handle for a new image. The input image is never altered directly.

Analyses which are customized are still considered analyses; they are still related to the original image in a direct fashion, they still have all the information on the classification scheme used, etc. They are saved as analyses in the database, and are reloaded as such. Edited images, on the other hand, are not necessarily still related in a controlled fashion to the original analysis: in particular, painted regions need not correspond at all to the patterns in the original image. Thus, they are a separate category: if a method can only operate on an analysis, an edited image cannot be substituted, and vice versa. Moreover, they are saved separately (analyses are saved with save_analysis() or save_multiple_analyses(), while edited images are saved with save_edited_image() or save_multiple_edited_images()), and have separate information methods (get_analysis_info() or get_multiple_analyses_info() for analysis, and get_edited_image_info() or get_multiple_edited_images_info() for edited images). The server-side code detects which type of image an image handle corresponds to, and will signal an error if the wrong type is passed in.

Aside from this hard division between analyses and edited images, though, the API enforces no ordering on how these methods are called, or how the results are presented by the client. Because each of these methods returns a new handle, instead of overwriting the image specified in its argument, clients can keep a "history" of all of the customization and editing done in a particular session. This enables clients to implement an easy "undo" functionality: just show the previous image. Indeed, a client could even maintain a "tree" of customizing and editing history, so that a user could backtrack to any previous state; whether this is worth doing is up to the client programmer.

Method Reference

Scene search and viewing:

Object selection for extraction: Extraction and analysis: Custom analysis and editing: Image dataset display: Saving and reloading: Information:

Prev Up Next
Regions and Objects Understanding and Using the Satshot Services API, Version 2 Vectors, Exports and Reports

Documentation generated on Wed, 19 Aug 2026 18:55:24 -0500 by phpDocumentor 1.4.4