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

Class: core_api

Source Location: /core_api.php

Class Overview


Provides core services for the Satshot Services API. All systems will have these services.


Methods


Child classes:

mapcenter_api
Provides services for precision agriculture "Mapcenter" systems.

Class Details

[line 28]
Provides core services for the Satshot Services API. All systems will have these services.



[ Top ]


Class Methods


static method change_image_zone_color [line 6328]

static string change_image_zone_color( string $imagehandle, struct $colorzones)

Changes the color of one or more zones in analysis or edited image IMAGEHANDLE to given RGB values. COLORZONES is a struct keyed to zone numbers, each of which must be in range 1 .. (number of zones), and with values being RGB structs, as follows:

  • red: Integer, 0 .. 255.
  • green: Integer, 0 .. 255.
  • blue: Integer, 0 .. 255.

All three color components may not be zero (i.e., a zone may not be colored pure black).

Returns a new image handle for the image.

Use of this method requires the "precisionag" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have the "precisionag" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_ANALYSIS_PARAMS Zone cannot be pure black.
access:  public


Parameters:

string   $imagehandle   Image handle of the analysis.
struct   $colorzones   Struct specifying zones and new colors.

[ Top ]

static method classify_multiband_analyses [line 5344]

static struct classify_multiband_analyses( struct $mbclassopts)

Classifies the multiband analyses in MBCLASSOPTS, returning single-band classified analyses. MBCLASSOPTS is a struct keyed to the image handle of the multiband analyses; the image handles passed in as the keys of this top level struct must correspond to multiband analysis images, and not to raw images, classified analyses, or edited images.

The values associated with these multiband handle keys are structs describing the classifications to perform for each multiband analysis. These classification description structs are keyed to the data band name to be used. Available band names are NIR (straight near-infrared classification), NDVIR (Normalized Difference Vegetation Index using the red band), NDVIG (NDVI using the green band), NDWI, REDEDGE (RapidEye only, straight classification of the red-edge band), and NDVIREDEDGE (RapidEye only, NDVI using the red-edge band). The value for each band key is an array of "classifier" structs, defined as follows:

  • mode: Slicing mode to use. String value, one of "standard", "minmax", or "custom". If set to "custom", custom zones must be provided in the "zones" field, below. This field is always required.
  • numzones: Number of zones to classify. Integer, must be between 2 and the number of colors available, either in a colortable (see "colortable", below) or provided colors (see "colors", below). Required unless "mode" is set to "custom", in which case it is ignored.
  • colortable: Color table to use for assigning colors to zones. Integer, must correspond to a colortable ID as given by get_available_colortables(). Required unless "colors" (see below) is set, in which case it is ignored.
  • zones: Array of zone intervals for custom slicing mode; this field is required when "mode" is set to "custom", otherwise it is ignored. The first interval will be applied to create the first zone, the second to the second zone, and so forth. Each element in the array is a struct consisting of at least two fields: "min" and "max", containing the minimum and maximum values the given zone will cover. The value ranges can either be floating point NDVI values (ranging from -1 to +1), for NDVI bands, or integer values for the given band, for NIR or REDEDGE. Zones must be ordered in the array in ascending value order, with the "max" of one zone being the "min" of the next, i.e., with no gaps between the value ranges of the zones. The band statistics for the input multiband images from get_analysis_info() can be useful for calculating the proper zone intervals for NIR or REDEDGE. Optionally, a third field can be set in the zone struct for any given zone: "mask", a boolean value. If set to true, the given value range will not be classified, but will be skipped over, setting the pixels which match that value range to null values. Masked zones will still show up in the zone table, and they will be counted for assignment of colors from either the colortable or custom colors in "colors"; however, the pixel values in the masked zones will not show up in the analysis. It is an error if all zones are masked: at least one non-masked zone is required for analysis.
  • colors: Array of zone color entries to assign to zones; if this is set, the "colortable" field is ignored. The first color will be applied to the first zone, the second to the second zone, and so on. Each element is an array of red, green, and blue values, in that order (RGB tuples). No two zone colors are allowed to be identical. If "mode" is "custom", then the number of colors in this color array must equal the number of zones, masked or not, in "zones"; otherwise, the number of colors must be equal to "numzones".

Multiple classifier structs can be provided in the array for each band; this will generate multiple classified analyses for the band in question. Thus, this method can perform multiple classifications, on multiple bands, from multiple multiband input images.

The entire MBCLASSOPTS struct will look something like this:

 Struct("handle1" => Struct("NIR" => Array(Struct("mode" => "minmax",
                          "numzones" => 17,
                          "colors" => [COLOR ARRAY]),
                    Struct("mode" => "minmax",
                          "numzones" => 31,
                          "colortable" => 1)),

             "NDVIR" => Array(Struct("mode" => "custom",
                        "zones" => [ZONE ARRAY],
                        "colors" => [COLOR ARRAY])
                      Struct("mode" => "standard",
                        "numzones" => 8,
                        "colortable" => 2))),
    "handle2" => Struct(....))
In this case, the first multiband ("handle1") will have its NIR band classified two ways: first using minmax mode, with 17 zones, using a custom set of colors, and second in minmax mode, with 31 zones, using colortable 1. Its NDVIR band will be classified two different ways: a custom mode slice, using the custom zones in "zones" and custom colors in "colors", and secondly using standard mode, with 8 zones, and using color table 2. Similar, or completely different, options can be provided for "handle2", in the same format.

Returns a struct with somewhat similar structure: the top level is keyed to the multiband analysis handles; the values for those keys are structs which are keyed to the band names, and whose values are arrays of image handles for the new classified analyses. The handles in the array will be in the order that corresponds to the classifier structs whose parameters were used to generate them; thus, in the example above, the first handle in the array under "handle1" => "NIR" will be the one classified using "minmax" mode, 17 zones, and the custom colors, the second one will be the one using minmax mode, 31 zones, and colortable 1, and so forth.

Use of this method requires the "analyze" privilege. Additionally, use of the "custom" analysis mode (and thus the "zones" parameter) or "colors" parameter requires the "precisionag" privilege.




Tags:

exception:  BAD_ANALYSIS_PARAMS Type or mode not supported, or colortable not found, or number of zones out of range.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "analyze" privilege, or attempted to use custom zones or colors and does not have "precisionag" privilege.
access:  public


Parameters:

struct   $mbclassopts   Multiband classification description struct

[ Top ]

static method clear_displayed_scene [line 3667]

static boolean clear_displayed_scene( string $mapcontext)

Removes scene display layer from the map MAPCONTEXT. It is only necessary to call this method when the user desires to display no scene at all; to change which scene is displayed, it is sufficient to call display_scene() with a new sceneid argument.

Returns TRUE if there was an scene layer to remove, FALSE otherwise.

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

string   $mapcontext   The map context.

[ Top ]

static method clear_hilites [line 2056]

static boolean clear_hilites( )

Removes all hilited shapes from the user's hilite layers.

Returns true.




Tags:

access:  public


[ Top ]

static method create_hilite_objects_from_wkt [line 7570]

static struct create_hilite_objects_from_wkt( struct $objects, [string $coordsys = "+init=EPSG:4269"], [struct $hiliteids = null])

Creates new hilited objects from the object specification structs in OBJECTS. OBJECTS is a struct keyed to the object names, with values being OGC Well-Known Text geometries. The WKT geometries may be of the following types: POINT, LINESTRING or MULTILINESTRING, or POLYGON or MULTIPOLYGON.

COORDSYS is the coordinate system in which the objects in OBJECTS are defined: it defaults to latlong NAD83, and must be set if the coordinate points of the polygons are not latlong.

HILITEIDS, if set, must be a struct keyed to the names of the objects, with values being the IDs of existing hilited objects. The existing objects are updated with the new geometry and name, but retains the same ID and other attributes; this is useful for updating the names and geometries of permanently saved objects, saving the changes using the UPDATE flag in save_hilited_objects().

The newly created hilited objects are not permanent, but can be saved using save_hilited_objects().

Use of this method requires the "create_geoobjects" privilege. Setting the HILITEIDS parameter to update existing objects also requires the "modify_geoobjects" privilege.

Returns the resulting hilite info struct, as returned by get_hilites(). This struct includes info on all hilited shapes, not just ones which were created in a particular call to this function.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION NAME parameter was empty, or coordinate system not recognized.
exception:  INSUFFICIENT_PRIVILEGES User does not have create_geoobjects privilege, or set HILITEID and does not have modify_geoobjects privilege.
exception:  INVALID_VECTOR Geometry in WKT parameter was not valid WKT, or unsupported geometry type, or was malformed (contained self-intersections).
access:  public


Parameters:

struct   $objects   Objects struct containing names and WKT.
string   $coordsys   Coordinate system (WKT or proj4) of the WKT. Defaults to latlong NAD83.
struct   $hiliteids   Struct mapping names to IDs to update.

[ Top ]

static method create_image_display_layer [line 4342]

static boolean create_image_display_layer( string $mapcontext, string $imagehandle, [string $title = ''], [integer $hilite = null])

Creates a display layer for the image IMAGEHANDLE on the map MAPCONTEXT. IMAGEHANDLE must correspond to an image in the user's temporary files; it is not the ID of a permanently stored image.

The layer is created toward the bottom of the layer stack, just above the background map layers (DOQ, NAIP, or Virtual Earth layers). This can be changed with move_layer(). If TITLE is set, this optional "alternative" name will be saved to the layer, and will show up in the layer info from get_map_layers(). This can be useful for saving a "display" name. If HILITE is set, this ID, which corresponds to the layer's boundary, will be saved to the layer and will show up in the layer info. This is useful for filtering purposes.

Returns the ID of the newly created layer, or of the existing layer if it already existed.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $imagehandle   The image handle.
string   $title   Title (alternative name) for this layer. Optional.
integer   $hilite   Hilite ID for this layer's boundary. Optional.

[ Top ]

static method create_multibands_from_extracted_image_set [line 5133]

static struct create_multibands_from_extracted_image_set( struct $hiliteimages, [struct $options = array()])

Creates multiband-type analysis datasets for each of the raw extracted images in struct HILITEIMAGES. HILITEIMAGES is a struct keyed to the hiliteid of each hilited object to analyze, with values being the corresponding raw image handles, as returned by extract_image_set_around_hilited_shapes().

Multiband analyses are unclassified composites of the derived band values from the raw image. In order, each band in a multiband is as follows: NIR (scaled to 8-bit), NDVI-Red, NDVI-Green, and for RapidEye raw images, Red Edge (scaled to 8-bit), and NDVI-Red Edge. A multiband derived from a RapidEye raw image will thus have 5 bands, while one derived from a Landsat, ASTER, or other raw image will have 3 bands.

Multiband analyses may be saved, reloaded, and exported like any other analyses; furthermore, they may be used as input to classify_multiband_analyses(), generating classified analyses from the bands of the multiband.

OPTIONS is an optional struct of additional parameters for analysis, which are only needed in special circumstances. The following keys are recognized:

  • buffer: The amount by which a non-boundary object will be buffered, in meters. This is valid for analyzing locations or paths, but is ignored for boundaries. If not provided, defaults to 100.

Returns a struct keyed to the hiliteid, with values being the image handles of the generated multiband analyses.

Use of this method requires the "analyze" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have the "analyze" privilege.
exception:  HILITE_NOT_FOUND Given hilite for image handle does not exist.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Overridden in child classes as:

mapcenter_api::create_multibands_from_extracted_image_set()
Creates multiband-type analysis datasets for each of the raw extracted images in struct HILITEIMAGES. HILITEIMAGES is a struct keyed to the hiliteid of each hilited object to analyze, with values being the corresponding raw image handles, as returned by extract_image_set_around_hilited_shapes().

Parameters:

struct   $hiliteimages   Hilite-raw image mapping.
struct   $options   Struct of other options to pass in. Optional.

[ Top ]

static method create_multiple_image_display_layers [line 4461]

static struct create_multiple_image_display_layers( string $mapcontext, array $imglist, [struct $titles = array()], [ $hilites = array()])

As create_image_display_layer(), but creates layers for all the image handles in array IMGLIST. TITLES is an optional struct keyed to the image handles in IMGLIST, with values being the alternative "display" name to save for each layer. Titles can be set for all, some, or none of the handles. Similarly, HILITES is an optional struct keyed to the image handles, values being the hilite IDs for each handle's hilite boundary. This information can also be set for all, some, or no handles.

Returns a struct keyed to the image handles in IMGLIST, with values being the layer IDs of the new layers (or existing layers if they already existed);




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
array   $imglist   Array of image handles.
struct   $titles   Struct of titles for each handle's layer. Optional.
   $hilites  

[ Top ]

static method create_soilmap_vectors_for_boundaries [line 8364]

static struct create_soilmap_vectors_for_boundaries( array $hilitelist)

