This is the documentation for the API features of Cloud/Embedded Explorer. It provides a reference for the different methods available. For information on setting up the viewer, please view the quick start guide.
Version
  • 0.37.1

Methods

(static) addFeatures(features)

Add one or more GeoJSON feature annotations to the map. Currently only accepts GeoJSON objects of type: "Feature". For a full list of supported feature types, see module:Annotation-Types.
Parameters:
NameTypeDescription
featuresFeaturesObject containing the features to be added.
Example

Add a point annotation.

map.addFeatures({
  geoJson: [{
    type: "Feature",
    geometry: {
      type: "Point",
      coordinates: [-122.126986, 47.639754],
    },
  }],
});

(static) enableMeasurementPanel(enabled, callbackopt)

Enable or disable the measurement panel.
Parameters:
NameTypeAttributesDescription
enabledbooleanTrue to enable the measurement panel, false to disable.
callbackfunction<optional>
Called after successfully disabling toggling the measurement panel.
Example
map.enableMeasurementPanel(false, () => console.log('Measurement panel disabled'));

(static) enableSearchBar(enabled, callbackopt)

Enable or disable the search bar.
Parameters:
NameTypeAttributesDescription
enabledbooleanTrue to enable the search bar, false to disable.
callbackfunction<optional>
Called after successfully toggling the search bar.
Example
map.enableSearchBar(false, () => console.log('Search bar disabled'));

(static) getAppVersion() → {string}

Retrieves the current version of the application. Useful when sending bug reports.
Returns:
- Version of the running application.
Type: 
string
Example
// returns 1.0.0
map.getAppVersion();

(static) getFeatures() → {Features}

Returns an object containing all the features that were added to the application using the addFeatures API method.
Returns:
features - Object containing all the features that have been added.
Type: 
Features
Example

Retrieve all the feature.

  map.getFeatures();

(static) getLayers() → {Array.<Layer>}

The getLayers API method should return the current status of the layers present in EE. For Ex. If the user has turned on any layers in EE and then calls the getLayers API method, it should now return the list of layers with a few turned on, reflecting the exact current layer status in EE.
Returns:
An array of layer object available in the DB
Type: 
Array.<Layer>
Examples

example of getLayers api response:

[{
  id: 3680,
  groupId: 1,
  groupName: 'Group1',
  name: 'AAA_polygon_web_hook',
  visible: false
},
{
  id: 3681,
  groupId: 1,
  groupName: 'Group1',
  name: 'web_hook',
  visible: false
}]
map.getLayers();
map.on('onLayersDataLoad', (layerData)=>{ console.log('Layer results:',layerData)});

(static) layerSearch(searchObject, callbackopt)

The layerSearch API is a text search method that returns a list of features found within the specified layer. It also automatically navigates to the first matching feature.
Parameters:
NameTypeAttributesDescription
searchObjectObjectSearch parameters.
Properties
NameTypeAttributesDescription
idnumberLayer id for the layer being searched which can be retrieved from getLayers() api
searchStringstringA string to search within the layer.
searchPropertiesArray.<string><optional>
An array containing the list of attributes on which the search should be performed.
callbackfunction<optional>
(features) => {} callback function returns a GeoJSON feature collection and the response format will be like { features: [ { geometry: { coordinates: [], type: '' }, properties: {}, type: '', } ] }
Examples

LayerSearch with event listener

map.on('layerSearch', (features)=>{ console.log('Layer search results:',features)});
map.layerSearch({ id: 3598, searchString: '15', searchProperties:['apn', 'object_id'] });

LayerSearch with callback function

map.layerSearch({ id: 3263, searchString: '15', searchProperties:['address'] }, (features)=>{console.log(features)});

example of layersearch api response:

{ features: [
         {
             "id": 123456,
             "type": "Feature",
             "geometry": {
                  "type": "Polygon",
                   "coordinates": [
                          [-119.10137799599994, 38.364409468000076],
                          [-119.09784600699999, 38.36741644700004],
                          [-119.09938722199996, 38.368532781000056],
                          [-119.10291920199995, 38.36552575700006],
                          [-119.10137799599994, 38.364409468000076]
                     ]
              },
             "properties": {
                 "addr": null,
                 "apn": "15",
                 "apn2": "15",
              }
           },
         ]
}

(static) off(eventName)

Remove all listeners for a Embedded-Explorer-API event.
Parameters:
NameTypeDescription
eventName'onViewUpdate' | 'layerSearch' | 'Errors' | 'onMapReady' | 'onLayersDataLoad'Name of event
Examples

