GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - w8r/L.Control.LineStringSelect: Polyline selection control for Leaflet

BranchesTags
Open more actions menu

Latest commit

 

History

57 Commits
57 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
dist
dist
 
 
examples
examples
 
 
src
src
 
 
test
test
 
 
.editorconfig
.editorconfig
 
 
.eslintrc
.eslintrc
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
bower.json
bower.json
 
 
index.html
index.html
 
 
index.js
index.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

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.

About

Polyline selection control for Leaflet

w8r.github.io/L.Control.LineStringSelect

Topics

leafletleaflet-pluginlinestringselection

Resources

Readme
MIT license
Activity

Stars

47 stars

Watchers

3 watching

Forks

9 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.