Creates a soilmap vector for each hilited boundary whose hiliteid is in array HILITELIST. The hiliteids must identify a hilited boundary which corresponds to a permanent field.

Each soilmap vector is a polygon dataset representing the soil regions within the given boundary. Basic attributes, such as the symbolic and descriptive names, are included. Soilmap vectors can be displayed and manipulated using any of the vector dataset functions.

This method does not currently support creating soilmap vectors for locations or paths.

Returns a struct keyed to the hiliteids in HILITELIST, with values being the vector handles of the corresponding soilmap vectors.

Use of this method requires the "create_soilmap" privilege.




Tags:

exception:  HILITE_NOT_FOUND No shapes hilited or given hilite ID does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "create_soilmap" privilege.
access:  public


Parameters:

array   $hilitelist   List of hiliteids.

[ Top ]

static method display_scene [line 3338]

static boolean display_scene( string $mapcontext, integer $sceneid)

Adds a display layer for the scene with index SCENEID to the map MAPCONTEXT. SCENEID must be an scene visible within the current extents. The display layer is named "displayimg".

If a scene was already displayed on the map, that scene layer is removed, and a new one is created. It is not necessary to call clear_displayed_scene() first.

Returns TRUE if the layer was created (scene found and visible), FALSE otherwise.

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

string   $mapcontext   The map cotext.
integer   $sceneid   Scene index.

[ Top ]

static method display_scene_by_item_id [line 3526]

static boolean display_scene_by_item_id( string $mapcontext, string $sceneid)

As display_scene(), but for scenes whose SCENEID is a string identifier rather than an integer

index — currently, this means scenes returned by get_available_scenes_for_extent_and_date_range() for Sentinel-2 imagery, which is sourced live from a satellite imagery API instead of the legacy scene database. Check the type of the SCENEID you have to know which of the two methods to call: numeric IDs go to display_scene(), string IDs come here. Adds a display layer for the scene to the map MAPCONTEXT. The display layer is named "displayimg".

If a scene was already displayed on the map, that scene layer is removed, and a new one is created. It is not necessary to call clear_displayed_scene() first.

Returns TRUE if the layer was created, FALSE if the scene could not be found.

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $sceneid   Scene identifier (string form).

[ Top ]

static method dissolve_image_regions [line 6647]

static string dissolve_image_regions( string $imagehandle, integer $minpixels)

Dissolves regions of the analysis or edited image IMAGEHANDLE which are smaller than MINPIXELS in size into the nearest region larger than MINPIXELS.

This causes the color of the region to change to that of the larger region, and thus become part of the larger region's zone. Zone acreage values will be changed, and the number of zones may also change.

Returns a new image handle for the resulting edited image. NOTE: If the image at IMAGEHANDLE was an analysis, the result will still be an edited image, and thus cannot be passed as an argument to merge_analysis_zones() or shift_analysis_zone_endpoints(). It also cannot be saved as an analysis, but must instead be saved as an edited image.

Use of this method requires the "precisionag" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have the "precisionag" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis or edited image.
access:  public


Parameters:

string   $imagehandle   The image handle.
integer   $minpixels   Minimum size of a region in pixels; regions smaller than this will be dissolved.

[ Top ]

static method dissolve_image_regions_for_multiple_images [line 6725]

static struct dissolve_image_regions_for_multiple_images( array $imagehandles, integer $minpixels)

As dissolve_image_regions(), but performs the dissolve operation on all analyses or edited images in array IMAGEHANDLES.

Returns a struct keyed to the image handles in IMAGEHANDLES, with values being the new image handles for the resulting edited images.

Use of this method requires the "precisionag" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have the "precisionag" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis or edited image.
access:  public


Parameters:

array   $imagehandles   Array of image handles.
integer   $minpixels   Minimum size of a region in pixels; regions smaller than this will be dissolved.

[ Top ]

static method download_multiple_saved_geotagged_photos [line 8338]

static struct download_multiple_saved_geotagged_photos( array $photoids, [integer|boolean $thumbnails = false])

As download_saved_geotagged_photo(), but returns a struct of multiple base64-encoded binary photos, keyed to the photo IDs listed in array PHOTOIDS. Values are the binary objects. The photos must be accessible to the user, either saved by the user or tied to objects the user can access.

THUMBNAIL, if set, specifies the size to resize the images (on their larger dimension), for instance, 128 means the longer dimension will be 128 pixels. Otherwise, false means retrieve the original images at full size.

If an ID is given for which no photo exists, that value will be boolean false.




Tags:

exception:  ACCESS_DENIED Photo not accessible to user.
access:  public


Parameters:

array   $photoids   Array of photo IDs of geotagged photos.
integer|boolean   $thumbnails   Retrieve thumbnails of given size, or false to retrieve full sized images. Optional, defaults to false.

[ Top ]

static method download_saved_geotagged_photo [line 8297]

static base64|boolean download_saved_geotagged_photo( integer $photoid, [integer|boolean $thumbnail = false])

Returns the base64-encoded binary file for the geotagged photo identified by PHOTOID. The photo must be accessible to the user, either saved by the user or tied to an object the user can access.

THUMBNAIL, if set, specifies the size to resize the image (on its larger dimension), for instance, 128 means the longer dimension will be 128 pixels. Otherwise, false means retrieve the original image at full size.

If no such photo exists, returns false.




Tags:

exception:  ACCESS_DENIED Photo not accessible to user.
access:  public


Parameters:

integer   $photoid   ID of the geotagged photo.
integer|boolean   $thumbnail   Retrieve thumbnail of given size, or false to retrieve full sized images. Optional, defaults to false.

[ Top ]

static method draw_map [line 1767]

static base64 draw_map( string $mapcontext, [string $format = 'PNG24'], [struct $options = array()])

Draws the map given by MAPCONTEXT. Returns the drawn image in the given FORMAT. Available formats are PNG24, JPG, GIF, GTIFF.

OPTIONS is a struct which defines additional options for controlling the output. Available options are as follow:

  • transparent: boolean. If true, the image background will be transparent. JPG images do not support transparency.
  • layers: array of layer index numbers (as returned by get_map_layers()) to draw. If set, only the layers listed will be drawn. Otherwise, all layers currently set to ON will be drawn.
  • size: array of two integers, width and height. If set, the map will be resized to these pixel values before drawing. Otherwise, current size will be used.

Invalid values for options will signal an error.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Attempt to set invalid size, or layer index given does not exist.
exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $format   Image format to output. Defaults to PNG24.
struct   $options   Struct of options for output.

[ Top ]

static method draw_map_for_multiple_display_layers [line 4563]

static struct draw_map_for_multiple_display_layers( string $mapcontext, array $layerlist, [boolean $reproject = false], [string $format = "PNG24"], [struct $options = array()])

Draws the map given by MAPCONTEXT, iterating over each display layer (image or vector) named in LAYERLIST, and returning the images in a struct keyed to the layer name.

The layer name is the name of the image or vector handle for which that layer was created. For each layer, the map is set to the layer's extents before drawing; layers which are not within the map's current extents (prior to calling this function) will be drawn correctly. The layers named in LAYERLIST must already exist in the map context prior to calling this function. If REPROJECT is true, the map will be reprojected into each layer's native projection; otherwise, the layers will be drawn in the map's set projection. FORMAT and OPTIONS are as specified for draw_map(). These options are applied globally to all map images returned. If the LAYERS option is set, the given layers will be drawn in addition to the layers in LAYERLIST, for each display layer drawn; for instance, the fields layer will be drawn on top of each display layer if its ID is in the array.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Must have at least one layer in layer list, or given layer in layerlist not a display layer, or invalid optional layer specification, or invalid optional size specification.
exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Given layer does not exist in map context.
access:  public


Parameters:

string   $mapcontext   The map context.
array   $layerlist   Array of layer names (image or vector handles)
boolean   $reproject   Use each layer's native projection (true) or map's current projection (false)
string   $format   Output format for each image (as for draw_map())
struct   $options   Options for output (as for draw_map())

[ Top ]

static method export_image_in_processed_format [line 7117]

static base64|string export_image_in_processed_format( string $imagehandle, string $name, [string $format = "GeoTIFF"], [string $process = "RESCALE"], [string $coordsys = "+init=EPSG:4269"], [struct $options = array()])

Returns the image IMAGEHANDLE (raw image only) in the format specified by FORMAT (defaults to GeoTIFF), after applying PROCESS to the raw image. The file will be named NAME, which is useful for multi-file formats where the names of the files inside the zip cannot otherwise be controlled. The image will be returned in the projection specified by COORDSYS, which defaults to latlong NAD83.

The image will be masked to only include the area contained within the field for which it was extracted, plus a small buffer around the field. The mask value will be the lowest value supported by the image's data type (0, for byte-based formats), or -2 for the floating point types (which are NDVI calculations).

Available formats are "GeoTIFF", "TIFF" ("TIFFW" with world file), "JPEG" ("JPEGW" with world file), "BMP" ("BMPW" with world file), "PNG" ("PNGW" with world file), "KMZ" (Google Earth KMZ file), "TXT" (Text point file), "shapefile" (ESRI point shapefile), "mapinfo" (MapInfo MIF/MID), "GML" (OGC GML), "KML" (Google Earth KML), "GeoJSON" (GeoJSON file), or "CSV" (comma-separated value). Other formats may become available in future.

Available processes are "RESCALE" (rescales the raw to an 8-bit range, returning all bands; only really meaningful for RapidEye images), "NDVIR" (does NDVI-Red calculation and returns single-band image), and "NDVIG" (as NDVIR, but does NDVI-Green calculation instead). Other processes may become available in future.

NOTE: "TXT" FORMAT cannot be combined with "RESCALE" PROCESS.

OPTIONS is a struct of optional parameters for various output formats, which are applied to the output image after the PROCESS, but before the image is returned. The options available vary by FORMAT, as follows:

  • type: Type of the output band. String. Can be one of "Byte", "UInt16", "Int16", "UInt32", "Int32", "Float32", "Float64". (Complex types are not meaningful for current processes.) Ignored for "RESCALE" process (that is always Byte type). Default for other processess is "Float32". Formats: GeoTIFF, TIFF, TIFFW, TXT. Other formats are always Byte type.
  • compression: Compression used. String. Can be one of "None", "Deflate", "LZW", "JPEG". JPEG should only be used with type "Byte". Formats: GeoTIFF, TIFF, TIFFW. Other formats either have their own compression, or (for TXT) are uncompressed.
  • scale: Scaling of the data to the new type. Array of two numbers, minimum and then maximum. Minimum must be < maximum, and both numbers must be in valid range for the given type. Note that the minimum value supported for a given type is the actual type minimum + 1, for instance, 1 for Byte, or -32767 for Int16. If type is set, and this is not, will default to the min-max range for the data type. Ignored for RESCALE process, which is always scaled 1-255. Formats: GeoTIFF, TIFF, TIFFW, TXT. Other formats automatically scale 0-255.
  • bands: Array of band numbers to use for the RGB values. Bands are numbered 1 through 5, and are in this order: NIR, Green, Red, Blue, Red-edge. Only used for "RESCALE", as the other processes are single-band. Formats: BMP, BMPW, JPEG, JPEGW, PNG, PNGW, KMZ.
  • url: Boolean. If set to true, then the processed image will be returned as a URL for download, instead of as a base64 binary. This URL will only remain valid for the duration of the session.

Note that the formats with world files are multi-file formats and are returned as a ZIP. (KMZ is itself a zip, but the KMZ file is treated as one entity by Google Earth.) Note also that the KMZ format is required to be in latlong NAD83, and thus the COORDSYS option will have no effect for that format.

Use of this method requires the "export_processed" privilege. Additionally, the RESCALE process requires the "export_processed_rescale" privilege.




Tags:

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Format not supported, or image is not a raw image.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "export_processed" privilege, or attempted to use RESCALE without "export_processed_rescale" privilege.
exception:  PARAMETER_CONSTRAINT_VIOLATION Unknown process, or coordinate system not recognized.
access:  public


Overridden in child classes as:

mapcenter_api::export_image_in_processed_format()
Returns the image IMAGEHANDLE (raw image only) in the format specified by FORMAT (defaults to GeoTIFF), after applying PROCESS to the raw image. The file will be named NAME, which is useful for multi-file formats where the names of the files inside the zip cannot otherwise be controlled. The image will be returned in the projection specified by COORDSYS, which defaults to latlong NAD83.

Parameters:

string   $imagehandle   Image handle.
string   $name   Name of the file.
string   $format   Format of the output (defaults to GeoTIFF).
string   $process   Process to apply to the raw image (defaults to RESCALE).
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.
struct   $options   Options struct. Optional.

[ Top ]

static method export_image_in_simple_format [line 6777]

