简体   繁体   中英

Open Layers 3 Drag & Drop feature, get file name of file dropped

Dragging and dropping vector layers can be achieved as per the instructions on the Openlayers 3 demo page:

http://openlayers.org/en/v3.15.1/examples/drag-and-drop.html

This works perfectly fine, so I shan't post the source code here.

My question is: How can I get the file name (or layer name) that's being added to the map? Nothing stands out to me in the API documentation here .

I've sussed it out, it isn't present in the API docs as far as I can tell, but via Firebug I was able to get the value from within the dragAndDropInteraction event handler:

dragAndDropInteraction.on('addfeatures', function(event) {    
     var file_name = event.file.name;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM