Geopicker

Geopicker

new Geopicker()

Source:

Extends

Members

(static) selector :string

Source:
Type:
  • string

(readonly) downloadButtonHtml :Element

Source:
Inherited From:

Returns a HTML document fragment for a download button.

Type:
  • Element

(readonly) originalInputValue :*

Source:
Overrides:

Obtains the value from the original form control the widget is instantiated on. This form control is often hidden by the widget.

Type:
  • *

props

Source:
Overrides:

Gets the widget properties and features.

(readonly) resetButtonHtml :Element

Source:
Inherited From:

Returns a HTML document fragment for a reset button.

Type:
  • Element

value :string

Source:
Overrides:
Type:
  • string

Methods

(static) condition(element) → {boolean}

Source:
Parameters:
Name Type Description
element Element

The element to instantiate the widget on

Returns:

To instantiate or not to instantiate, that is the question.

Type
boolean

_addDomElements()

Source:

Adds the DOM elements

_addDynamicMap() → {Promise}

Source:
Returns:

A Promise that resolves with undefined.

Type
Promise

_addPoint()

Source:

Adds a point.

_addPointBtn()

Source:

Adds a point button in the point navigation bar

_cleanLatLng(latLng)

Source:
Parameters:
Name Type Description
latLng LatLngArray | LatLngObj

Geo array or object to clean

_closePolygon()

Source:

Closes polygon

_convertKmlCoordinatesToLeafletCoordinates(kmlCoordinates) → {Array.<Array.<number>>}

Source:

Converts the contents of a single KML element (may inlude the coordinates tags as well) to an array of geopoint coordinates used in the ODK XForm format. Note that the KML format does not allow spaces within a tuple of coordinates only between. Separator between KML tuples can be newline, space or a combination. It only extracts the value of the first element or, if are not included from the whole string.

Parameters:
Name Type Description
kmlCoordinates string

KML coordinates XML element or its content

Returns:

Array of geopoint coordinates

Type
Array.<Array.<number>>

_dynamicMapAvailable() → {boolean}

Source:
Returns:

Whether map is available for manipulation

Type
boolean

_editPoint(latLng) → {boolean}

Source:

Edits a point in the list of points.

Parameters:
Name Type Description
latLng LatLngArray | LatLngObj

LatLng object or array.

Returns:

Whether point changed.

Type
boolean

_enableDetection()

Source:

Enables geo detection using the built-in browser geoLocation functionality

_enableSearch()

Source:

Enables search functionality using the Google Maps API v3 This only changes the map view. It does not record geopoints.

_getBaseLayers(layers) → {Array.<object>}

Source:
Parameters:
Name Type Description
layers Array.<object>

Map layers

Returns:

Base layers

Type
Array.<object>

_getDefaultLayer(layers) → {object}

Source:
Parameters:
Name Type Description
layers Array.<object>

Map layers

Returns:

Default layer

Type
object

_getGoogleTileLayer(map, index) → {Promise}

Source:

Asynchronously obtains a Google Maps tilelayer

Parameters:
Name Type Description
map object

Map layer as defined in the apps configuration.

index number

The index of the layer.

Returns:

A promise that resolves with a Google Maps layer.

Type
Promise

_getLayers() → {Promise}

Source:

Obtains the tile layers according to the definition in the app configuration.

Returns:

A promise that resolves with the map layers.

Type
Promise

_getLeafletTileLayer(map, index) → {Promise}

Source:

Asynchronously (fake) obtains a Leaflet/Mapbox tilelayer

Parameters:
Name Type Description
map object

Map layer as defined in the apps configuration.

index number

The index of the layer.

Returns:

A promise that resolves with a Leaflet tile layer.

Type
Promise

_getProps() → {object}

Source:
Inherited From:

Not meant to be overridden, but could be. Recommend to extend get props() instead.

Returns:

props object

Type
object

_getTileOptions(map, index) → {Object}

Source:

Creates the tile layer options object from the maps configuration and defaults.

Parameters:
Name Type Description
map object

Map layer as defined in the apps configuration.

index number

The index of the layer.

Returns:

Tilelayer options object

Type
Object

_inFullScreenMode() → {boolean}

Source:
Returns:

