Class: DragAndDrop


import DragAndDrop from 'ol/interaction/DragAndDrop';

Handles input of vector data by drag and drop.

new DragAndDrop(opt_options)

interaction/DragAndDrop.js, line 90
Name Type Description


Name Type Description
formatConstructors Array.<function(new:module:ol/format/Feature~FeatureFormat)>

Format constructors.

source module:ol/source/Vector~VectorSource

Optional vector source where features will be added. If a source is provided all existing features will be removed and new features will be added when they are dropped on the target. If you want to add features to a vector source without removing the existing features (append only), instead of providing the source option listen for the "addfeatures" event.

projection module:ol/proj~ProjectionLike

Target projection. By default, the map's view's projection is used.

target Element

The element that is used as the drop target, default is the viewport element.