static base64|string|struct|boolean export_image_in_simple_format( string $imagehandle, string $name, [string $format = "GeoTIFF"], [string $coordsys = "+init=EPSG:4269"], [boolean $url = false], [boolean $struct = false], [struct $emailopts = array()])

Returns the image IMAGEHANDLE (analysis, or edited image) in the format specified by FORMAT (defaults to GeoTIFF). The file will be named NAME, which is useful for multi-file formats where the names of the files inside the zip cannot otherwise be controlled. The image will be returned in the projection specified by COORDSYS, which defaults to latlong NAD83. If COORDSYS is set to an empty string, no reprojection will occur, and the image will be returned in its native projection (Universal Transverse Mercator, with appropriate zone for the location), unless FORMAT is set to "KMZ" (see below).

Available formats are "GeoTIFF", "TIFF" ("TIFFW" with world file), "JPEG" ("JPEGW" with world file), "BMP" ("BMPW" with world file), "PNG" ("PNGW" with world file), "KMZ" (Google Earth KMZ file), and "TXT" (Text point file). Other formats may become available in future.

Note that the formats with world files are multi-file formats and are returned as a ZIP. (KMZ is itself a zip, but the KMZ file is treated as one entity by Google Earth.) Note also that the KMZ format is required to be in latlong NAD83, and thus the COORDSYS option will have no effect for that format.

If URL is set to true, the image will be returned as a URL, instead of a base64-encoded binary. This URL will only remain valid for the duration of the active session.

If STRUCT is set to true, multi-file formats will be returned as a struct of individual base64-encoded binaries (or URLs, if URL is true), instead of as a zip file.

EMAILOPTS is an optional struct of parameters to send out emails containing a URL to the export, which does persist after the active session terminates. Valid keys are as follows:

  • emails: Array of email addresses for recipients of the export link. Mandatory; at least one email address must be provided.
  • comment: String, a comment to the recipients that will be placed in the body of the email message. Optional. Maximum length is 1024 characters (in UTF-8).

If EMAILOPTS['addresses'] is set, this method does not return the export data in any form, but returns boolean true if the emails were successfully constructed and sent. Errors will be signalled if the email addresses are not well-formed, or if no emails are provided. NOTE: Email links can only be sent for saved raster datasets. If the raster IMAGEHANDLE is not saved, an error will be signalled.

Use of this method requires the "export_processed" privilege if the image is a multiband analysis (not for other types of analysis).




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have the "export_processed" privilege, and attempted to export multiband.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Format not supported.
access:  public


Overridden in child classes as:

mapcenter_api::export_image_in_simple_format()
Returns the image IMAGEHANDLE (analysis, or edited image) in the format specified by FORMAT (defaults to GeoTIFF). The file will be named NAME, which is useful for multi-file formats where the names of the files inside the zip cannot otherwise be controlled. The image will be returned in the projection specified by COORDSYS, which defaults to latlong NAD83. If COORDSYS is set to an empty string, no reprojection will occur, and the image will be returned in its native projection (Universal Transverse Mercator, with appropriate zone for the location), unless FORMAT is set to "KMZ" (see below).

Parameters:

string   $imagehandle   Image handle.
string   $name   Name of the file.
string   $format   Format of the output (defaults to GeoTIFF).
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.
boolean   $url   Return URL of export instead of binary file.
boolean   $struct   Return multi-file formats in a struct.
struct   $emailopts   Options for sending export URLs by email.

[ Top ]

static method export_multiple_images_in_processed_format [line 7505]

static struct export_multiple_images_in_processed_format( struct $imagestruct, [string $format = "GeoTIFF"], [string $process = "RESCALE"], [string $coordsys = "+init=EPSG:4269"], [struct $options = array()])

As export_image_in_processed_format(), but returns multiple images with handles specified in IMAGESTRUCT, in the format FORMAT, applying the process PROCESS, projected as specified by COORDSYS, with OPTIONS applied as appropriate.

Formats and processses available are the same as for export_image_in_processed_format(). IMAGESTRUCT is a struct keyed to the image handles, with values being the file names for the output files (as the NAME parameter to export_image_in_processed_format()).

There is one difference between the OPTIONS accepted by this method, and the OPTIONS accepted by export_image_in_processed_format(). The "url" option is not boolean, but a string with one of two values: "combined" or "separate". If set to "separate", the returned struct will contain a URL for each exported image; if set to "combined", the exported image files will be collected into a ZIP file, and the URL for that combined file will be returned.

Returns a struct keyed to the image handles, with values being the binary files (or URLs, if "url" is set to "separate" in OPTIONS), or a URL string for downloading the ZIP archive of all of the files, if "url" is set to "combined" in OPTIONS.

Use of this method requires the "export_processed" privilege. Additionally, the RESCALE process requires the "export_processed_rescale" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have the "export_processed" privilege, or attempted to use RESCALE without "export_processed_rescale" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Format not supported.
access:  public


Overridden in child classes as:

mapcenter_api::export_multiple_images_in_processed_format()
As export_image_in_processed_format(), but returns multiple images with handles specified in IMAGESTRUCT, in the format FORMAT, applying the process PROCESS, projected as specified by COORDSYS, with OPTIONS applied as appropriate.

Parameters:

struct   $imagestruct   Image struct.
string   $format   Format of the output (defaults to GeoTIFF).
string   $process   Process to apply to the raw image (defaults to RESCALE).
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.
struct   $options   Options struct. Optional.

[ Top ]

static method extract_image_around_hilited_shape [line 3741]

static string extract_image_around_hilited_shape( string $mapcontext, string $sceneid, integer $hiliteid, [integer $buffer = 100])

Extracts a portion of the scene SCENEID around the extents of the hilited shape given in HILITEID, plus a buffer area. The source scene SCENEID need not already be displayed on the map. HILITEID must be the ID of a hilited shape which corresponds to a permanent boundary, not the permanent boundary id.

BUFFER, if provided, is the amount by which the shape is buffered in meters. BUFFER must be greater than zero, and defaults to 100.

The extracted raw image will be resampled to 5 meters per pixel, unless the source scene is already at that resolution or higher. IMPORTANT NOTE: The image is a temporary file, and will not persist between login sessions.

Use of this method requires the "analyze" privilege.

Returns the image handle for the extracted image.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  HILITE_NOT_FOUND No shapes hilited or given hilite ID does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "analyze" privilege.
exception:  PARAMETER_CONSTRAINT_VIOLATION Buffer value of 0 or less passed.
access:  public


Overridden in child classes as:

mapcenter_api::extract_image_around_hilited_shape()
Extracts a portion of the scene SCENEID around the extents of the hilited shape given in HILITEID, plus a buffer area. The source scene SCENEID need not already be displayed on the map. HILITEID must be the ID of a hilited shape which corresponds to a permanent boundary, not the permanent boundary id.

Parameters:

string   $mapcontext   The map context.
string   $sceneid   Image to extract.
integer   $hiliteid   HILITEID of hilite around which to extract.
integer   $buffer   Buffer size in meters. Defaults to 100.

[ Top ]

static method extract_image_set_around_hilited_shapes [line 4061]

static struct extract_image_set_around_hilited_shapes( string $mapcontext, string $sceneid, array $hilitelist, [integer $buffer = 100])

As extract_image_around_hilited_shape(), but extracts an image for each hilited shape in array HILITELIST from scene SCENEID, and returns a struct keyed to the IDs of the hilited shapes, with values being the image handles of the extracted images.

Use of this method requires the "analyze" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  HILITE_NOT_FOUND No shapes hilited or given hilite ID does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "analyze" privilege.
exception:  PARAMETER_CONSTRAINT_VIOLATION Buffer value of 0 or less passed.
access:  public


Overridden in child classes as:

mapcenter_api::extract_image_set_around_hilited_shapes()
As extract_image_around_hilited_shape(), but extracts an image for each hilited shape in array HILITELIST from scene SCENEID, and returns a struct keyed to the IDs of the hilited shapes, with values being the image handles of the extracted images.

Parameters:

string   $mapcontext   The map context.
string   $sceneid   Image to extract.
array   $hilitelist   List of HILITEIDs of hilites around which to extract.
integer   $buffer   Buffer size in meters. Defaults to 100.

[ Top ]

static method georeference_extracted_image [line 4830]

static boolean georeference_extracted_image( string $imagehandle, integer $eastingchange, integer $northingchange)

Adjusts the georeferencing of the extracted image IMAGEHANDLE, adding EASTINGCHANGE to the image's easting (longitudinal, x-axis) position, and NORTHINGCHANGE to the northing (latitudinal, y-axis) position. Positive EASTINGCHANGE moves the image to the east, while negative moves it west; similarly, positive NORTHINGCHANGE moves the image north, and negative moves it south.

Either EASTINGCHANGE or NORTHINGCHANGE can be set to 0 to leave that coordinate unchanged; setting both to 0 is harmless, but silly.

Use of this method requires the "analyze" privilege.

Returns true.




Tags:

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "analyze" privilege.
access:  public


Parameters:

string   $imagehandle   The image handle.
integer   $eastingchange   Change to easting coordinate (in meters).
integer   $northingchange   Change to northing coordinate (in meters).

[ Top ]

static method georeference_extracted_image_set [line 4881]

static boolean georeference_extracted_image_set( array $imagelist, integer $eastingchange, integer $northingchange)

As georeference_extracted_image(), but applies the EASTINGCHANGE and NORTHINGCHANGE arguments to every extracted image in array IMAGELIST. IMAGELIST must be an array of image handles.

Use of this method requires the "analyze" privilege.

Returns true.




Tags:

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "analyze" privilege.
access:  public


Parameters:

array   $imagelist   List of image handles.
integer   $eastingchange   Change to easting coordinate (in meters).
integer   $northingchange   Change to northing coordinate (in meters).

[ Top ]

static method get_analysis_info [line 5752]

static struct get_analysis_info( string $imagehandle, [struct $options = array()])



Tags:

deprecated:  

This method is being phased out in favor of get_rasters_info().

