Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.97k stars 992 forks source link

Confused by versioning - differs greatly on npm, examples, and README #880

Open benjaminhoffman opened 6 years ago

benjaminhoffman commented 6 years ago
  1. excited I found this repo! thank you all that are actively supporting Leaflet Draw. this may be exactly what I need for my project and it will make my life much easier.

  2. im confused about the following. why the discrepancy with:

I understand and agree that I should not be copy/pasting code from the example to get started. But most times I like to start with the example, intentionally break the code and hack with it until I understand it, then start fresh by wiping clean. And let's be honest here -- most people use the examples to learn and evidently copy/paste.

But maybe I am missing something... is there a reason the examples don't use the latest version of Leaflet Draw in production? Should I be using v0.4.2 in prod even though it's not supported anymore Just a bit confused, that's all. Thank you!

ps. I should note that I am using the most basic example from the README. see below. i get errors when I try to draw and also notice how the controls render. using version from yarn add leaflet-draw

screen shot 2018-08-26 at 1 24 58 pm
benjaminhoffman commented 6 years ago

I'd hate to pile another piece of feedback but...

If I'm experiencing trouble getting started I wonder if other folks could benefit too.

ddproxy commented 6 years ago

Thanks, @benjaminhoffman - I've been a bit slow lately to implement changes as I've been ramping up with work projects. I'll take some time this week to roll a new release and clarify the documentation.

benjaminhoffman commented 6 years ago

@ddproxy that would be awesome. I have some time later today and tomorrow, hopefully I can hack my way through it.

I'm mostly looking to see how I can get started with v.1+. thx!

aqueiros commented 6 years ago

@ddproxy what would be super awesome. I have been hoping for a version with a fix for https://github.com/Leaflet/Leaflet.draw/pull/838/files 🙏

benjaminhoffman commented 6 years ago

hey. sorry to bother. @ddproxy is there are community of leaflet draw folks that I can hack/pair with? i'd may be open to paying a consultant if that makes things easier.

been fiddling with this library for hours now and keep getting stuck. our project is blocked so now looking for alternative solutions.

masimons commented 6 years ago

I'm experiencing similar issues as OP. Can you post a working example using the latest version of Leaflet Draw, as currently published on NPM? It's currently not working and having trouble getting started.

smashthestate commented 6 years ago

In case you haven't solved this issue - you have to remove the { drawControl: true } object from your map constructor OR the map.addControl(drawControl) method. I don't know how it worked before, but it seems right now they do the same thing except you have more control with the L.Control.Drawconstructor.

This worked for me on ionic angular with leaflet v1.3.4 and leaflet draw v1.0.3

ddproxy commented 5 years ago

There are two sets of examples with different versions since Leaflet v1 was released ~ suggest using the most recent Leaflet.draw plugin with most recent Leaflet and adding controls manually (map.addControl(drawControl);) as @smashthestate has suggested.

{drawControl: true} adds a 'standard' configuration.

https://github.com/Leaflet/Leaflet.draw/blob/master/docs/leaflet-draw-1.0.1.html May be a bit better to start with.

tustin2121 commented 5 years ago

I'd hate to pile another piece of feedback but...

  • would be great to move the Install section to the top of the docs. this seems to be common practice of most libraries I use
  • include a Get Started section that includes how to install leaftlet draw and get up and started very quickly

If I'm experiencing trouble getting started I wonder if other folks could benefit too.

The above implies there was at one point an "Install" and "Get Started" section? Because there isn't anymore... There doesn't seem to be any instructions on how to install things, where to get the library from, or what to do. The "dist" folder has nothing, there's no set of files or min file to download in any of the releases, there's no place to download files from the doc site... this plugin is apparently unusable. Shame, because the examples show it to be the best of the dozen or so drawing plugins...

alexxgarci commented 3 years ago

Hi folks, what about this issue? I'm working with leaflet: v1.7.1 and leaflet-draw: 1.0.3 and still getting the L.Control.Draw is not a constructor. Any ideas or workarounds on this? I've looked up all the issues and still have no idea on how to solve it.

ghost commented 3 years ago

@alexxgarci I think it is simple as: leaflet: v1.7.1 is released on 4 Sep 2020. leaflet-draw v0.4.14 is released on 20 Jan 2018·

probably try using: leaflet-geoman ?

I want to simply add a circle that is resizable, to be able to search within a radius, for me leaflet-geoman would be a heavy addition to the project unfortunately.