Skip to main content

@mapgear/geoapps > Drawing

Drawing class

Provides access to the address search functionality of GeoApps. Can be accessed through the Map.Drawing-property.

Signature:
export declare class Drawing 

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Drawing class.

Example

An example of the usage:

// Connect as anonymous user to a geoapps environment
geoapps.Initialize("<specified tenant>");

// Add the map to a div with element id `map`
var map = geoapps.AddMap("map", "<mapId>");

// Wait till the map loaded, before starting the draw actions
map.onLoaded.add(() => {
// Drawing
map.Drawing.onLoaded.add(function () {
console.log(map.BaseLayers.items);
});

// Add feature
map.Drawing.AddFeature(<wkt>, <attributes>);

// Delete feature
map.Drawing.DeleteFeature(<featureId>);

// Get split feature
map.Drawing.GetSplitFeatures(<layerItemId>, <targetFeature>, <splitFeature>);

// Split feature
map.Drawing.Split(<layerItemId>, <targetFeature>, <splitFeature>, <options>);

// Start editing
map.Drawing.StartEdit(<LayerId>);

// Update attributes editing
map.Drawing.UpdateAttributes(<layer>, <selectedFeature>);
});

Events

PropertyModifiersTypeDescription
onLoadedreadonlyGAEvent<GAEventArgs>Triggers when the drawable layers has been loaded (or reloaded)

Properties

PropertyModifiersTypeDescription
LayersreadonlyDrawableLayerItem[]Available layers that can be used for drawing

Methods

MethodModifiersDescription
AddFeature(wkt, attributes)Creates a feature on the dataset from the WKT-string
DeleteFeature(featureId)Deletes feature from dataset
GetSplitFeatures(layerItemId, targetFeature, splitFeature)Retrieves the split features based on the intersect with another (drawn) feature
Split(layerItemId, targetFeature, splitFeature, options)Splits the feature on the intersects with another (drawn) feature
StartEdit(layerItemId, selectedFeature)Retrieves editable dataset attributes for current feature that is being edited.
UpdateAttributes(layer, selectedFeature)Updates existing feature's attributes