Stop handling onViewUpdate events.

map.off('onViewUpdate');

Stop handling layerSearch events.

map.off('layerSearch');

Stop handling Errors events.

map.off('Errors');

Stop handling onMapReady events.

map.off('onMapReady');

Stop handling onLayersDataLoad events.

map.off('onLayersDataLoad');

(static) on(eventName, listener)

Add an external listener for a Embedded-Explorer-API event.

An 'onViewUpdate' event is dispatched when a view change action has complete.

An 'featureClick' event is dispatched when annotations on the map are clicked. This will be a collection of features, as they may overlap. Features on top will be the first elements in the array

An 'Errors' event is dispatched when an error occurs within an API call.

An 'layerSearch' event is dispatched when layer search API return features.

An 'onMapReady' event is dispatched when map load complete and ready to use.

An 'onLayersDataLoad' event is dispatched when layers fetch API return layers and groups detail after load complete.
Parameters:
NameTypeDescription
eventName'onViewUpdate' | 'featureClick' | 'layerSearch' | 'Errors' | 'onMapReady' | 'onLayersDataLoad'Name of event
listenerfunctionListener handler function.
Examples

Listening for the onViewUpdate event.

map.on('onViewUpdate', (updatedView) => {
  console.log(`updated lat/lon: ${updatedView.lonLat.lat}, ${updatedView.lonLat.lon}`);
  console.log(`updated zoom: ${updatedView.zoom}`);
  console.log(`updated pitch: ${updatedView.pitch}`);
  console.log(`updated rotation: ${updatedView.rotation}`);
});

Listening for the featureClick event.

map.on('featureClick', (features) => {
  for (feature in features.geoJson) {
    console.log(`Feature Clicked! ${feature.properties.eagleview.value`);
  }
});

Listening for the layerSearch event.

map.on('layerSearch', (features) => {
    console.log(`layer search features! ${features`);
});

Listening for the Errors event.

map.on('Errors', (error) => {
  console.log(error);
});

 

Listening for the layer data loaded event.

map.on('onLayersDataLoad', (layerData) => {
  console.log(layerData);
});

 

Listening for the map load complete event.

map.on('onMapReady', () => {
  console.log(onMapReady);
});

(static) removeFeatures(featureFilters)

Allows the removal of added geoJson features through the use of a filter function. Features that are returned by the filter will be removed from the map. If no argument is passed in, all feature annotations that were added will be removed.
Parameters:
NameTypeDescription
featureFiltersFeatureFiltersObject containing filter functions for removing annotation features.
Examples

Remove all added annotation features.

  map.removeFeatures();

Remove all geoJson point features.

  map.removeFeatures({ geoJson: (feature) => feature.geometry.type === "Point" })

(static) searchAddress(value)

Navigates to the given address and attempts to load the Oblique/Ortho images and display the address at the given location. Example:
Parameters:
NameTypeDescription
valueStringAddress String.

(static) setAuthToken(token)

Set a new or updated auth token.
Parameters:
NameTypeDescription
tokenstringNew auth token to use.
Example
map.setAuthToken('authToken');

(static) setLonLat(value, callbackopt)

Navigates to the given address and attempts to load the Oblique/Ortho images and display the address at the given location. Callback receives the updated view object.
Parameters:
NameTypeAttributesDescription
valueObjectlonLat object {lon:, lat:}
Properties
NameTypeAttributesDescription
lonnumberLongitude in WGS84.
latnumberLatitude in WGS84.
znumber<optional>
Elevation value is always entered in meters. The default is height above ellipsodial.
zTypestring<optional>
Set the type of elevation reference entered for the z-axis (value.z):
callbackfunction<optional>
Called after successfully setting lat lon. Receives the value passed to the function. For height above ellipsoidal(default) = zType: 'HEIGHT_REFERENCE_ELLIPSOIDAL' For height above orthometric = zType: 'HEIGHT_REFERENCE_ORTHOMETRIC'
Examples

Navigate to and display address

map.setLonLat({ lat: 23, lon: 45 }, () => console.log(`Map location set`));

Navigate to and display address with z-axis drawing

map.setLonLat({ lat: 23, lon: 45, z:100 }, () => console.log(`Map location set`));

Navigate to and display address with z-axis drawing and zType option

map.setLonLat({ lat: 23, lon: 45, z:100, zType: 'HEIGHT_REFERENCE_ORTHOMETRIC' }, () => console.log(`Map location set`));

