leaflet-geoman | powerful leaflet plugin for drawing and editing geometry | Map library

 by   geoman-io JavaScript Version: 2.14.2 License: MIT

kandi X-RAY | leaflet-geoman Summary

kandi X-RAY | leaflet-geoman Summary

leaflet-geoman is a JavaScript library typically used in Geo, Map applications. leaflet-geoman has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i leaflet-geoman-tiny' or download it from GitHub, npm.

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              leaflet-geoman has a medium active ecosystem.
              It has 1876 star(s) with 393 fork(s). There are 43 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 31 open issues and 695 have been closed. On average issues are closed in 17 days. There are 10 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of leaflet-geoman is 2.14.2

            kandi-Quality Quality

              leaflet-geoman has 0 bugs and 0 code smells.

            kandi-Security Security

              leaflet-geoman has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              leaflet-geoman code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              leaflet-geoman is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              leaflet-geoman releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed leaflet-geoman and discovered the below as its top functions. This is intended to give you an instant insight into leaflet-geoman implemented functionality, and help decide if they suit your requirements.
            • Creates a vector and returns the gradient .
            • Prioritizes an object using a map
            • Calculates the destination location for a heading .
            • Initialize the PMarkerMarker
            • Create a polygon polygon .
            • Get the type of a Layer
            • Flattens a polyline .
            • Recursively convert latlngs to a map .
            • Iterate over all latlng objects
            • Get the intersection of two polygons .
            Get all kandi verified functions for this library.

            leaflet-geoman Key Features

            No Key Features are available at this moment for leaflet-geoman.

            leaflet-geoman Examples and Code Snippets

            No Code Snippets are available at this moment for leaflet-geoman.

            Community Discussions

            QUESTION

            Drawing different objects on leaflet map with custom controls
            Asked 2021-Nov-13 at 10:33

            I would like to draw different type of objects on a leaflet map with leaflet-geoman. I have a geojson layer not editable (agricol parcels) on overlay pane and I want to choose in a combobox (or buttons nethermind) the type of object to draw. It can be markers (for trees for example) or polyline (hedge...) or polygone (forest...) with different style (color, marker, tooltip...) : a forest is green, a tree with some icon, a hedge is brown, a forest is green fill.... Just after the end of drawing, I would like to show a popup to fill some information like the name of the object for example. I would like to put all these drawings in a layer that can be shown/hide with the pane control. I can have different layers according to the type of objects. At least, I would like to get all drawn objects (with extra informations...) and save it in geojson. Do you have an example for doing such thing ? I still didn't found anything. Thank's

            Guen

            ...

            ANSWER

            Answered 2021-Nov-13 at 10:33

            You can create different draw shapes to give them different color: customcontrols.js:

            Source https://stackoverflow.com/questions/69953106

            QUESTION

            How to get latlngs values after edit a polygon in Leaflet-Geoman?
            Asked 2021-Oct-19 at 07:36

            Suppose I have a geojson data:

            ...

            ANSWER

            Answered 2021-Oct-19 at 06:58

            In the pm:edit event you have the layer in the payload. From it you can use toLatLngs():

            Source https://stackoverflow.com/questions/69621270

            QUESTION

            Webpack lazy loading Leaflet-Geoman
            Asked 2021-Sep-18 at 10:11

            I am trying to lazy load js drawing library Leaflet-Geoman

            I am using webpack and the following code to load

            ...

            ANSWER

            Answered 2021-Sep-18 at 10:11

            Geoman is adding it self to the map while initializing the map. This means if L.Map is called before Geoman-Script is added to your site, Geoman will not be added to the map. Then you need to call L.PM.reInitLayer(map).

            Source https://stackoverflow.com/questions/69224411

            QUESTION

            Maintaining the topology on a MultiLineString
            Asked 2021-Jul-02 at 09:23

            I'm trying to get topological movement of lines with Leaflet-Geoman plugin using TopoJSON. There is a method called topojson.mesh , which

            Returns the GeoJSON MultiLineString geometry object representing the mesh for the specified object in the given topology. This is useful for rendering strokes in complicated objects efficiently, as edges that are shared by multiple features are only stroked once. If object is not specified, a mesh of the entire topology is returned.

            Thanks to answer in this post, I've been able to return the MultiLineString using topojson.mesh. Since Leaflet-Geoman supports MultiLineString I came across with idea that may be the returned mesh can be edited with Leaflet-Geoman while maintaining the topological properties.

            But when I try to accomplish it, the returned MultiLineString get separated in to two parts when I try to edit it using geoman plugin. My question is if that it is really a mesh that returned from topojson.mesh why the lines get seperated? Does that cause by geoman plugin? If that so, how can I get it done? Is there any way I can change the position of a node by dragging it while maintaining the topology?

            I'll attach the code below

            ...

            ANSWER

            Answered 2021-Jul-02 at 09:21

            For anyone who is looking for an answer to this type of question, I found a method using OpenLayers v6.5.0. Their is an example for Draw and Modify Features, which can maintain the topology of lines and polygons.

            Hope this helps some one :)

            Source https://stackoverflow.com/questions/68141878

            QUESTION

            How to use / declare an external module, which won't pass strict and noImplicitReturns TypeScript settings in Angular 11?
            Asked 2021-Jun-14 at 09:28

            We have an Angular 11 application with strict mode turned on. It has these values in the compilerOptions configurtation in tsconfig.json:

            ...

            ANSWER

            Answered 2021-Mar-29 at 10:05

            Even though the @types are included in the leaflet and leaflet-geoman-free npm packages, you should be able to use the "as" keyword to tell TypeScript that an element is respectful of a certain interface / class.

            Source https://stackoverflow.com/questions/66817188

            QUESTION

            geoman - how to listen to a feature change in edit mode after the feature has been created in draw mode
            Asked 2021-Feb-15 at 07:12

            I am listening to adding a vertex during "draw mode" as documented in docs https://github.com/geoman-io/leaflet-geoman#draw-mode

            ...

            ANSWER

            Answered 2021-Feb-15 at 07:12

            Use the listener pm:create and add to the new created layer the pm:edit listener. Then the event pm:edit will be fired when a edit happens on the new layer.

            Source https://stackoverflow.com/questions/66145046

            QUESTION

            React useCallback function runs in infinite loop
            Asked 2021-Jan-26 at 10:24

            I am trying to use leaflet-geoman library in a React project. I need to create a custom toolbar button that enables and disables global drag mode.

            When toolbar button is clicked, map.pm.enableGlobalDragMode(); function enables global mode. When toolbar button is clicked again, map.pm.disableGlobalDragMode(); causes useCallback function afterClick running in infinite loop.

            codesandbox.io

            useDraw.js

            ...

            ANSWER

            Answered 2021-Jan-26 at 10:24

            The problem is, that when enableGlobalDragMode ( or disable) the Control of the original drag button is activated and this disables your custom button (because all other buttons are disabled, so that only one mode can be active).

            I suggest to use the code from the enableGlobalDragMode function instead of calling it, which cause a change on the controls:

            Source https://stackoverflow.com/questions/65899134

            QUESTION

            How to use geoman-io with ngx-leaflet
            Asked 2020-Nov-16 at 07:37

            I am trying to use geoman-io plugin (https://github.com/geoman-io/leaflet-geoman) in ngx-leaflet application. I've found this post: Integrate EasyButton, Geoman with ngx-leaflet , but the only solution provided in this post, that works for me, is to use bracket notation like that:

            map["pm"]["addControls"]({position: 'topleft'});

            I guess that's not the best way to do this. So my question is how to properly use geoman-io in ngx-leaflet?

            When i tried exactly these steps, it doesn't work, because at map.pm.addControls({...}) i get error

            Property 'pm' does not exist on type 'Map'

            Steps:

            1. npm i @geoman-io/leaflet-geoman-free
            2. Import geoman in the component import '@geoman-io/leaflet-geoman-free';
            3. In angular.json in "build" section import geoman styles:
            ...

            ANSWER

            Answered 2020-Nov-16 at 07:37

            For me it works with the dirty type any:

            Source https://stackoverflow.com/questions/64769162

            QUESTION

            keep focus on canvas Layer after map drag
            Asked 2020-Nov-12 at 18:31

            I have a L.canvasMarker from leaflet-canvas-markers

            When in editing mode with Leaflet-Geoman I can move the marker without any issue. But if I drag the map then try to drag the marker, it does not work (it has lost focus). To be able to drag it again I have to click it first, then I can drag it normally again.

            My attempt of fixing this was to get the DOM element of the marker then fire focus() event. But I dont know how to get access to a leaflet layer DOM element.

            my attempt of fixing below:

            ...

            ANSWER

            Answered 2020-Nov-12 at 18:31

            This is a issue of leaflet v1.6.0 and only is not working in chrome.

            When you update the leaflet to v1.7.1 it works.

            Replace your leaflet.js cdn url with this: https://unpkg.com/leaflet@1.7.1/dist/leaflet.js

            Source https://stackoverflow.com/questions/64808045

            QUESTION

            Setting event listener of a class property
            Asked 2020-Sep-03 at 00:22

            I'm using Leaflet and Leaflet-geoman in conjunction with wfs-t to create an editable map object. I have a class EditMap that has a leaflet map as a property. I'm trying to listen for the 'pm:create' event on this map for every class. Here is my code:

            ...

            ANSWER

            Answered 2020-Sep-03 at 00:22

            In the wrong place

            You're using a class so you could do:

            Source https://stackoverflow.com/questions/63715049

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install leaflet-geoman

            Download leaflet-geoman.css and leaflet-geoman.min.js and include them in your project.
            Just include leaflet-geoman.min.js right after Leaflet. It initializes itself. If you want certain layers to be ignored by Leaflet-Geoman, pass pmIgnore: true to their options when creating them. Example:.

            Support

            InstallationGetting StartedDraw ModeEdit ModeDrag ModeRemoval ModeCut ModeRotation ModeSplit Mode ⭐Scale Mode ⭐Options Snapping Pinning ⭐ Measurement ⭐LayerGroupCustomizationToolbarUtilsLazy loadingNeed a feature? | Existing Feature Requests
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link