Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Paste serialized vector data into your Leaflet maps!
JavaScript
Branch: master
Failed to load latest commit information.
dist
example
lib
src
.gitignore
LICENSE
README.md
grunt.js
package.json

README.md

Leaflet.paste

Provides a Leaflet control for copy & pasting serialized vector data (WKT or GeoJSON) into a map. Upon submission of the control, the data is parsed and converted into vector layers on the map.

Check out the demo.

Usage

To use with default settings, just set pasteControl = true in your Leaflet map's options.

If you would like to specify which data formats to accept, add the control manually.

E.g:

var layer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'),
    map = L.map('map', { layers: [layer] }),
    pasteControl = L.Control.paste({
      geojson: false
    });

map.addControl(pasteControl);

map.on('paste:layer-created', function (e) {
    map.addLayer(e.layer);
});

See example/Leaflet.paste.html for a working example.

Includes

Leaflet.paste includes Wicket, a library for parsing WKT.

Something went wrong with that request. Please try again.