Returns a struct describing the analyzed image IMAGEHANDLE, as follows:

  • width: Image width in pixels.
  • height: Image height in pixels.
  • resolution: Resolution in meters per pixel.
  • projection: Image's projection (in WKT).
  • origin: Origin point of image (in image's coordinate system).
  • extents: Extents of the image (in latlong).
  • sourcesceneid: Scene ID of the source scene.
  • sourcescene: Name of the source scene.
  • objecttype: Type of the object analyzed (boundaries, locations, or paths).
  • objectid: ID of the object analyzed.
  • type: Analysis type used (band or composite bands analyzed).
  • mode: Analysis mode used (standard or minmax).
  • numzones: Number of zones in analysis. For a multiband analysis, this will be 0, as it is unclassified.
  • acres: Total acreage of the analyzed image area. Not present for multiband analyses.
  • createdate: Date and time this image was saved (ISO 8601 format).
  • zones: List of structs describing the details of each classification zone. Not present for multiband analyses, which are unclassified. List indexes are 0..numzones - 1, value structs are as follows:
    • zonenum: Zone number.
    • color: RGB tuple describing the color of the zone.
    • acres: Acreage of the zone.
    • expression: The logical expression which defines the zone classification, i.e., the pixel values of the raw image which fall within this zone. Expression is in MapServer expression format.
    • minval: Minimum value for this zone's value range; all values greater than or equal to this value are within the zone.
    • maxval: Maximum value for this zone's value range; all values less than (NOT less than or equal to!) this value are within the zone.
  • bandinfo: For multiband analyses only, statistics for each band in the image, namely the minimum, maximum, mean, and standard deviation of values within the bounds of the hilited object for which this image was extracted. Struct with keys "min", "max", "mean", and "stddev". If the key "banddata" is set to true in OPTIONS, an additional key, "data", will be present, containing a two-dimensional grid array of the band values. Will not be present for other analysis types.

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis.
access:  public


Parameters:

string   $imagehandle   The image handle.
struct   $options   Optional parameters.

[ Top ]

static method get_available_colortables [line 5014]

static struct get_available_colortables( )

Returns a struct describing the available colortables for use in classifying analyses. The colortables can be chosen using the COLORTABLE parameter to analyze_extracted_image_set().

The struct is keyed to the ID of each colortable, with values being a struct defined as follows:

  • name: Descriptive name of the colortable.
  • method: Counting method used to choose colors from the colortable.
  • maxzones: Maximum number of analysis zones usable with this colortable.
  • colors: Array of color description structs, starting from 0. Each color description struct has three members, "red", "green", and "blue".




Tags:

access:  public


[ Top ]

static method get_available_maps [line 189]

static struct get_available_maps( [double $xcord = null], [double $ycord = null], [string $coordsys = "+init=EPSG:4269"])

Returns a struct describing the available maps for loading. Struct keys are the abbreviations or short names of the regions (states, provinces, or countries) represented by the maps, values are description structs, defined as follows:

  • name: Full name of this map.
  • extents: Default extents of this map in latlong/NAD83.

If XCORD and YCORD are set, the map names will be filtered by a point query: only the map which contains the point XCORD,YCORD (which must be latlong unless COORDSYS is set) will be returned.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION One of XCORD or YCORD set without the other set.
exception:  MAP_NOT_FOUND No map found for given coordinates.
access:  public


Parameters:

double   $xcord   X coordinate (longitude in latlong). Optional, but must be set if YCORD is set.
double   $ycord   Y coordinate (latitude in latlong). Optional, but must be set if XCORD is set.
string   $coordsys   Coordinate system (WKT or proj4) of the coordinates. Defaults to latlong.

[ Top ]

static method get_available_scenes [line 2837]

static array|boolean get_available_scenes( string $mapcontext, [integer $year = 'any'], [integer $month = 'any'])

Returns a struct of scene description structs, keyed to the scene index, within the current extents of MAPCONTEXT.

If no scenes are available given the extents (and optional parameters), returns FALSE.

Scene description struct is as the return value of get_scene_info().

Optionally, YEAR can be set to restrict the results to a particular year, and MONTH to restrict to a particular month. Either can be set without the other being set.

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

string   $mapcontext   The map context.
integer   $year   Year (4 digits).
integer   $month   Month (integral, Jan=1, Feb=2, etc).

[ Top ]

static method get_available_scenes_for_extent [line 2927]

static array|boolean get_available_scenes_for_extent( struct $extents, [string $coordsys = "+init=EPSG:4269"], [integer $year = 'any'], [integer $month = 'any'])

Returns a struct of scene description structs, keyed to the scene index, within the current extents of EXTENTS. EXTENTS is an extents struct (keys are minx, miny, maxx, maxy), with coordinates in the coordinate system COORDSYS. All four coordinate keys in EXTENTS must be set.

If no scenes are available given the extents (and optional parameters), returns FALSE.

Scene description struct is as the return value of get_scene_info().

Optionally, YEAR can be set to restrict the results to a particular year, and MONTH to restrict to a particular month. Either can be set without the other being set.

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Extents coordinate missing or invalid, or coordinate system not recognized.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

struct   $extents   Extents struct.
string   $coordsys   Coordinate system (WKT or proj4) of the coordinates. Defaults to +init=EPSG:4269.
integer   $year   Year (4 digits).
integer   $month   Month (integral, Jan=1, Feb=2, etc).

[ Top ]

static method get_available_scenes_for_extent_and_date_range [line 3019]

static array|boolean get_available_scenes_for_extent_and_date_range( struct $extents, string $startdate, string $enddate, [string $coordsys = "+init=EPSG:4269"], [array $scenetypes = array()])

Returns a struct of scene description structs, keyed to the scene index, within the extents of EXTENTS, and with scene shooting dates between STARTDATE and ENDDATE, inclusively. EXTENTS is an extents struct (keys are minx, miny, maxx, maxy), with coordinates in the coordinate system COORDSYS. All four coordinate keys in EXTENTS must be set. STARTDATE cannot be equal to or after ENDDATE, or an error is signalled.

SCENETYPES, if set, limits the search to scenes of the given, particular types (satellite or aerial provider). Valid scene types include, but are not limited to, 'Landsat', 'RapidEye', 'ASTER', 'SPOT', and 'aerial'. The array's strings are case-insensitive.

If no scenes are available given the extents (and optional parameters), returns FALSE.

Scene description struct is as the return value of get_scene_info().

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Extents coordinate missing or invalid, or coordinate system not recognized, or invalid startdate or enddate, or startdate after enddate.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

struct   $extents   Extents struct.
string   $startdate   Starting date (ISO 8601 format).
string   $enddate   Ending date (ISO 8601 format).
string   $coordsys   Coordinate system (WKT or proj4) of the coordinates. Defaults to +init=EPSG:4269.
array   $scenetypes   Array of scene types.

[ Top ]

static method get_available_scenes_for_multiple_extents_and_date_range [line 3240]

static array|boolean get_available_scenes_for_multiple_extents_and_date_range( array $extentslist, string $startdate, string $enddate, [string $coordsys = "+init=EPSG:4269"], [array $scenetypes = array()])

As get_available_scenes_for_extent_and_date_range(), but returns the scene description struct for scenes which intersect the list of extents structs in EXTENTSLIST, and with scene shooting dates between STARTDATE and ENDDATE, inclusively. All extents structs in EXTENTSLIST must be in the coordinate system COORDSYS.

SCENETYPE is as described for get_available_scenes_for_extent_and_date_range().

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Extents coordinate missing or invalid, or coordinate system not recognized, or invalid startdate or enddate, or startdate after enddate.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

array   $extentslist   Array of extents structs.
string   $startdate   Starting date (ISO 8601 format).
string   $enddate   Ending date (ISO 8601 format).
string   $coordsys   Coordinate system (WKT or proj4) of the coordinates. Defaults to +init=EPSG:4269.
array   $scenetypes   Array of scene types.

[ Top ]

static method get_available_scene_years [line 2804]

static array get_available_scene_years( )

Returns an array of years in which the database has scenes available, in reverse chronological order.

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


[ Top ]

static method get_available_stac_scenes_for_extent_and_date_range [line 3136]

static array|boolean get_available_stac_scenes_for_extent_and_date_range( struct $extents, string $startdate, string $enddate, [string $coordsys = "+init=EPSG:4269"], [array $scenetypes = array()], [integer $cloud_cover_max = 30])

Searches for scenes directly against the Element84 STAC API (Earth Search), rather than the legacy

scene index. Returns a struct of scene description structs, keyed to the scene's STAC location identifier, within the extents of EXTENTS, and with scene shooting dates between STARTDATE and ENDDATE, inclusively. EXTENTS is an extents struct (keys are minx, miny, maxx, maxy), with coordinates in the coordinate system COORDSYS. All four coordinate keys in EXTENTS must be set. STARTDATE cannot be equal to or after ENDDATE, or an error is signalled.

SCENETYPES, if set, limits the search to 'sentinel' and/or 'landsat' — the only scene types currently sourced from the STAC API. Defaults to both. CLOUD_COVER_MAX filters out scenes with a cloud cover percentage above the given value; defaults to 30.

Unlike get_available_scenes_for_extent_and_date_range(), this method never falls back to, or blends in, the legacy scene index — it is a live query against Element84's Earth Search STAC API, so results reflect current Sentinel-2/Landsat catalog availability rather than what has been indexed and stored locally.

If no scenes are available given the extents (and optional parameters), returns FALSE.

Scene description struct is as the return value of get_scene_info(). Each scene's key (in place of the usual integer scene index) is a STAC location string of the form "stac:<collection>:<item_id>"; use this string wherever a SCENEID is expected by other methods, such as get_scene_info() or display_scene_by_item_id().

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Extents coordinate missing or invalid, or coordinate system not recognized, or invalid startdate or enddate, or startdate after enddate.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

struct   $extents   Extents struct.
string   $startdate   Starting date (ISO 8601 format).
string   $enddate   Ending date (ISO 8601 format).
string   $coordsys   Coordinate system (WKT or proj4) of the coordinates. Defaults to +init=EPSG:4269.
array   $scenetypes   Array of scene types ('sentinel', 'landsat'). Defaults to both.
integer   $cloud_cover_max   Maximum cloud cover percentage (0-100). Defaults to 30.

[ Top ]

static method get_displayed_scene [line 3624]

static integer|boolean get_displayed_scene( string $mapcontext)

Returns the sceneid of the currently displayed scene in the map MAPCONTEXT, or false if there is no scene currently displayed.

Use of this method requires the "viewscenes" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have viewscenes privilege.
access:  public


Parameters:

string   $mapcontext   The map context.

[ Top ]

static method get_hilites [line 1910]

static struct|boolean get_hilites( [boolean $wkt = false])

Returns a structure containing currently hilited shapes. Struct keys are the GID of the hilite shapes; these are used for uniquely identifying the hilite shape, and do not correspond to permanently stored objects. The struct values are attribute structs describing each hilite shape.

WKT, if set, adds the Well-Known Text of the object to the attribute struct.

Attribute struct fields are:

  • shpid: Numeric ID of the corresponding shape in the source layer. For saved objects, this is the object ID. -1 if the shape is not permanently saved (for instance, a drawn shape).
  • name: The name of the shape.
  • layer: The source layer for this shape. May not correspond to an actual permanent layer.
  • acreage: The area of the geometry in acres. This will be 0 for locations and paths.
  • extents: Extents of the shape in latlong/NAD83.
  • wkt: Well-Known Text of the shape. Only present if WKT parameter is set.

Returns FALSE if there are no hilited shapes.




Tags:

access:  public


Parameters:

boolean   $wkt   Add WKT to attribute struct; defaults to false.

[ Top ]

static method get_hilite_extents [line 1958]

static struct|boolean get_hilite_extents( [array $hiliteids = array()])

Returns the extents of currently hilited shapes as an extents struct, or false if no hilites present.

Optionally, the array HILITEIDS can restrict the query to only those hilites identified in the array. Otherwise, the extents of all hilites will be returned.




Tags:

access:  public


Parameters:

array   $hiliteids   Hiliteids to query. Optional.

[ Top ]

static method get_hilite_ids_within_scene [line 3708]

static array|boolean get_hilite_ids_within_scene( integer $sceneid)

Returns an array of SHPIDs of currently hilited objects which lie within the scene SCENEID. Objects which are partially or completely outside of the scene will not be listed. If there are no hilited objects within the scene, or no hilited objects, returns false.



Tags:

access:  public


Parameters:

integer   $sceneid   ID of the scene.

[ Top ]

static method get_image_info [line 4168]

static struct get_image_info( string $imagehandle, [integer $hiliteid = null])



Tags:

deprecated:  

This method is being phased out in favor of get_rasters_info().

Returns an info struct describing the image named by IMAGEHANDLE. If the image does not exist, an error is signaled. The image can be an extracted raw image, an analysis, or an edited image. This method does not return all of the available information for analyses or edited images, for this additional info call get_analysis_info() or get_edited_image_info(), respectively.

If HILITEID is set, this method will mask the raw image (if this is a raw image) and compute statistics for the value ranges within the masked area.

Info struct is as follows:

  • width: Image width in pixels.
  • height: Image height in pixels.
  • resolution: Resolution in meters per pixel.
  • projection: Image's projection (in WKT).
  • origin: Origin point of image (in image's coordinate system).
  • extents: Extents of the image (in latlong).
  • objecttype: Type of object which this image depicts.
  • objectid: ID of object.
  • bandinfo: For raw images, statistics for each band in the image, namely the minimum, maximum, mean, and standard deviation of values within the bounds of the hilited object for which this image was extracted. Struct with keys "min", "max", "mean", and "stddev". Will not be present for other image types (analysis or edited image), and will only be provided if HILITEID is set.

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Parameters:

string   $imagehandle   Image handle.
integer   $hiliteid   ID of hilite to use for masking for statistics.

[ Top ]

static method get_map_centroid [line 706]

static array get_map_centroid( string $mapcontext)

Returns the centroid of the current map extents in latlong. This is a struct with two fields, LAT and LONG.



Tags:

deprecated:  Method deprecated: just use get_map_info() centroid.
exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.

[ Top ]

static method get_map_info [line 577]

static array get_map_info( mixed $mapcontext)

Returns basic info about the given map context MAPCONTEXT as a struct. MAPCONTEXT may be a string naming a single map context, or an array of map context strings.

Map info struct fields are as follows:

  • name: Name of the map.
  • width: Width of the output image in pixels.
  • height: Height of the output image in pixels.
  • projection: Current projection (in WKT).
  • epsg: EPSG authority code of current projection.
  • extents: Current extents (in latlong/WGS84). Struct with fields "minx", "miny", "maxx", "maxy".
  • projextents: Current extents in current map projection. Same format as EXTENTS.
  • defaultextents: Original extents (in latlong/WGS84) at first load of this map context. Same format as EXTENTS.
  • numlayers: Number of layers
  • centroid: Center point of the map in latlong. Struct with fields "lat" and "long".
  • centroidzone: UTM zone in which the center point of the map extents lies.
  • basemapon: Boolean. Whether or not a "base map" layer (background raster) is on, or not.
  • wkt: Vector boundary of the region (state, province, or country) that the map represents, in OGC WKT (latlong).

If MAPCONTEXT is a string, only one map info struct is returned. If MAPCONTEXT is an array, the returned struct is keyed to the map contexts, with values being the map info struct for each context.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

mixed   $mapcontext   The map context.

[ Top ]

static method get_map_layers [line 406]

static array get_map_layers( string $mapcontext, [array $options = array()])

Returns a list of the available layers for the map context MAPCONTEXT. Layers are given in order of drawing (lower layers first).

Layer information is a LAYER struct.

LAYER struct fields:

  • idx: The layer's index. Use to access individual layers.
  • name: Name of the layer.
  • type: Type of data represented by this layer (Mapserver layer types).
  • projection: WKT projection information for this layer.
  • status: Layer can be ON or OFF.
  • numclasses: Number of classes for this layer.
  • displaylayer: Boolean. True if this is a scene or dataset display layer created through this API.
  • title: An "alternate" name, set when this display layer was created. Only present for display layers created with the title option.
  • hilite: Hilite ID of the hilited boundary this display layer belongs to. Only present for display layers created with the hilite ID option.
  • legendicon: A legendicon struct (or list of them, for layers with multiple classes). Only present if the legendicon field is set in OPTIONS struct.

Optional information can be requested through the OPTIONS struct. Fields not set are treated as default.

OPTIONS struct fields:

  • legendicon: Boolean. Draw legend icon for this layer, or for each class, if the layer has multiple classes. Default false.
  • legendwidth: Integer. Width of legend icon in pixels. Default 30.
  • legendheight: Integer. Height of legend icon in pixels. Default 12.

LEGENDICON struct fields:

  • name: Displayed name of the layer or class (for multiclass layers). May not match the NAME in the layer struct (for multiclass layers, definitely will not).
  • img: The base64-encoded binary image file (PNG format).




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
array   $options   Options struct.

[ Top ]

static method get_map_public_locations [line 2089]

static array get_map_public_locations( string $mapcontext, mixed $layer, [boolean $limitextents = false])



Tags:

deprecated:  

This method is deprecated, and scheduled to be removed within the next 6 months.

Queries the given LAYER, which must be a "public location" layer (state, county, township, section, or towns), in the map MAPCONTEXT. Returns a struct of available locations.

The struct key is the location name, and the value is a struct containing the extents in latlong (minx, miny, maxx, maxy).

If LIMITEXTENTS is true, the query is a spatial one: only the current map extents are searched. Otherwise, all available locations for the map are returned.

Not all maps have township or section layers; check the map layer list with get_map_layers() first.

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
exception:  BAD_SEARCH_REQUEST Layer given not searchable with this function, or only with limitextents true.
access:  public


Parameters:

string   $mapcontext   The map context.
mixed   $layer   Name or index of layer to search. Must correspond to one of the following layers: state, county, township, section, or towns.
boolean   $limitextents   If TRUE, results will be limited to current map extents.

[ Top ]

static method get_multiple_analyses_info [line 5815]

static struct get_multiple_analyses_info( array $imagehandles, [struct $options = array()])



Tags:

deprecated:  

This method is being phased out in favor of get_rasters_info().

As get_analysis_info(), but returns info for the analyses in array IMAGEHANDLES. Returns a struct keyed to each analysis image handle, with values being the info structs from get_analysis_info().

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis.
access:  public


Parameters:

array   $imagehandles   Array of image handles.
struct   $options   Optional parameters.

[ Top ]

static method get_multiple_images_info [line 4312]

static struct get_multiple_images_info( struct $imagelist)



Tags:

deprecated:  

This method is being phased out in favor of get_rasters_info().

As get_image_info(), except returns a struct keyed to the image handles given in IMAGELIST, with values being the image info structs.

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Parameters:

struct   $imagelist   Image handle.

[ Top ]

static method get_multiple_scenes_info [line 3311]

static struct get_multiple_scenes_info( array $sceneids)

As get_scene_info(), but returns info structs for each scene ID given in array SCENEIDS.

Returns struct keyed to the sceneid, with values being scene info structs as for get_scene_info().




Tags:

access:  public


Parameters:

array   $sceneids   Array of scene IDs.

[ Top ]

static method get_my_login_sessions [line 160]

static struct get_my_login_sessions( )

Returns a struct describing the current user's logged in sessions. Struct keys are the session tokens (as returned by login()), with values being session structs as follows:

  • token: The session token.
  • uid: User ID.
  • ipaddress: IP address of the remote client which established this session.
  • logintime: Time this session was established (ISO 8601 format). Set by the LOGIN method.
  • lastconnect: Time the remote client last connected to call any method.




Tags:

access:  public


[ Top ]

static method get_rasters_info [line 5687]

static struct get_rasters_info( array $imagehandles)

Returns a struct keyed to each analyzed image or edited image in IMAGEHANDLES, with values being raster description structs for the given images.

Raster description structs are as follows:

  • width: Image width in pixels.
  • height: Image height in pixels.
  • resolution: Resolution in meters per pixel.
  • projection: Image's projection (in WKT).
  • origin: Origin point of image (in image's coordinate system).
  • extents: Extents of the image (in latlong).
  • sourcesceneid: Scene ID of the source scene.
  • sourcescene: Name of the source scene.
  • objecttype: Type of the object analyzed (boundaries, locations, or paths).
  • objectid: ID of the object analyzed.
  • type: Analysis type used (band or composite bands analyzed). For edited images, this will be "Edited Image".
  • mode: Analysis mode used (standard, minmax, or custom). This is always "custom" for edited images.
  • numzones: Number of zones in analysis.
  • acres: Total acreage of the analyzed image area.
  • createdate: Date and time this image was saved (ISO 8601 format). Will be empty string if image is not saved.
  • zones: List of structs describing the details of each classification zone. List indexes are 0..numzones - 1, value structs are as follows:
    • zonenum: Zone number.
    • color: RGB tuple describing the color of the zone.
    • acres: Acreage of the zone.
    • expression: The logical expression which defines the zone classification, i.e., the pixel values of the raw image which fall within this zone. Expression is in MapServer expression format. Not present for edited images.
    • minval: Minimum value for this zone's value range; all values greater than or equal to this value are within the zone. Not present for edited images.
    • maxval: Maximum value for this zone's value range; all values less than (NOT less than or equal to!) this value are within the zone. Not present for edited images.




Tags:

exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Parameters:

array   $imagehandles   The image handle.

[ Top ]

static method get_scene_info [line 3299]

static struct get_scene_info( string $sceneid)

Returns info struct about the scene identified by SCENEID. If no such scene exists, returns FALSE.

Info struct is as follows:

  • name: Name of the scene.
  • date: Date scene was shot (ISO 8601 format).
  • type: Type of scene ('3band' or 'multispectral').
  • satellite: Satellite which shot the scene.
  • bands: List of bands in scene, in order. Array of structs, each struct having two keys: "band", the short name, and "band_description", a more descriptive name.
  • projection: Scene's native projection (in WKT).
  • resolution: Resolution in meters per pixel.
  • extents: Extents of the scene in latlong NAD83.




Tags:

access:  public


Parameters:

string   $sceneid   Scene ID.

[ Top ]

static method load_map [line 286]

static string load_map( string $thestate)

Loads the map named THESTATE. Returns the map context.

This function is crucial for working with maps, and should always be called as early as possible.




Tags:

exception:  MAP_NOT_FOUND Map was not found for given state name.
access:  public


Overridden in child classes as:

mapcenter_api::load_map()
Loads the map named THESTATE. Returns the map context.

Parameters:

string   $thestate   Name of the state to load. This can be either the two-letter name code, or the full name of the state. Case-insensitive.

[ Top ]

static method load_maps [line 356]

static struct load_maps( array $statelist)

As load_map(), but loads maps named in array STATELIST, and returns a struct of map contexts, keyed to the names from STATELIST. Names in STATELIST must be valid arguments to load_map().



Tags:

exception:  MAP_NOT_FOUND Map was not found for given state name.
access:  public


Overridden in child classes as:

mapcenter_api::load_maps()
As load_map(), but loads maps named in array STATELIST, and returns a struct of map contexts, keyed to the names from STATELIST. Names in STATELIST must be valid arguments to load_map().

Parameters:

array   $statelist   List of map names.

[ Top ]

static method login [line 47]

static string login( string $username, string $password, [boolean $newsession = false])

Logs in a user to the system. Establishes a session and sets the session cookie if the USERNAME and PASSWORD match the user database.

Returns idtoken if user successfully logged in. If called during a logged-in session, just returns the idtoken.

If the user is already logged in, but the client does not have a session token, returns the idtoken for the most recent active session unless NEWSESSION is true; if NEWSESSION is true, forces creation of a new login session. Users may have multiple login sessions; each session is isolated from the others, though updates to permanent resources will be visible to all sessions.




Tags:

exception:  LOGIN_FAILED Username or password does not match, or username already logged in.
access:  public


Parameters:

string   $username   Username User name.
string   $password   Password User password.
boolean   $newsession   Begin new session even if concurrent sessions are active.

[ Top ]

static method logout [line 123]

static boolean logout( )

Logs out of the system. Cookies are destroyed and session is removed from database. Any map contexts and temporary files are also destroyed.

Has no effect if there is no session. Returns TRUE if session was destroyed (user was logged in), FALSE otherwise.




Tags:

access:  public


[ Top ]

static method make_geometric_intersection_of_hilited_shapes [line 7753]

static integer make_geometric_intersection_of_hilited_shapes( string $name, integer $firstshpid, integer $secondshpid)

Replaces the two hilited objects identified by FIRSTSHPID and SECONDSHPID with a single object consisting of the point set intersection of the two objects, with the name NAME.

The existing objects will be removed from the hilite layer.

The objects must be of the same geometry type, and cannot be point objects.

This function is useful for "clipping" a object to the limits of another object. It does not matter which object is the "target" to be clipped, and which is the "clipping" object, as the point set intersection is commutative.

Returns the hiliteid of the new hilite object.

Use of this method requires the "create_geoobjects" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have create_geoobjects privilege.
exception:  HILITE_NOT_FOUND No shapes hilited or given hilite ID does not exist.
exception:  BAD_TABLE_PARAMS Name cannot be empty.
access:  public


Parameters:

string   $name   Name to give the new object.
integer   $firstshpid   ID of the first hilited object.
integer   $secondshpid   ID of the second hilited object.

[ Top ]

static method make_geometric_symdifference_of_hilited_shapes [line 7820]

static integer make_geometric_symdifference_of_hilited_shapes( string $name, integer $firstshpid, integer $secondshpid)

Replaces the two hilited boundaries identified by FIRSTSHPID and SECONDSHPID with a single boundary consisting of the point set symmetric difference of the two boundaries, with the name NAME. The existing boundaries will be removed from the hilite layer.

This function is useful for "punching holes" in one boundary, with the hole shape being the other boundary. It does not matter which boundary is the "target" to have a hole added, and which is the "hole" boundary, as the symmetric difference operation is commutative.

Returns the hilited of the new hilite boundary.

Use of this method requires the "create_geoobjects" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have create_geoobjects privilege.
exception:  HILITE_NOT_FOUND No shapes hilited or given hilite ID does not exist.
exception:  BAD_TABLE_PARAMS Name cannot be empty.
access:  public


Parameters:

string   $name   Name to give the new boundary.
integer   $firstshpid   ID of the first hilited boundary.
integer   $secondshpid   ID of the second hilited boundary.

[ Top ]

static method make_geometric_union_of_hilited_shapes [line 7677]

static integer make_geometric_union_of_hilited_shapes( string $name, array $shplist)

Replaces the hilited objects identified by hiliteids in array SHPLIST with a single, complex object consisting of the point set union of their geometries, with the name NAME. The existing objects will be removed from the hilite layer.

SHPLIST must contain at least two hiliteids. The hilited shapes need not correspond to any existing boundary or other permanent object. The objects combined must, however, be of the same geometry type, and cannot be POINT objects.

This function is useful for combining geometries into a complex multipolygon, or merging parts of a multipolygon geometry with another, "connecting" polygon to form a simpler object.

Returns the hiliteid of the new hilite object.

Use of this method requires the "create_geoobjects" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have create_geoobjects privilege.
exception:  HILITE_NOT_FOUND No shapes hilited or given hilite ID does not exist.
exception:  PARAMETER_CONSTRAINT_VIOLATION Name cannot be empty, or must specify at least two hilited objects to unify, or point objects not allowed, or objects not of same geometry type.
access:  public


Parameters:

string   $name   Name to give the new object.
array   $shplist   List of hiliteids to unify.

[ Top ]

static method merge_analysis_zones [line 5857]

static string merge_analysis_zones( string $mapcontext, integer $hiliteid, string $imagehandle, array $mergezones)

Merges the classification of the zones MERGEZONES in analyzed image IMAGEHANDLE. The ranges of values in the raw image represented by the zones is combined into one zone.

The new zone's number will be the same as the lowest-numbered of the zones to merge; the color will be that of the highest zone. Zones to be merged MUST be contiguous, i.e., it is an error to merge zones 2, 4, and 5, while leaving zone 3 separate.

HILITEID is the ID of the hilite corresponding to the object used for the analysis. Returns a new image handle for the resulting analysis. The original analysis of IMAGEHANDLE is not overwritten.

Use of this method requires the "precisionag" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "precisionag" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis.
exception:  BAD_ANALYSIS_PARAMS Must merge at least two zones, or zone index out of range, or merging would result in only one zone.
access:  public


Parameters:

string   $mapcontext   The map context.
integer   $hiliteid   Shape ID of the hilited field.
string   $imagehandle   Image handle of the analysis.
array   $mergezones   List of zones to merge. Must contain at least two zone numbers.

[ Top ]

static method move_layer [line 841]

static boolean move_layer( string $mapcontext, mixed $layer, integer $amount)

Moves the layer LAYER of map MAPCONTEXT in the display list (order of drawing) by AMOUNT. If AMOUNT > 0, this moves the layer UP in the list. If AMOUNT < 0, the layer is moved DOWN in the list. AMOUNT = 0 is allowed, but silly. Layers are drawn in list order, so later layers will cover those drawn earlier; use this function to control which layers overlay each other.

Note that this method WILL change the index numbers of this map layer and at least one other. Always call get_map_layers() after using this method to update references to layer indexes.

Returns true.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
access:  public


Parameters:

string   $mapcontext   The map context.
mixed   $layer   Layer name or index number.
integer   $amount   Number of places in the display list to move this layer. Can be 0, although this is a no-op.

[ Top ]

static method paint_image_polygons_with_map_coordinates [line 6423]

static string paint_image_polygons_with_map_coordinates( string $mapcontext, string $imagehandle, integer $zonenumber, array $polylist, [string $coordsys = "+init=EPSG:4269"])

Alters the pixels of the analysis or edited image IMAGEHANDLE whose positions are within the polygonal region POLYLIST, to the color of zone ZONENUMBER, using MAPCONTEXT to paint the new points.

POLYLIST is a three dimensional array. The outer array is an array of polygon arrays, each of which is an array of point arrays. Each point array contains two values: the X coordinate first, and then the Y coordinate. Each polygon array must contain at least three points in order to create a proper polygon. The outer array (list of polygons) must contain at least one polygon array; if more than one polygon array is present, the region painted is a multipolygon geometry. COORDSYS is the coordinate system in which the points in POINTSET are defined: it defaults to latlong NAD83, and must be set if the coordinate points are not latlong.

It is not required that the polygons in POLYLIST ensure a closed polygon by appending a duplicate of the first point to the end of the polygon array: if the last point is not equal to the first point, this function will ensure that a closed polygon is generated by duplicating the first point itself. However, it is not an error if the caller does so.

The color of the pixels within the polygonal region will only be changed if they are not 0: 0 (black) is considered null and remains 0.

Returns a new image handle for the resulting edited image. NOTE: If the image at IMAGEHANDLE was an analysis, the result will still be an edited image, and thus cannot be passed as an argument to merge_analysis_zones() or shift_analysis_zone_endpoints(). It also cannot be saved as an analysis, but must instead be saved as an edited image.

Use of this method requires the "precisionag" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "precisionag" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis or edited image.
exception:  INVALID_BOUNDARY Geometry empty, or insufficient points for polygon, or incorrect point specifier, or geometry contains uncorrectable self-intersections.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $imagehandle   The image handle.
integer   $zonenumber   Zone number to paint the region.
array   $polylist   Array of arrays of coordinate points.
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.

[ Top ]

static method paint_image_polygons_with_pixel_points [line 6565]

static string paint_image_polygons_with_pixel_points( string $mapcontext, string $imagehandle, integer $zonenumber, array $polylist)

Alters the pixels of the analysis or edited image IMAGEHANDLE whose positions are within the polygonal region POLYLIST, to the color of zone ZONENUMBER, using MAPCONTEXT to paint the new points.

POLYLIST is a three dimensional array. The outer array is an array of polygon arrays, each of which is an array of point arrays. Each point array contains two values: the X coordinate first, and then the Y coordinate. Each polygon array must contain at least three points in order to create a proper polygon. The outer array (list of polygons) must contain at least one polygon array; if more than one polygon array is present, the region painted is a multipolygon geometry.

For each pixel point, the X coordinate must be in range 0 .. map width, and Y coordinate must be in range 0 .. map height. Coordinate 0,0 is the top left corner of the map.

It is not required that the polygons in POLYLIST ensure a closed polygon by appending a duplicate of the first point to the end of the polygon array: if the last point is not equal to the first point, this function will ensure that a closed polygon is generated by duplicating the first point itself. However, it is not an error if the caller does so.

The color of the pixels within the polygonal region will only be changed if they are not 0: 0 (black) is considered null and remains 0.

Returns a new image handle for the resulting edited image. NOTE: If the image at IMAGEHANDLE was an analysis, the result will still be an edited image, and thus cannot be passed as an argument to merge_analysis_zones() or shift_analysis_zone_endpoints(). It also cannot be saved as an analysis, but must instead be saved as an edited image.

Use of this method requires the "precisionag" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "precisionag" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis or edited image.
exception:  INVALID_BOUNDARY Geometry empty, or insufficient points for polygon, or incorrect point specifier, or geometry contains uncorrectable self-intersections.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $imagehandle   The image handle.
integer   $zonenumber   Zone number to paint the points.
array   $polylist   Array of arrays of pixel points.

[ Top ]

static method query_map_layer_at_map_coordinate [line 1083]

static struct|boolean query_map_layer_at_map_coordinate( string $mapcontext, double $xcord, double $ycord, mixed $layer, [string $coordsys = "+init=EPSG:4269"], [double $tolerance = 0])

Queries the layer identified by LAYER in map MAPCONTEXT, at the point defined by map coordinates XCORD and YCORD, and returns attribute information about any intersecting vectors at that point. XCORD and YCORD must be in latlong NAD83 (EPSG 4269) unless COORDSYS is specified. LAYER may be the index number or the name of the layer to query. LAYER must identify a vector layer; this function does not support querying raster layers.

If TOLERANCE is greater than 0, the layer query will also look for shapes which are within TOLERANCE meters of the point. This allows for "inexact" matches.

Returns a struct keyed to the permanent ID of the shapes in the layer, with values being per-shape attribute structs. The exact keys and values of these attribute structs will vary by layer. Each attribute struct will contain an extents struct for the shape's extents, keyed to "extents".

If no results found, returns false.

This CORE_API version does not do any special joining against other tables for specific layers; attributes returned will be only those present in the layer itself.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Raster query not supported, or tolerance distance cannot be negative, or coordinate system specified was not recognized as valid.
exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
access:  public


Overridden in child classes as:

mapcenter_api::query_map_layer_at_map_coordinate()
Queries the layer identified by LAYER in map MAPCONTEXT, at the point defined by map coordinates XCORD and YCORD, and returns attribute information about any intersecting vectors at that point. XCORD and YCORD must be in latlong NAD83 (EPSG 4269) unless COORDSYS is specified. LAYER may be the index number or the name of the layer to query. LAYER must identify a vector layer; this function does not support querying raster layers.
clu_mapcenter_api::query_map_layer_at_map_coordinate()
Queries the layer identified by LAYER in map MAPCONTEXT, at the point defined by map coordinates XCORD and YCORD, and returns attribute information about any intersecting vectors at that point. XCORD and YCORD must be in latlong NAD83 (EPSG 4269) unless COORDSYS is specified. LAYER may be the index number or the name of the layer to query. LAYER must identify a vector layer; this function does not support querying raster layers.

Parameters:

string   $mapcontext   The map context.
double   $xcord   X coordinate (longitude for latlong).
double   $ycord   Y coordinate (latitude for latlong).
mixed   $layer   Layer index number or layer name.
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.
double   $tolerance   Tolerance distance in meters. Defaults to 0.

[ Top ]

static method query_map_layer_at_pixel_point [line 1222]

static struct|boolean query_map_layer_at_pixel_point( string $mapcontext, integer $xpoint, integer $ypoint, mixed $layer, [double $pixeltolerance = 0])

Queries the layer identified by LAYER in map MAPCONTEXT, at the pixel coordinates XPOINT and YPOINT, and returns attribute information about any intersecting vectors at that point.

XPOINT must be in range 0 .. map width, YPOINT in range 0 .. map height. Coordinate 0,0 is top left corner of the map. LAYER may be the index number or the name of the layer to query. LAYER must identify a vector layer; this function does not support querying raster layers.

If PIXELTOLERANCE is greater than 0, the layer query will also look for shapes which are within PIXELTOLERANCE pixels of the pixel point. This allows for "inexact" matches.

Returns a struct keyed to the permanent ID of the shapes in the layer, with values being per-shape attribute structs. The exact keys and values of these attribute structs will vary by layer. Each attribute struct will contain an extents struct for the shape's extents, keyed to "extents".

If no results found, returns false.

This CORE_API version does not do any special joining against other tables for specific layers; attributes returned will be only those present in the layer itself.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Raster query not supported, or tolerance distance cannot be negative.
exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
access:  public


Overridden in child classes as:

mapcenter_api::query_map_layer_at_pixel_point()
Queries the layer identified by LAYER in map MAPCONTEXT, at the pixel coordinates XPOINT and YPOINT, and returns attribute information about any intersecting vectors at that point. XPOINT must be in range 0 .. map width, YPOINT in range 0 .. map height. Coordinate 0,0 is top left corner of the map. LAYER must identify a vector layer; this function does not support querying raster layers.
clu_mapcenter_api::query_map_layer_at_pixel_point()
Queries the layer identified by LAYER in map MAPCONTEXT, at the pixel coordinates XPOINT and YPOINT, and returns attribute information about any intersecting vectors at that point. XPOINT must be in range 0 .. map width, YPOINT in range 0 .. map height. Coordinate 0,0 is top left corner of the map. LAYER may be the index number or the name of the layer to query. LAYER must identify a vector layer; this function does not support querying raster layers.

Parameters:

string   $mapcontext   The map context.
integer   $xpoint   X coordinate of pixel position.
integer   $ypoint   Y coordinate of pixel position.
mixed   $layer   Layer index number or layer name.
double   $pixeltolerance   Tolerance distance in pixels. Defaults to 0.

[ Top ]

static method query_map_layer_with_layer_shapes [line 1351]

static struct query_map_layer_with_layer_shapes( string $mapcontext, mixed $targetlayer, mixed $sourcelayer, array $ids)

Queries the layer identified by TARGETLAYER in map MAPCONTEXT, using the shapes identified by integer IDs in array IDS, which are contained in the layer SOURCELAYER. For each shape from SOURCELAYER in IDS, attribute information for the intersecting shapes from TARGETLAYER will be returned. SOURCELAYER and TARGETLAYER may be the index numbers or the names of the layers. They must identify vector layers; this function does not support querying raster layers.

Returns a struct keyed to the ID of each shape from SOURCELAYER in IDS, with the values being a struct keyed to the ID of each found shape in TARGETLAYER; values of those structs will be per-shape attribute structs. The exact keys and values of these attribute structs will vary by TARGETLAYER. Each attribute struct will contain an extents struct for the shape's extents, keyed to "extents". It will also contain a field "intersect_area", which describes the area of the intersection between the shapes from SOURCELAYER and from TARGETLAYER, in square meters.

If no results are found for a given shape from SOURCELAYER, the value of that ID in the returned struct will be boolean false.

This CORE_API version does not do any special joining against other tables for specific layers; attributes returned will be only those present in the layer itself.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Source or target layer given does not exist in map context.
exception:  BAD_SEARCH_REQUEST Shape ID does not exist in source layer.
exception:  PARAMETER_CONSTRAINT_VIOLATION Raster query not supported, or no IDs provided for source layer, or IDs not integers.
access:  public


Overridden in child classes as:

mapcenter_api::query_map_layer_with_layer_shapes()
Queries the layer identified by TARGETLAYER in map MAPCONTEXT, using the shapes identified by integer IDs in array IDS, which are contained in the layer SOURCELAYER. For each shape from SOURCELAYER in IDS, attribute information for the intersecting shapes from TARGETLAYER will be returned. SOURCELAYER and TARGETLAYER may be the index numbers or the names of the layers. They must identify vector layers; this function does not support querying raster layers.
clu_mapcenter_api::query_map_layer_with_layer_shapes()
Queries the layer identified by TARGETLAYER in map MAPCONTEXT, using the shapes identified by integer IDs in array IDS, which are contained in the layer SOURCELAYER. For each shape from SOURCELAYER in IDS, attribute information for the intersecting shapes from TARGETLAYER will be returned. SOURCELAYER and TARGETLAYER may be the index numbers or the names of the layers. They must identify vector layers; this function does not support querying raster layers.

Parameters:

string   $mapcontext   The map context.
mixed   $targetlayer   Layer index number or layer name of target layer.
mixed   $sourcelayer   Layer index number or layer name of source layer.
array   $ids   Array of shape IDs for shapes from SOURCELAYER.

[ Top ]

static method query_multiple_map_layers_at_map_coordinate [line 1279]

static struct|boolean query_multiple_map_layers_at_map_coordinate( string $mapcontext, double $xcord, double $ycord, array $layerlist, [string $coordsys = "+init=EPSG:4269"], [double $tolerance = 0])

As query_map_layer_at_map_coordinate(), but queries each of the layers given in array LAYERLIST; all other arguments are as for query_map_layer_at_map_coordinate().

Returns a struct keyed to the layer name or ID of each layer queried in LAYERLIST, with values being the query structs as returned by query_map_layer_at_map_coordinate(), or boolean false if the query of that layer returned no shapes.

This CORE_API version does not do any special joining against other tables for specific layers; attributes returned will be only those present in the layer itself.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Raster query not supported, or tolerance distance cannot be negative, or coordinate system specified was not recognized as valid, or no layers provided in LAYERLIST.
exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
access:  public


Overridden in child classes as:

mapcenter_api::query_multiple_map_layers_at_map_coordinate()
As query_map_layer_at_map_coordinate(), but queries each of the layers given in array LAYERLIST; all other arguments are as for query_map_layer_at_map_coordinate().
clu_mapcenter_api::query_multiple_map_layers_at_map_coordinate()
As query_map_layer_at_map_coordinate(), but queries each of the layers given in array LAYERLIST; all other arguments are as for query_map_layer_at_map_coordinate().

Parameters:

string   $mapcontext   The map context.
double   $xcord   X coordinate (longitude for latlong).
double   $ycord   Y coordinate (latitude for latlong).
array   $layerlist   Array of layer index numbers or layer names.
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.
double   $tolerance   Tolerance distance in meters. Defaults to 0.

[ Top ]

static method query_multiple_map_layers_at_pixel_point [line 1312]

static struct|boolean query_multiple_map_layers_at_pixel_point( string $mapcontext, integer $xpoint, integer $ypoint, mixed $layerlist, [double $pixeltolerance = 0])

As query_map_layer_at_pixel_point(), but queries each of the layers given in array LAYERLIST; all other arguments are as for query_map_layer_at_pixel_point().

Returns a struct keyed to the layer name or ID of each layer queried in LAYERLIST, with values being the query structs as returned by query_map_layer_at_pixel_point(), or boolean false if the query of that layer returned no shapes.

This CORE_API version does not do any special joining against other tables for specific layers; attributes returned will be only those present in the layer itself.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Raster query not supported, or tolerance distance cannot be negative, or no layers provided in LAYERLIST.
exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
access:  public


Overridden in child classes as:

mapcenter_api::query_multiple_map_layers_at_pixel_point()
As query_map_layer_at_pixel_point(), but queries each of the layers given in array LAYERLIST; all other arguments are as for query_map_layer_at_pixel_point().
clu_mapcenter_api::query_multiple_map_layers_at_pixel_point()
As query_map_layer_at_pixel_point(), but queries each of the layers given in array LAYERLIST; all other arguments are as for query_map_layer_at_pixel_point().

Parameters:

string   $mapcontext   The map context.
integer   $xpoint   X coordinate of pixel position.
integer   $ypoint   Y coordinate of pixel position.
mixed   $layerlist   Layer index number or layer name.
double   $pixeltolerance   Tolerance distance in pixels. Defaults to 0.

[ Top ]

static method remove_hilited_shape [line 2017]

static boolean remove_hilited_shape( integer $hiliteid)

Removes the hilited shape identified by HILITEID from its hilite layer.

Returns TRUE if shape was removed, FALSE otherwise.




Tags:

access:  public


Parameters:

integer   $hiliteid   The HILITEID of the hilite shape. This is not the permanent shape ID of the source layer.

[ Top ]

static method remove_hilited_shapes [line 2039]

static boolean remove_hilited_shapes( array $hiliteidlist)

As remove_hilited_shape(), but removes multiple hilites identified by HILITEIDs in array HILITEIDLIST. Useful when the user wants to remove several, but not all, hilites.



Tags:

access:  public


Parameters:

array   $hiliteidlist   Array of HILITEIDs of hilited shapes.

[ Top ]

static method remove_image_display_layer [line 4481]

static boolean remove_image_display_layer( string $mapcontext, string $imagehandle)

Removes the display layer for image IMAGEHANDLE from display on map MAPCONTEXT.

Returns true if the layer was removed, false if not (no such layer).




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $imagehandle   Image handle.

[ Top ]

static method remove_multiple_image_display_layers [line 4530]

static boolean remove_multiple_image_display_layers( string $mapcontext, array $imglist)

As remove_image_display_layer(), but removes display layers for all image handles in array IMGLIST.

Returns true if all layers removed, false otherwise (one or more image handles had no display layer).




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
array   $imglist   Array of image handles.

[ Top ]

static method rename_hilited_shape [line 1983]

static boolean rename_hilited_shape( integer $gid, string $newname)

Changes the name of the hilited shape identified by GID to NEWNAME. This is primarily useful for preparing boundaries to be saved as fields.

The new name will be visible in calls to get_hilites() or other functions which refer to the hilite layers. Returns true.




Tags:

access:  public


Parameters:

integer   $gid   The GID of the hilite shape.
string   $newname   The new name of the hilite.

[ Top ]

static method rename_hilited_shapes [line 1999]

static boolean rename_hilited_shapes( struct $hilitestruct)

As rename_hilited_shape(), but renames multiple hilites identified in HILITESTRUCT. HILITESTRUCT is a struct keyed to the GID of the hilited shapes, with values being the new names to assign.



Tags:

access:  public


Parameters:

struct   $hilitestruct   Hilite struct.

[ Top ]

static method search_pls_locations [line 2357]

static array|boolean search_pls_locations( string $layer, struct $criteria)

Queries the PLS layer LAYER for townships or sections matching the criteria in struct CRITERIA, returning results found.

LAYER must be one of "township" or "section". CRITERIA is a struct for which the following keys are valid:

  • state: String. Name of a US state. May be full name, or two-letter abbreviation. Case-insensitive.
  • county: String. Name of a US county. Case-insensitive. May only be used in conjunction with "state" key, above.
  • town: Integer. Township coordinate, without direction.
  • twndir: Character. Township direction (N or S). Case-insensitive.
  • range: Integer. Range coordinate, without direction.
  • rngdir: Character. Range direction (E or W). Case-insensitive.
  • primer: Integer. Prime meridian used for survey.
  • section: Integer. Section number. Only used if LAYER is set to "section", otherwise ignored.
  • extents: Extents struct. Must be latlong, WGS84 (EPSG 4326). Results from LAYER will be returned that intersect these extents.

At least one criterion must be set in order to search.

Returns an array of result structs, which are defined as follows:

  • layer: Name of layer that was queried. Will be "township" or "section".
  • landkey: Land identifier key of the township or section. This is the full, unambiguous name of the township, including state, primer, township and range coordinates and directions. For sections, this does not include the section number (but see "name", below).
  • name: Name of the township or section, suitable for display. For townships, this is in the format "$town$twndir $range$rngdir"; for sections, this is the section number.
  • extents: Extents struct of the township or section extents, in latlong, WGS84 (EPSG 4326).

If no results were found for given criteria, returns boolean FALSE.




Tags:

exception:  PARAMETER_CONSTRAINT_VIOLATION Layer was not "township" or "section", or no criteria set, or invalid criteria set.
access:  public


Parameters:

string   $layer   Layer, one of "township" or "section".
struct   $criteria   Criteria struct.

[ Top ]

static method select_by_extents [line 2449]

static struct|boolean select_by_extents( string $mapcontext, [string $layername = "boundaries"], [boolean $toggle = false])

Selects (hilites) the objects in LAYERNAME within current extents of the map MAPCONTEXT. LAYERNAME must be one of "boundaries" (the default), "locations", "paths", "clu", or "attribclu". Selecting on the "attribclu" layer requires the "use_attribclus" privilege.

If TOGGLE is TRUE, then already-hilited objects within the current extents will be removed from the hilite layer.

Returns the resulting hilite info struct, as returned by get_hilites(). This struct includes info on all hilited shapes, not just ones which were selected in a particular call to this function.




Tags:

exception:  INSUFFICIENT_PRIVILEGES Attempted to select on attribclu layer without that privilege.
exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_SELECTABLE Layer given is not a selectable layer.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $layername   Layer to select on.
boolean   $toggle   TRUE to toggle hilited shapes. Defaults to FALSE.

[ Top ]

static method select_by_pixel_point [line 2745]

static struct|boolean select_by_pixel_point( string $mapcontext, integer $xpoint, integer $ypoint, [string $layername = "boundaries"], [boolean $toggle = false], [integer $pixeltolerance = 0])

Selects (hilites) the boundaries in LAYERNAME of the map MAPCONTEXT which intersect the pixel point (XPOINT,YPOINT). XPOINT and YPOINT are pixel coordinates, with XPOINT in range 0 .. map width, YPOINT in range 0 .. map height. Coordinate 0,0 is top left corner of the map. LAYERNAME must be one of "boundaries" (the default), "locations", "paths", "clu", or "attribclu". Selecting on the "attribclu" layer requires the "use_attribclus" privilege.

If TOGGLE is TRUE, then already-hilited boundaries within the current extents will be removed from the hilite layer.

If PIXELTOLERANCE is set, the query will also look for shapes which lie within PIXELTOLERANCE pixels of the pixel point. This allows for "inexact" matches.

Returns the resulting hilite info struct, as returned by get_hilites(). This struct includes info on all hilited shapes, not just ones which were selected in a particular call to this function.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_SELECTABLE Layer given is not a selectable layer.
exception:  INSUFFICIENT_PRIVILEGES Attempted to select on attribclu layer without that privilege.
exception:  PARAMETER_CONSTRAINT_VIOLATION Tolerance distance cannot be negative.
access:  public


Parameters:

string   $mapcontext   The map context.
integer   $xpoint   X coordinate of pixel position.
integer   $ypoint   Y coordinate of pixel position.
string   $layername   Layer to select on.
boolean   $toggle   TRUE to toggle hilited shapes. Defaults to FALSE.
integer   $pixeltolerance   Tolerance distance in pixels. Defaults to 0.

[ Top ]

static method select_by_point [line 2540]

static struct|boolean select_by_point( string $mapcontext, double $xcord, double $ycord, [string $layername = "boundaries"], [string $coordsys = "+init=EPSG:4269"], [boolean $toggle = false], [double $tolerance = 0])

Selects (hilites) the objects in LAYERNAME of the map MAPCONTEXT which intersect the point (XCORD,YCORD). Point coordinates should be in latlong unless COORDSYS is set.

LAYERNAME must be one of "boundaries" (the default), "locations", "paths", "clu", or "attribclu". Selecting on the "attribclu" layer requires the "use_attribclus" privilege.

If TOGGLE is TRUE, then already-hilited objects within the current extents will be removed from the hilite layer.

If TOLERANCE is greater than 0, the layer query will also look for shapes which are within TOLERANCE meters of the point. This allows for "inexact" matches.

Returns the resulting hilite info struct, as returned by get_hilites(). This struct includes info on all hilited shapes, not just ones which were selected in a particular call to this function.




Tags:

exception:  INSUFFICIENT_PRIVILEGES Attempted to select on attribclu layer without that privilege.
exception:  MAP_NOT_FOUND Map context does not exist.
exception:  PARAMETER_CONSTRAINT_VIOLATION Tolerance distance cannot be negative.
access:  public


Parameters:

string   $mapcontext   The map context.
double   $xcord   X coordinate (longitude for latlong).
double   $ycord   Y coordinate (latitude for latlong).
string   $layername   Layer to select on.
string   $coordsys   Coordinate system (WKT or proj4) of the coordinates. Defaults to +init=EPSG:4269.
boolean   $toggle   TRUE to toggle hilited shapes. Defaults to FALSE.
double   $tolerance   Tolerance distance in meters. Defaults to 0.

[ Top ]

static method set_map_extents [line 910]

static struct set_map_extents( string $mapcontext, mixed $minx, [double $miny = 0], [double $maxx = 0], [double $maxy = 0], [string $coordsys = "+init=EPSG:4269"], [double $buffer = 50])

Sets the extents of the map given by MAPCONTEXT to MINX, MINY, MAXX, MAXY. Extents should be in latlong unless COORDSYS is given. BUFFER is additional padding (in meters) around the extents, to ensure everything is in view. Set to 0 for no buffering.

MINX can also be set to an extents struct, in which case the struct will be unpacked by this method.

Returns an extents struct for the new extents of MAPCONTEXT after zooming, in Latlong/NAD83.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
mixed   $minx   MinX coordinate, or extents struct.
double   $miny   MinY coordinate.
double   $maxx   MaxX coordinate.
double   $maxy   MaxY coordinate.
string   $coordsys   Coordinate system (WKT or proj4) of the coordinates. Defaults to latlong.
double   $buffer   Amount to buffer the extents. Defaults to 50 meters.

[ Top ]

static method set_map_projection [line 1023]

static boolean set_map_projection( string $mapcontext, string $newproj)

Sets the projection and coordinate system of map MAPCONTEXT to projection NEWPROJ.

Returns TRUE if projection was set, FALSE otherwise.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
string   $newproj   The new projection (WKT or proj4).

[ Top ]

static method set_map_size [line 993]

static boolean set_map_size( string $mapcontext, integer $width, integer $height)

Sets the size of the map (size of the output image) given by MAPCONTEXT to WIDTH x HEIGHT, in pixels.

Returns true.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
integer   $width   New width.
integer   $height   New height.

[ Top ]

static method shift_analysis_zone_endpoints [line 6116]

static string shift_analysis_zone_endpoints( string $mapcontext, integer $hiliteid, string $imagehandle, integer $shiftzone, integer $shiftamount)

Changes the classification of the analysis IMAGEHANDLE, changing the maximum point of SHIFTZONE by SHIFTAMOUNT. SHIFTZONE must be in the range (1 .. number of zones - 1), i.e., the final zone's max point cannot be shifted.

The minimum and maximum values of each zone correspond to the pixel values the zone represents in the raw image.

Every zone (except the final zone) has a maximum value = minimum value of the next zone. I.e., if SHIFTZONE max = 59, then SHIFTZONE + 1 min = 59. Changing the max point of SHIFTZONE will therefore change the min point of SHIFTZONE + 1 by the same amount.

SHIFTAMOUNT can be any signed integral value, within the range -(SHIFTZONE max - (SHIFTZONE min + 1)) .. 0 .. ((SHIFTZONE + 1) max - 1) - SHIFTZONE max. In other words, the new cutoff point can be anywhere in the range SHIFTZONE min + 1 .. (SHIFTZONE + 1) max - 1.

Shifting the cutoff point between zones causes the zones to increase or decrease in "width" on the image histogram. The acreage of the zones in question will therefore also change.

If SHIFTAMOUNT is positive, the maximum of SHIFTZONE moves upward, towards (SHIFTZONE + 1) max. If negative, cutoff point moves downward, toward SHIFTZONE min.

HILITEID is the ID of the hilite corresponding to the field used for the analysis. Returns a new image handle for the resulting analysis. The original analysis of IMAGEHANDLE is not overwritten.

Use of this method requires the "precisionag" privilege.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  INSUFFICIENT_PRIVILEGES User does not have the "precisionag" privilege.
exception:  IMAGEHANDLE_NOT_FOUND Given image handle does not exist.
exception:  BAD_DATASET_TYPE Image is not an analysis.
exception:  BAD_ANALYSIS_PARAMS Zone index out of range, or shifting would result in zone overlap.
access:  public


Parameters:

string   $mapcontext   The map context.
integer   $hiliteid   ID of hilited shape for the field.
string   $imagehandle   Image handle of analysis.
integer   $shiftzone   Zone to shift max point.
integer   $shiftamount   Amount to shift max point of SHIFTZONE.

[ Top ]

static method toggle_map_layer [line 753]

static boolean toggle_map_layer( string $mapcontext, mixed $layer)

Toggles the status of the map layer (on or off) identified by LAYER (the layer name or index) in the given map context. If the layer was off, it is turned on, and vice versa. A layer whose status is OFF is not drawn when draw_map() is called, but may still be drawn using WMS.

Returns TRUE if the layer is now on, FALSE if it is now off.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
access:  public


Parameters:

string   $mapcontext   The map context.
mixed   $layer   The layer name or index number.

[ Top ]

static method toggle_multiple_map_layers [line 811]

static struct toggle_multiple_map_layers( string $mapcontext, array $layers)

As toggle_map_layer(), but toggles each of the map layers identified by the layer names or layerid numbers in LAYERS.

Returns a struct keyed to the layer names or ids, with boolean TRUE if the layer is now on, FALSE if it is now off.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  LAYER_NOT_FOUND Layer given does not exist in map context.
access:  public


Parameters:

string   $mapcontext   The map context.
array   $layers   Array of layer names or index numbers.

[ Top ]

static method upload_geotagged_photo [line 8132]

static boolean upload_geotagged_photo( string $description, base64 $imagefile, [struct $options = array()])

Uploads the geotagged photo IMAGEFILE to the database, storing it with the description DESCRIPTION. The OPTIONS struct, if provided, can set three optional parameters:

  • object: If set, the photo is associated with the object identified by this struct. The struct consists of two fields, "type" (object type, one of "boundaries", "locations", or "paths"), and "id" (integer ID of the object). The object must be one to which the user has "append" access.
  • point: Array of two numeric values, longitude and then latitude, setting the point location of the photo. This overrides any geotag information in the image file!
  • comments: Additional text information about the photo, beyond the description itself. String, no length limit.

The photo must be a GIF, PNG, JPEG, or TIFF image. If OBJECT is not provided in OPTIONS, the image must contain geotagging metadata.

If OBJECT is not provided in OPTIONS, this method will query the object layers in the order 'boundaries', 'locations', 'paths', for an object which intersects the geotag point (within ten meters), and to which the user has access, and associate the photo with that object automatically. OBJECT must be provided in OPTIONS to override this process.

If the image file is geotagged, the file is saved with its location as a latlong point. The location then appears on the "geotagphotos" layer, and in the "photos" dataset list for get_saved_datasets_for_objects() if it is associated with a field. Otherwise, the photo will only appear in the dataset list, not on the layer.

Use of this method requires the "geotagged_photos" privilege.

Returns the ID of the new saved photo record.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have the "geotagged_photos" privilege.
exception:  PARAMETER_CONSTRAINT_VIOLATION Description required, or image file is not TIFF or JPEG, or no geotagging info present and no fieldid or point provided, or object type and id not valid, or point is not a valid point.
exception:  ACCESS_DENIED User does not have permission to access object given.
access:  public


Parameters:

string   $description   Textual description of the photo.
base64   $imagefile   Base64-encoded binary of the photo.
struct   $options   Struct of options.

[ Top ]

static method upload_objects_to_hilites [line 7894]

static struct upload_objects_to_hilites( base64 $vecfile, [string $namecolumn = ""], [string $format = "shapefile"], [string $coordsys = "+init=EPSG:4269"])

Uploads the geometries of vector file VECFILE, in the specified format FORMAT, into the hilite layer. NAMECOLUMN specifies which attribute column to use to name each object; if not specified, the boundaries will be given default names (Unnamed1, Unnamed2, Unnamed3, etc). Point coordinates should be in latlong/NAD83 unless COORDSYS is set. COORDSYS is ignored for GeoJSON, GML and KML files, which must be in latlong.

Available formats are "shapefile" (ESRI Shapefile), "mapinfo" (MapInfo MIF/MID), "GML" (OGC GML), "KML" (Google Earth KML), or "GeoJSON" (GeoJSON file). The shapefile, mapinfo, and GML formats are multi-file, and must be provided in a ZIP.

The hilited objects are not permanent, but can be saved permanently with save_hilited_objects(). The geometries in VECFILE may be points, lines or multilines, or polygons or multipolygons. Points will be saved as location objects, lines or multilines as path objects, and polygons or multipolygons as boundary objects.

Returns the resulting hilite info struct, as returned by get_hilites(). This struct includes info on all hilited shapes, not just ones which were selected in a particular call to this function.

Use of this method requires the "create_geoobjects" privilege.




Tags:

exception:  INSUFFICIENT_PRIVILEGES User does not have create_geoobjects privilege.
exception:  BAD_DATASET_TYPE Uploaded zip file could not be read.
exception:  PARAMETER_CONSTRAINT_VIOLATION Unknown format, or coordinate system mismatch, or uploaded file could not be read.
access:  public


Parameters:

base64   $vecfile   Polygon vector file.
string   $namecolumn   Attribute column to use for object names. Defaults to empty string (no column).
string   $format   Format of file. Defaults to "shapefile".
string   $coordsys   Coordinate system (WKT or proj4) of the input file. Defaults to latlong NAD83.

[ Top ]

static method zoom_map_at_map_coordinate [line 1510]

static struct zoom_map_at_map_coordinate( string $mapcontext, double $xcord, double $ycord, [double $zoomfactor = 1], [string $coordsys = "+init=EPSG:4269"])

Recenters the map MAPCONTEXT around the point represented by map coordinates XCORD and YCORD. XCORD and YCORD must be in latlong NAD83 (EPSG 4269) unless COORDSYS is specified.

If ZOOMFACTOR is not 1, also zooms around the given point: ZOOMFACTOR > 1 zooms in by the ZOOMFACTOR amount (2 = 2x zoom, 3 = 3x zoom, etc.), ZOOMFACTOR < -1 zooms out by the ZOOMFACTOR amount.

ZOOMFACTOR may be fractional (e.g., -1.5), but ZOOMFACTOR in range -1 .. 1 is equivalent to ZOOMFACTOR = 1.

Returns an extents struct for the new extents of MAPCONTEXT after zooming, in Latlong/NAD83.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  PARAMETER_CONSTRAINT_VIOLATION Coordinate system specified was not recognized as valid.
access:  public


Parameters:

string   $mapcontext   The map context.
double   $xcord   X coordinate (longitude for latlong).
double   $ycord   Y coordinate (latitude for latlong).
double   $zoomfactor   Zooming factor. Defaults to 1 (recenter only).
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.

[ Top ]

static method zoom_map_at_pixel_point [line 1567]

static struct zoom_map_at_pixel_point( string $mapcontext, integer $xpoint, integer $ypoint, [double $zoomfactor = 1])

Recenters the map MAPCONTEXT around the point represented by pixel coordinates XPOINT and YPOINT. Coordinate 0,0 is top left corner of the map.

If ZOOMFACTOR is not 1, also zooms around the given point: ZOOMFACTOR > 1 zooms in by the ZOOMFACTOR amount (2 = 2x zoom, 3 = 3x zoom, etc.), ZOOMFACTOR < -1 zooms out by the ZOOMFACTOR amount.

ZOOMFACTOR may be fractional (e.g., -1.5), but ZOOMFACTOR in range -1 .. 1 is equivalent to ZOOMFACTOR = 1.

Returns an extents struct for the new extents of MAPCONTEXT after zooming, in Latlong/NAD83.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
access:  public


Parameters:

string   $mapcontext   The map context.
integer   $xpoint   X coordinate of pixel position.
integer   $ypoint   Y coordinate of pixel position.
double   $zoomfactor   Zooming factor. Defaults to 1 (recenter only).

[ Top ]

static method zoom_map_to_map_coordinate_with_radius [line 1685]

static struct zoom_map_to_map_coordinate_with_radius( string $mapcontext, double $xcord, double $ycord, integer $radius, [string $coordsys = "+init=EPSG:4269"])

Sets the map extents to those of the bounding box around map coordinate XCORD,YCORD, with a buffer of RADIUS meters. XCORD and YCORD must be in latlong NAD83 (EPSG 4269) unless COORDSYS is specified. RADIUS must be a positive integer.

Returns an extents struct for the new extents of MAPCONTEXT after zooming, in Latlong/NAD83.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  PARAMETER_CONSTRAINT_VIOLATION Radius is not a positive integer, or coordinate system specified was not recognized as valid.
access:  public


Parameters:

string   $mapcontext   The map context.
double   $xcord   X coordinate (longitude for latlong).
double   $ycord   Y coordinate (latitude for latlong).
integer   $radius   Radius in meters to zoom around the coordinate.
string   $coordsys   Coordinate system (WKT or proj4) of the output. Defaults to latlong NAD83.

[ Top ]

static method zoom_map_to_pixel_rectangle [line 1625]

static struct|boolean zoom_map_to_pixel_rectangle( string $mapcontext, integer $pixminx, integer $pixminy, integer $pixmaxx, integer $pixmaxy, boolean 5)

Sets the map extents to those bounded by the box described by pixel coordinates PIXMINX, PIXMINY, PIXMAXX, PIXMAXY. Cordinate (0,0) is the top left corner of the map. The bounding box size cannot be zero in either dimension (i.e., PIXMINX must not equal PIXMAXX, PIXMINY must not equal PIXMAXY).

Returns an extents struct for the new extents of MAPCONTEXT after zooming, in Latlong/NAD83.




Tags:

exception:  MAP_NOT_FOUND Map context does not exist.
exception:  PARAMETER_CONSTRAINT_VIOLATION Bounding box size cannot be zero in either dimension.
access:  public


Parameters:

boolean   5   Return extents struct if true. Defaults to false.
string   $mapcontext   The map context.
integer   $pixminx   Pixel minx.
integer   $pixminy   Pixel miny.
integer   $pixmaxx   Pixel maxx.
integer   $pixmaxy   Pixel maxy.

[ Top ]


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