Whether map is in fullscreen mode

Type
boolean

_init()

Source:
Overrides:

Meant to be overridden, but automatically called.

_isValidGeopoint(geopoint) → {boolean}

Source:

Checks an Openrosa geopoint for validity. This function is used to provide more detailed error feedback than provided by the form controller. This can be used to pinpoint the exact invalid geopoints in a list of geopoints (the form controller only validates the total list).

Parameters:
Name Type Description
geopoint string

Geopoint to check

Returns:

Whether geopoint is valid.

Type
boolean

_isValidLatLng(latLng) → {boolean}

Source:

Validates an individual latlng Array or Object

Parameters:
Name Type Description
latLng LatLngArray | LatLngObj

latLng object or array

Returns:

Whether latLng is valid or not

Type
boolean

_isValidLatLngList(latLngs) → {boolean}

Source:

Validates a list of latLng Arrays or Objects.

Parameters:
Name Type Description
latLngs Array.<(LatLngArray|LatLngObj)>

Array of latLng objects or arrays.

Returns:

Whether list is valid or not.

Type
boolean

_loadGoogleMapsScript() → {Promise}

Source:

Loader for the Google Maps script that can be called multiple times, but will ensure the script is only requested once.

Returns:

A promise that resolves with undefined.

Type
Promise

_markAsInvalid(index)

Source:

Marks a point as invalid in the points navigation bar

Parameters:
Name Type Description
index number

Index of point

_markAsValid()

Source:

Marks all points as valid in the points navigation bar

_removePoint()

Source:

Removes the current point.

_setCurrent(index)

Source:

Changes the current point in the list of points

Parameters:
Name Type Description
index number

The index to set to current

_showIntersectError()

Source:

Displays intersect error

_switchInputType(type)

Source:
Parameters:
Name Type Description
type string

Type of input to switch to

_updateArea(points)

Source:

Updates the area in m2 shown inside a polygon.

Parameters:
Name Type Description
points Array.<LatLngObj>

A polygon.

_updateDynamicMapView(latLng, zoomopt)

Source:
Parameters:
Name Type Attributes Description
latLng LatLngArray | LatLngObj

Latitude and longitude coordinates

zoom number <optional>

zoom level

_updateInputs(coords, evopt)

Source:

Updates the (fake) input element for latitude, longitude, altitude and accuracy.

Parameters:
Name Type Attributes Description
coords LatLngArray | LatLngObj

Latitude, longitude, altitude and accuracy.

ev string <optional>

Event to dispatch.

_updateMap(latLng, zoomopt)

Source:

Updates the map to either show the provided coordinates (in the center), with the provided zoom level or update any markers, polylines, or polygons.

Parameters:
Name Type Attributes Description
latLng LatLngArray | LatLngObj

Latitude and longitude coordinates

zoom number <optional>

zoom level

_updateMarkers()

Source:

Updates the markers on the dynamic map from the current list of points.

_updatePolygon()

Source:

Updates the polygon on the dynamic map from the current list of points. A polygon is a type of polyline. This function is ALWAYS called by _updatePolyline.

_updatePolyline()

Source:

Updates the polyline on the dynamic map from the current list of points

_updateValue() → {boolean}

Source:

Updates the value in the original input element.

Returns:

Whether the value was changed.

Type
boolean

containsEmptyPoints(points, allowedIndexopt) → {boolean}

Source:

Checks whether the array of points contains empty ones.

Parameters:
Name Type Attributes Description
points Array.<LatLngArray>

Array of geopoints

allowedIndex number <optional>

The index in which an empty value is allowed.

Returns:

Whether the array contains empty points.

Type
boolean

disable()

Source:
Overrides:

Disables the widget

enable()

Source:
Overrides:

Enables a disabled widget

update()

Source:
Overrides:

Updates the widget if the value has updated programmatically (e.g. due to a calculation)

updatedPolylineWouldIntersect(latLng, index) → {boolean}

Source:

Check if a polyline created from the current collection of points where one point is added or edited would have intersections.

Parameters:
Name Type Description
latLng LatLngArray | LatLngObj

An object or array notation of point.

index number

Index of point to test.

Returns:

Whether polyline would have intersections.

Type
boolean