GeoJS
- Copyright:
- 2013-2022, Kitware, Inc.
- License:
- Apache-2.0
Classes
- annotation
- annotationLayer
- camera
- choroplethFeature
- circleAnnotation
- contourFeature
- domRenderer
- ellipseAnnotation
- feature
- featureLayer
- fetchQueue
- fileReader
- geojsonReader
- graphFeature
- gridFeature
- heatmapFeature
- imageTile
- isolineFeature
- layer
- lineAnnotation
- lineFeature
- map
- mapInteractor
- markerFeature
- meshFeature
- object
- osmLayer
- pathFeature
- pixelmapFeature
- pixelmapLayer
- pointAnnotation
- pointFeature
- polygonAnnotation
- polygonFeature
- quadFeature
- rectangleAnnotation
- renderer
- sceneObject
- squareAnnotation
- textFeature
- tile
- tileCache
- tileLayer
- timestamp
- trackFeature
- transform
- vectorFeature
Namespaces
Type Definitions
-
geo.actionRecordobject
-
The conditions that are necessary to make an action occur.
Properties:
Name Type Argument Description action
string The name of the action, from (@link geo.action}.
owner
string <optional>
A name of an owning process that can be used to locate or filter actions.
name
string <optional>
A human-readable name that can be used to locate or filter actions.
input
string | object The name of an input that is used for the action, or an object with input names as keys and boolean values of inputs that are required to occur or required to not occur to trigger the action. Input names include
left
,right
,middle
(for mouse buttons),wheel
(the mouse wheel),pan
(touch pan),rotate
(touch rotate).modifiers
string | object <optional>
The name of a modifier key or an object with modifiers as the keys and boolean values. The listed modifiers must be set or unset depending on the boolean value. Modifiers include
shift
,ctrl
,alt
, andmeta
.selectionRectangle
boolean | string <optional>
If truthy, a selection rectangle is shown during the action. If a string, the name of an event that is triggered when the selection is complete.
-
geo.actionStateobject
-
The current action state a map interactor.
Properties:
Name Type Argument Description action
string Name of the action that is being handled.
actionRecord
geo.actionRecord The action record which triggered the current action.
origAction
string <optional>
The name of an action that triggered this action.
origin
geo.mouseState The mouse state at the start of the action.
initialZoom
number The zoom level at the start of the action.
initialRotation
number The map's rotation in radians at the start of the action.
initialEventRotation
number The rotation reported by the event that triggered this action. For example, this could be the angle between two multi-touch points.
delta
object The total movement of during the action in gcs coordinates.
Properties
Name Type Description x
number The horizontal movement during the action.
y
number The vertical movement during the action.
boundDocumentHandlers
boolean true
if the mouse is down and being tracked.start
Date <optional>
The time when the action started.
handler
function <optional>
A function to call on every animation from while the action is occurring.
momentum
geo.mouseState <optional>
The mouse location when a momentum action starts.
zoomrotateAllowRotation
boolean <optional>
Truthy if enough movement has occurred that rotations are allowed.
zoomrotateAllowZoom
boolean <optional>
Truthy if enough movement has occurred that zooms are allowed.
zoomrotateAllowPan
boolean <optional>
Truthy if enough movement has occurred that pans are allowed.
lastRotationDelta
number <optional>
When rotating, the last amount that was rotated from the start of the action. This is used to debounce jitter on touch events.
initialEventGeo
geo.geoPosition <optional>
The position of the mouse when significant movement first occurred.
-
geo.brushSelectionobject
-
The current brush selection (this is when a rectangular area is selected by dragging).
Properties:
Name Type Description display
geo.screenBounds The selection bounds in pixel space.
gcs
object The selection bounds in the map's gcs.
Properties
Name Type Description upperLeft
geo.geoPosition Upper left corner.
upperRight
geo.geoPosition Upper right corner.
lowerLeft
geo.geoPosition Lower left corner.
lowerRight
geo.geoPosition Lower right corner.
mouse
geo.mouseState The current mouse state.
origin
geo.mouseState The mouse state at the start of the brush action.
-
geo.geoBoundsobject
-
General representation of rectangular bounds in world coordinates.
Properties:
Name Type Description left
number Horizontal coordinate of the top-left corner.
top
number Vertical coordinate of the top-left corner.
right
number Horizontal coordinate of the bottom-right corner.
bottom
number Vertical coordinate of the bottom-right corner.
-
geo.geoColorgeo.geoColorObject string number
-
A color value. Although opacity can be specified, it is not always used. When a string is specified, any of the following forms can be used:
- CSS color name
#rrggbb
The color specified in hexadecimal with each channel on a scale between 0 and 255 (ff
). Case insensitive.#rrggbbaa
The color and opacity specified in hexadecimal with each channel on a scale between 0 and 255 (ff
). Case insensitive.#rgb
The color specified in hexadecimal with each channel on a scale between 0 and 15 (f
). Case insensitive.#rgba
The color and opacity specified in hexadecimal with each channel on a scale between 0 and 15 (f
). Case insensitive.rgb(R, G, B)
,rgb(R, G, B, A)
,rgba(R, G, B)
,rgba(R, G, B, A)
The color with the values of each color channel specified as numeric values between 0 and 255 or as percent (between 0 and 100) if a percent%
follows the number. The alpha (opacity) channel is optional and can either be a number between 0 and 1 or a percent. White space may appear before and after numbers, and between the number and a percent symbol. Commas are not required. A slash may be used as a separator before the alpha value instead of a comma. The numbers conform to the CSS number specification, and can be signed floating-point values, possibly with exponents.hsl(H, S, L)
,hsl(H, S, L, A)
,hsla(H, S, L)
,hsla(H, S, L, A)
Hue, saturation, and lightness with optional alpha (opacity). Hue is a number between 0 and 360 and is interpreted as degrees unless an angle unit is specified. CSS units ofdeg
,grad
,rad
, andturn
are supported. Saturation and lightness are percentages between 0 and 100 and must be followed by a percent%
symbol. The alpha (opacity) channel is optional and is specified as withrgba(R, G, B, A)
.transparent
Black with 0 opacity.
When a number, this is an integer of the form
0xrrggbb
or its decimal equivalent. For example, 0xff0000 or 16711680 are both solid red.See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value for more details on CSS color values.
-
geo.geoColorObjectobject
-
A color value represented as an object. Although opacity can be specified, it is not always used.
Properties:
Name Type Argument Description r
number The red intensity on a scale of [0-1].
g
number The green intensity on a scale of [0-1].
b
number The blue intensity on a scale of [0-1].
a
number <optional>
The opacity on a scale of [0-1]. If unspecified and used, it should be treated as 1.
-
geo.geoPositionobject
-
General represention of a point on the earth. The coordinates are most commonly in longitude and latitude, but the coordinate system is changed by the interface gcs.
Properties:
Name Type Argument Default Description x
number Horizontal coordinate, often degrees longitude.
y
number Vertical coordinate, often degrees latitude.
z
number <optional>
0 Altitude coordinate.
-
geo.geoPositionFlatArray.<number>
-
General represention of a point on the earth. The coordinates are most commonly in longitude and latitude, but the coordinate system is changed by the interface gcs. This is a list of numbers consisting of either [x, y] or [x, y, z], where therse are the horizontal, vertical, and altitude coordinates.
-
geo.geoSizeobject
-
Represention of a size in gcs coordinates.
Properties:
Name Type Description width
number Width in gcs coordinates.
height
number Height in gcs coordinates.
-
geo.modifierKeysobject
-
The status of all modifier keys. These are usually copied from the standard DOM events.
Properties:
Name Type Description alt
boolean True if the alt or option key is down.
ctrl
boolean True if the control key is down.
shift
boolean True if the shift key is down.
meta
boolean True if the meta, windows, or command key is down.
-
geo.mouseButtonsobject
-
The status of all mouse buttons.
Properties:
Name Type Description left
boolean True if the left mouse button is down.
right
boolean True if the right mouse button is down.
middle
boolean True if the middle mouse button is down.
-
geo.mouseStateobject
-
The state of the mouse.
Properties:
Name Type Description page
geo.screenPosition Mouse position relative to the page.
map
geo.geoPosition Mouse position relative to the map.
geo
geo.geoPosition Mouse position in map interface gcs.
mapgcs
geo.geoPosition Mouse position in map gcs
buttons
object Which mouse buttons are down.
Properties
Name Type Description left
boolean State of the left mouse button.
right
boolean State of the right mouse button.
middle
boolean State of the middle mouse button.
modifiers
object Which modifier keys are down.
Properties
Name Type Description alt
boolean State of the alt key.
ctrl
boolean State of the ctrl key.
shift
boolean State of the shift key.
meta
boolean State of the meta key.
time
number Time (epoch ms) the event was captured.
deltaTime
number Time elapsed (ms) since the last mouse event.
velocity
geo.screenPosition Mouse speed in pixels/ms.
-
geo.mouseStateobject
-
The state of the mouse.
Properties:
Name Type Description page
geo.screenPosition Mouse location in pixel space relative to the entire browser window.
map
geo.screenPosition Mouse location in pixel space relative to the map DOM node.
geo
geo.geoPosition Mouse location in interface gcs space.
mapgcs
geo.geoPosition Mouse location in gcs space.
buttons
geo.mouseButtons The current state of the mouse buttons.
modifiers
geo.modifierKeys The current state of all modifier keys.
time
Date The timestamp the event took place.
deltaTime
number The time in milliseconds since the last mouse event.
velocity
geo.screenPosition The velocity of the mouse pointer in pixels per millisecond.
-
geo.point2Dobject
-
General represention of a two-dimensional point in any coordinate system.
Properties:
Name Type Description x
number Horizontal coordinate.
y
number Vertical coordinate.
-
geo.polygongeo.polygonFlat geo.polygonObject
-
Polygon.
-
geo.polygonAnygeo.polygonFlat Array.<geo.polygonFlat> Array.<Array.<geo.polygonFlat>> geo.polygonObject Array.<geo.polygonObject> Array.<geo.geoPositionFlat> Array.<Array.<geo.geoPositionFlat>> geo.polygonList object
-
A polygon in any of a variety of formats.
This can be any object with a
toPolygonList
andfromPolygonList
method. -
geo.polygonFlatArray.<geo.geoPosition>
-
Polygon as a flat array. An array of vertices. The polygon has no holes. The first and last point of may be the same.
-
geo.polygonListArray.<Array.<Array.<geo.geoPositionFlat>>>
-
A list of flat polygon lists.
-
geo.polygonObjectobject
-
Polygon as a object. The polygon may have holes.
Properties:
Name Type Argument Description outer
Array.<geo.geoPosition> An array of vertices defining the outside of the polygon. The first and last point of may be the same.
inner
Array.<Array.<geo.geoPosition>> <optional>
An array of holes, each of which is an array of vertices. The first and last point of may be the same.
-
geo.screenBoundsobject
-
General representation of rectangular bounds in pixel coordinates.
Properties:
Name Type Description upperLeft
geo.screenPosition Upper left corner.
upperRight
geo.screenPosition Upper right corner.
lowerLeft
geo.screenPosition Lower left corner.
lowerRight
geo.screenPosition Lower right corner.
-
geo.screenPositionobject
-
General representation of a point on the screen.
Properties:
Name Type Description x
number Horizontal coordinate in pixels.
y
number Vertical coordinate in pixels.
-
geo.screenSizeobject
-
Represention of a size in pixels.
Properties:
Name Type Description width
number Width in pixels.
height
number Height in pixels.
-
geo.worldPositionobject
-
Represention of a point on the map. The coordinates are in the map's reference system, possibly with an affine transformation.
Properties:
Name Type Argument Default Description x
number Horizontal coordinate in map coordinates.
y
number Vertical coordinate in map coordinates.
z
number <optional>
0 Altitude coordinate, often zero.
-
geo.zoomAndCenterobject
-
A location and zoom value.
Properties:
Name Type Description center
geo.geoPosition The center coordinates.
zoom
number The zoom level.
Static Members
-
static,constantgeo.shastring
-
The current geojs git SHA.
-
static,constantgeo.versionstring
-
The current geojs version.
Static Methods
-
staticgeo.adjustLayerForRenderer(name, layer)
-
If a layer needs to be adjusted based on the renderer, call the function that adjusts it.
Name Type Description name
string Name of the layer or adjustment.
layer
object Instantiated layer object.
-
staticgeo.checkRenderer(name, noFallback){string|null|false}
-
Check if the named renderer is supported. If not, display a warning and get the name of a fallback renderer. Ideally, we would pass a list of desired features, and, if the renderer is unavailable, this would choose a fallback that would support those features.
Name Type Description name
string | null Name of the desired renderer.
noFallback
boolean optional If truthy, don't recommend a fallback.
Returns:
Type Description string | null | false The name of the renderer that should be used or false if no valid renderer can be determined. -
staticgeo.createAnnotation(name, options){object}
-
Create an annotation based on a registered type.
Name Type Description name
string The annotation name
options
object The options for the annotation.
Returns:
Type Description object the new annotation. -
staticgeo.createFeature(name, layer, renderer, arg){geo.feature|null}
-
Create new instance of a feature.
Name Type Description name
string Name of the feature to create.
layer
geo.layer The layer associated with the feature.
renderer
geo.renderer The renderer associated with the feature. This is usually
layer.renderer()
.arg
object Options for the new feature.
Returns:
Type Description geo.feature | null The new feature or null if no such name is registered. -
staticgeo.createFileReader(name, opts){geo.fileReader|null}
-
Create a new file reader.
Name Type Description name
string Name of the reader to create.
opts
object Options for the new reader.
Returns:
Type Description geo.fileReader | null The new reader or null if no such name is registered. -
staticgeo.createLayer(name, map, arg){geo.layer|null}
-
Create new instance of the layer.
Name Type Description name
string Name of the layer to create.
map
geo.map The map class instance that owns the layer.
arg
object Options for the new layer.
Returns:
Type Description geo.layer | null The new layer or null if no such name is registered. -
staticgeo.createRenderer(name, layer, canvas, options){geo.renderer|null}
-
Create new instance of the renderer.
Name Type Description name
string Name of the renderer to create.
layer
geo.layer The layer associated with the renderer.
canvas
HTMLCanvasElement optional A canvas object to share between renderers.
options
object optional Options for the new renderer.
Returns:
Type Description geo.renderer | null The new renderer or null if no such name is registered. -
staticgeo.createWidget(name, layer, arg){geo.widget}
-
Create new instance of a dom widget.
Name Type Description name
string Name of the widget to create.
layer
geo.layer The layer associated with the widget.
arg
object Options for the new widget.
Returns:
Type Description geo.widget The new widget. -
staticgeo.featuresForAnnotations(annotationList){Array.<string>}
-
Get a list of required features for a set of annotations.
Name Type Description annotationList
Array.<string> | object | undefined A list of annotations that will be used. Instead of a list, if this is an object, the keys are the annotation names, and the values are each a list of modes that will be used with that annotation. For example, ['polygon', 'rectangle'] lists features required to show those annotations in any mode, whereas {polygon: [annotationState.done], rectangle: [annotationState.done]} only lists features that are needed to show the completed annotations.
Returns:
Type Description Array.<string> a list of features needed for the specified annotations. There may be duplicates in the list. -
staticgeo.listAnnotations(){Array.<string>}
-
Get a list of registered annotation types.
Returns:
Type Description Array.<string> A list of registered annotations. -
staticgeo.registerAnnotation(name, func, features){object}
-
Register a new annotation type.
Name Type Description name
string The annotation name.
func
function A function to call to create the annotation.
features
object | undefined A map of features that are used by this annotation. Each key is a feature that is used. If the value is true, the that feature is always needed. If a list, then it is the set of annotation states for which that feature is required. These can be used to pick an appropriate renderer when creating an annotation layer.
Returns:
Type Description object if this annotation replaces an existing one, this was the value that was replaced. In this case, a warning is issued. -
staticgeo.registerFeature(category, name, func, capabilities){object}
-
Register a new feature type.
Name Type Description category
string The feature category -- this is the renderer name.
name
string The feature name.
func
function A function to call to create the feature.
capabilities
object | undefined A map of capabilities that this feature supports. If the feature is implemented with different capabilities in multiple categories (renderers), then the feature should expose a simple dictionary of supported and unsupported features. For instance, the quad feature has color quads, image quads, and image quads that support full transformations. The capabilities should be defined in the base feature in a capabilities object so that they can be referenced by that rather than an explicit string.
Returns:
Type Description object if this feature replaces an existing one, this was the feature that was replaced. In this case, a warning is issued. -
staticgeo.registerFileReader(name, func)
-
Register a new file reader type.
Name Type Description name
string Name of the reader to register. If the name already exists, the class creation function is replaced.
func
function Class creation function.
-
staticgeo.registerLayer(name, func, defaultFeatures)
-
Register a new layer type.
Name Type Description name
string Name of the layer to register. If the name already exists, the class creation function is replaced.
func
function Class creation function.
defaultFeatures
Array.<string> optional An optional list of feature capabilities that are required to use this layer.
-
staticgeo.registerLayerAdjustment(category, name, func){object}
-
Register a layer adjustment. Layer adjustments are appiled to specified layers when they are created as a method to mixin specific changes, usually based on the renderer used for that layer.
Name Type Description category
string The category for the adjustment; this is commonly the renderer name.
name
string The name of the adjustment; this is commonly the layer type, or
'all'
for the base layer class.func
function The function to call when the adjustment is used.
Returns:
Type Description object if this layer adjustment replaces an existing one, this was the value that was replaced. In this case, a warning is issued. -
staticgeo.registerRenderer(name, func)
-
Register a new renderer type.
Name Type Description name
string Name of the renderer to register. If the name already exists, the class creation function is replaced.
func
function Class creation function.
-
staticgeo.registerWidget(category, name, func){object}
-
Register a new widget type.
Name Type Description category
string A category for this widget. This is usually
'dom'
.name
string The name of the widget to register.
func
function Class creation function.
Returns:
Type Description object If this widget replaces an existing one, this was the value that was replaced. In this case, a warning is issued. -
staticgeo.rendererForAnnotations(annotationList){string|null|false}
-
Check if there is a renderer that is supported and supports a list of annotations. If not, display a warning. This generates a list of required features, then picks the first renderer that supports all of these features.
Name Type Description annotationList
Array.<string> | object | undefined A list of annotations that will be used with this renderer. Instead of a list, if this is an object, the keys are the annotation names, and the values are each a list of modes that will be used with that annotation. See featuresForAnnotations for more details.
Returns:
Type Description string | null | false the name of the renderer that should be used or false if no valid renderer can be determined. -
staticgeo.rendererForFeatures(featureList){string|null|false}
-
Check if there is a renderer that is supported and supports a list of features. If not, display a warning. This picks the first renderer that supports all of the listed features.
Name Type Description featureList
Array.<string> | undefined A list of features that will be used with this renderer. Features are the basic feature names (e.g.,
'quad'
), or the feature name followed by a required capability (e.g.,'quad.image'
). If more than one feature or more than one capability of a feature is required, include each feature and capability combination in the list (e.g.,['quad.image', 'plane']
). If no capability is specified for a feature (or that feature was registered without a capability object), then the feature will match regardless of capabilities.Returns:
Type Description string | null | false The name of the renderer that should be used or false if no valid renderer can be determined.