All Projects → w8r → L.Control.LineStringSelect

w8r / L.Control.LineStringSelect

Licence: MIT license
Polyline selection control for Leaflet

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to L.Control.LineStringSelect

harp-leaflet
Leaflet plugin for harp.gl
Stars: ✭ 16 (-62.79%)
Mutual labels:  leaflet, leaflet-plugin
Path.Drag.js
Add dragging capability to Leaflet paths.
Stars: ✭ 21 (-51.16%)
Mutual labels:  leaflet, leaflet-plugin
databases-w-r
Databases with R, the latest - rstudio::conf2019
Stars: ✭ 33 (-23.26%)
Mutual labels:  leaflet
leaflet-paintpolygon
Leaflet plugin to create polygon with circle as paint
Stars: ✭ 38 (-11.63%)
Mutual labels:  leaflet
selecton-extension
Selecton provides popup with actions on text selection in all major browsers
Stars: ✭ 36 (-16.28%)
Mutual labels:  selection
enmodal
transit planning & analysis in your browser
Stars: ✭ 38 (-11.63%)
Mutual labels:  leaflet
coronavirus-map-dashboard
🦠 Coronavirus (COVID-19) Map Dashboard using coronavirus-tracker-api
Stars: ✭ 41 (-4.65%)
Mutual labels:  leaflet
leaflet-opencage-search
A Leaflet geocoding control that uses the OpenCage geocoding API
Stars: ✭ 18 (-58.14%)
Mutual labels:  leaflet
leaflet-tag-filter-button
Adds tag filter control for layers (marker, geojson features etc.) to LeafLet.
Stars: ✭ 48 (+11.63%)
Mutual labels:  leaflet
leaflet-webpack
Minimal boilerplate to use Leaflet with webpack
Stars: ✭ 24 (-44.19%)
Mutual labels:  leaflet
ci-ifd-lead
Code Institute | Interactive Frontend Development | 6-week _lead project
Stars: ✭ 16 (-62.79%)
Mutual labels:  leaflet
leaflet-labeled-circle
Special type of SVG marker with a label inside and draggable around the anchor point
Stars: ✭ 35 (-18.6%)
Mutual labels:  leaflet
eSelection
Dynamic model selection library for SA-MP servers
Stars: ✭ 28 (-34.88%)
Mutual labels:  selection
geofind
Multiplayer Geographical Guessing Game using PostGIS, Nuxt, Leaflet & Colyseus.
Stars: ✭ 31 (-27.91%)
Mutual labels:  leaflet
antaresViz
ANTARES Visualizations
Stars: ✭ 19 (-55.81%)
Mutual labels:  leaflet
vue2-leaflet-vectorgrid
A Leaflet.VectorGrid plugin for the vue2-leaflet package.
Stars: ✭ 17 (-60.47%)
Mutual labels:  leaflet
react-native-leaflet
A LeafletView component using WebView and Leaflet map for React Native applications
Stars: ✭ 53 (+23.26%)
Mutual labels:  leaflet
leaflet-area-select
Control to just select an area and provide bbox for it
Stars: ✭ 27 (-37.21%)
Mutual labels:  leaflet
frakegps
Simulate a simple GPS device with gpsd or geoclue2
Stars: ✭ 22 (-48.84%)
Mutual labels:  leaflet
Genetics
Genetics (Initialization, Selection, Crossover, Mutation)
Stars: ✭ 15 (-65.12%)
Mutual labels:  selection

L.Control.LineStringSelect npm version CircleCI

Screenshot

LineString selection tool: you can select a part or a stretch of a polyline on the map. Performance-oriented, uses rbush for segment lookup

Demo

Look how this thing deals with a coastline polyline consisting of ~500 points

demo

Options

Option type default value
startMarkerClass string 'select-marker select-start-marker'
endMarkerClass string 'select-marker select-end-marker'
movingMarkerClass string 'select-marker select-moving-marker'
name string 'leaflet-linestring-select'
lineWeight number 4
lineTolerance number L.Browser.mobile ? 10 : 5
movingMarkerStyle L.CircleMarcerOptions {
  fillColor: '#fff',
  fillOpacity: 1,
  weight: 2,
  opacity: 0.5,
  color: '#000'
}
endpointStyle L.CircleMarcerOptions {
  radius: 5,
  color: '#111',
  fillColor: '#fff',
  fillOpacity: 1
}
selectionStyle L.PolylineOptions {
  color: '#0ff',
  opacity: 1
}
useTouch boolean L.Browser.mobile
position `'topright' 'topleft'

API

.enable({layer: polyline, feature: feature}) Enables control, initializes it with provided polyline. You can pass GeoJSON object as well, otherwise it will be auto-generated

.disable() Disable control, remove handlers and selection

.reset() Reset selection

.selectMeters(startMeter, endMeter) Select stretch by meter distances from linestring start.

.toGeoJSON() Returns selection GeoJSON

.getSelection() Returns array of selection L.LatLngs

Events

selection Selection changed or finished.

reset Selection cleared

select:start : {pos: <L.LatLng>} First point set

select:end : {pos: <L.LatLng>} Second point set

Usage

npm install --save leaflet-linestring-select
...
var Select = require('leaflet-linestring-select');

or

<script type="text/javascript" src="leaflet.js"></script>
<script type="text/javascript" src="path/to/L.Control.LineStringSelect.min.js"></script>

See /examples/app.js for initialization and other things

Requirements

  • leaflet@>=1.x
  • rbush@>=3.x

License

The MIT License (MIT)

Copyright (c) 2019 Alexander Milevski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].