(static) setPitch(value, callbackopt)

Set the pitch of the map view.
Parameters:
NameTypeAttributesDescription
valuenumberMap pitch in degrees. The value is clamped to between 0 and 60.
callbackfunction<optional>
Called after successfully setting pitch. Receives the updated view object.
Example
map.setPitch(10, () => console.log('Map pitch set'));

(static) setRotation(value, callbackopt)

Set the rotation of the map view.
Parameters:
NameTypeAttributesDescription
valuenumberMap rotation angle in degrees.
callbackfunction<optional>
Called after successfully setting rotation. Receives the updated view object.
Example
map.setRotation(45, () => console.log('Map rotation set'));

(static) setView(value, callbackopt)

Set the current view based on the standard view parameters.
Parameters:
NameTypeAttributesDescription
valueObjectView parameters.
Properties
NameTypeAttributesDefaultDescription
lonLatObject<optional>
longitude and latitude parameters
Properties
NameTypeDescription
lonnumberLongitude in WGS84.
latnumberLatitude in WGS84.
znumberElevation value is always entered in meters. The default is height above ellipsodial.
zTypestringSet the type of elevation reference entered for the z-axis (value.z):
zoomnumber<optional>
Map zoom level. Clamped to a value between 1.03 and 26.
pitchnumber<optional>
5Map pitch in degrees. Clamped to a value between 0 and 60 degrees.
rotationnumber<optional>
0Map rotation in degrees.
callbackfunction<optional>
(view) => {} Called after successfully setting the view. Receives the updated view object. For height above ellipsoidal(default) = zType: 'HEIGHT_REFERENCE_ELLIPSOIDAL' For height above orthometric = zType: 'HEIGHT_REFERENCE_ORTHOMETRIC'
Examples
map.setView({ lonLat: {lat: 23, lon: 45}, zoom: 20, pitch: 15, rotation: -75 }, (value) => console.log('View has been set.'));
map.setView({ lonLat:{ lat: 23, lon: 45, z:100 }, zoom: 20, pitch: 15, rotation: -75}, (value) => console.log('View has been set.'));
map.setView({ lonLat:{ lat: 23, lon: 45, z:100, zType: 'HEIGHT_REFERENCE_ORTHOMETRIC' },
 zoom: 20, pitch: 15, rotation: -75, }, (value) => console.log('View has been set.'));

(static) updateLayers(options)

The updateLayers API method updates the state (i.e. show or hide on the map) of the layers present in EE. Layers are referenced by layerId or groupId. Layer and group IDs can be discovered using the getLayers API method. This API method helps toggle the visibility of layers by turning them TRUE or FALSE.
Parameters:
NameTypeDescription
optionsObjectOptions object
Properties
NameTypeDescription
filterfunctionfilter function for altering a feature or layer state on the map. Typically used to alter the visibility, that is show or hide a feature or layer
Properties
NameTypeDescription
visibleBoolean if true the layer is made visible on the map, if false the layer is hidden
Example
map.updateLayers({
    filter: (layer) => {
        if (layer.id === 1234) {
            layer.visible = true;
        }
    }
});

(static) zoomIn(valueopt, callbackopt)

Increase the map zoom level. The resulting zoom level is clamped to be between 1.03 and 26.
Parameters:
NameTypeAttributesDefaultDescription
valuenumber<optional>
1Steps to increase the zoom level by.
callbackfunction<optional>
Called after successfully zooming in. Receives the updated view object.
Example
map.zoomIn(2, () => console.log('Map zoom increased'));

(static) zoomOut(valueopt, callbackopt)

Decrease the map zoom level. The resulting zoom level is clamped to be between 1.03 and 26.
Parameters:
NameTypeAttributesDefaultDescription
valuenumber<optional>
1Steps to decrease the zoom level by.
callbackfunction<optional>
Called after successfully zooming out. Receives the updated view object.
Example
map.zoomOut(2, () => console.log('Map zoom decreased'));

Type Definitions

Features

Type:
  • Object
Properties
NameTypeDescription
geoJsonArray.<GeoJsonFeature>Array of GeoJson features that had been added to the application.

Layer

Type:
  • Object
Properties
NameTypeDescription
idnumberLayer id
groupIdnumbergroup id of layer
groupNamestringgroup name of layer
namestringlayer name
visiblebooleanvisibility of layer on the map
Example
{
  id: 3680,
  groupId: 1,
  groupName: 'Group1',
  name: 'AAA_polygon_web_hook',
  visible: false
}