Giter Club home page Giter Club logo

leaflet-geoman's Issues

Map controls get multiplied

When calling the map.pm.addControls multiple times with the same truthy values, the related controls get multiplied:

image

listen to when a new layer is created

Hi,

I'm currently trying to configure a function to save the draw data to a geojson file, however the markers are not integrate to the function with "map.on('pm:create', function(e) {//...});".
I noticed that it's possible with other objects like line and polygon.

Do you have a solution for this?
Thanks

Create new Demo Page

The current gh-pages branch is a small copy/mix of the demo.js in the master branch and the readme file.
Create a new website that shows off the features of leaflet.pm

Unit Test Coverage

The features grow - there will soon be too much cases to test manually so: automate it with unit tests, possibly e2e tests.

Expose an additional event before and after a polygon gets deleted

Hi there.

There are several pm-custom events including created, edited and dragXYZ.
AFAIK there are no events which get triggered when a polygon gets deleted. On the one hand it would be nice to ask for confirmation (like a pm:deletestart event) and on the other hand I would like to send a request after the polygon was deleted (like a pm:deleteend event).

thanks :)

Refactor Controls

if(this.toggled()) {
  L.PM.enableDraw({
      map: map
  });
} else {
  L.PM.disableDraw(map);
}

should be replaced with a toggleDraw function.

L.PM.Draw.Poly should return if drawing mode is active or not.
Double Check that L.PM.Draw isn't getting messed up with multiple instances/maps.

L.PM.Draw isn't used as a constructor class

There are issues with multiple maps on a page as L.PM.Draw() is used like I'm a noob coder or something.
Fix it, future self πŸ‘Š

Add L.PM.Draw as a new object to a map. Then everything is πŸ‘Œ

Errors during Polygon Edit while in Drawing mode

Enable drawing mode, enable edit mode of a polygon, drag a marker => errors.

This is because the yet-to-be-drawn polygon is already a layer on the map but has no (as in, less than 2) coordinates.

Draw at least two coordinates and the errors disappear.

This means the snap-calculation needs to handle (=ignore) layers with fewer than 2 coordinate points.

Showing Measurement on Line and Polygon

Hello, first, I want to show this is a great plugin. I am able to show measurement on line and polyon by integrating this with leaflet plugin (Leaflet Measure Path by ProminentEdge) in the option.

map.pm.setPathOptions({
showMeasurements: true,
});

But, I do not know how to update those measurements when I edit a line or polygon. I am new to leaflet. Could you please help me?

Toolbar Button Names are inconsistent

var options = {
    drawPolygon: true,  // adds button to draw a polygon
    editPolygon: true,  // adds button to toggle global edit mode
    deleteLayer: true   // adds a button to delete layers
};

this is bad naming for these buttons. Change it.

Unable to Remove Last Point from Polygon

After drawing out a polygon, if you want to remove it... you can remove all points except the last one.

Also, it would be great to see some functionality for deleting an entire polygon with one action as opposed to a point by point removal approach.

Nevertheless, nice work so far!

Icons missing

Not sure how bower can handle images (icons). Got to do something about it or make it a requirement that devs provide icon paths.

GeoJSON with points throws Uncaught TypeError: Cannot read property 'enabled' of undefined

If GeoJSON layer contains points then pm logs console error Uncaught TypeError: Cannot read property 'enabled' of undefined when it sees the L.Marker type of layer.

To reproduce use this: http://plnkr.co/edit/ZjLXPgIWpcAq2k9xIKoJ?p=preview

Expected behavior: map.fitBounds(geoJsonLayer.getBounds()) gets called
Actual behavior: map.fitBounds(geoJsonLayer.getBounds()) is not called because call to geoJsonLayer.addData(json) throws an exception

Custom style for drawn polygon

Make an optional style that can be passed to the draw class so that a polygon that is currently drawn doesn't have to be just red lines:
image

include default CSS for markers

When the following CSS from the Demo isn't included the markers obviously won't show up

.marker-icon, .marker-icon:focus {
    background-color: #ffffff;
    border: 1px solid #3388FF;
    border-radius: 50%;
    margin: -7px 0 0 -7px !important;
    width: 14px !important;
    height: 14px !important;
    outline: 0;
}

So.. create a /dist folder and put .css and .js in there

pm.toggleEdit does not work after new layer contents is added

When new layer contents is added after the pm plugin was initialized, it does not handle pm:edit events for newly added elements.

Like this:

var geoJsonLayer = L.geoJson().addTo(map);
geoJsonLayer.addData(json);
geoJsonLayer.addEventListener('click', function() {
    geoJsonLayer.pm.toggleEdit();
});

Clicking on the geoJsonLayer does not enter the edit mode

Custom Styles on Creation

AFAIK it's currently not possible to pass custom styles for polygons, polylines & markers.
So as soon as I create an element, it gets the leaflet default style. Is it possible to define some custom styles, so that they get applied on creation?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.