Giter Site home page Giter Site logo

esri / leaflet.shapemarkers Goto Github PK

View Code? Open in Web Editor NEW
8.0 11.0 8.0 798 KB

Fixed size, shape marker symbols for points in Leaflet

License: Apache License 2.0

JavaScript 85.32% HTML 11.05% Shell 3.63%
leaflet leaflet-plugins javascript esri arcgis web-mapping

leaflet.shapemarkers's Introduction

Leaflet.shapeMarkers

Leaflet plugin to draw simple shape markers with fixed width.

travis

Example

Take a look at the live demo.

Example Image

L.shapeMarkers.xMarker([45.5052, -122.6917], 50).addTo(map)

**Leaflet.shapeMarkers targets v1.x

Dependencies

  • Leaflet version 1.0.0 or higher is required.

Development Instructions

  1. Fork and clone Leaflet.shapeMarkers
  2. cd into the Leaflet.shapeMarkers folder
  3. Install the dependencies with npm install
  4. run npm run build from the command line. This will create minified source. afterward, you can run npm test to make sure everything is up to snuff.
  5. Make your changes and create a pull request

Versioning

For transparency into the release cycle and in striving to maintain backward compatibility, Esri Leaflet is maintained under the Semantic Versioning guidelines and will adhere to these rules whenever possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major while resetting minor and patch
  • New additions without breaking backward compatibility bumps the minor while resetting the patch
  • Bug fixes and misc changes bumps only the patch

For more information on SemVer, please visit http://semver.org/.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

Copyright 2017 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.

leaflet.shapemarkers's People

Contributors

dpraimeyuu avatar gavinr-maps avatar jgravois avatar kneemer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leaflet.shapemarkers's Issues

Merge duplicate plugins

Gday @jgravois

So it turns out we've made almost identical leaflet addins, whoops, not enough googling on my part (although perhaps you should add your addin to the leaflet addin page)!
https://github.com/rowanwins/Leaflet.SvgShapeMarkers

I'm all for merging (slash decommissioning mine) the addins given that I think we're largely trying to solve the same problem in pretty much the same way.

One significant difference worth discussing/thinking about is that rather than creating a new class for every marker type, I instead had an option specifying the type (eg shape: "square"). The reason I went this approach was when I was thinking about how I'd use it I was thinking of a large point dataset loaded as geojson and doing pointToLayer, it seemed a bit more logical to have everything as one

    pointToLayer: function (feature, latlng) {
      return L.shapeMarker(latlng, {
        shape: getShape(feature.properties.myCategory),
        color: 'white'
      })

with your're current approach it would be something more like

    pointToLayer: function (feature, latlng) {
      if (feature.properties.myCategory == "whatever"){
           return L.shapeMarkers.xMarker(latlng, {
               shape: getShape(feature.properties.myCategory),
               color: 'white'
            })
      }
      if (feature.properties.myCategory == "somethingElse"){
            return L.shapeMarkers.squareMarker(latlng, {
                 shape: getShape(feature.properties.myCategory),
                 color: 'white'
            })
     }
}

Obviously you could restructure my example above of your's abit so it's all a bit tidier etc so I guess I'm neither here nor there.

Generally speaking I think your plugin looks a bit more robust, I hadn't thought about canvas at all, it was just the result of a couple of hours of effort yesterday.

Anyway just thought I'd raise the flag
Cheers
Rowan

L.geoJson is eating shapeMarker features

Gday @jgravois

I did just find one minor which effects both of our plugins. If I do something like this in leaflet 1.0

var myLayer = L.geoJson(data, {
    pointToLayer: function (feature, latlng) {
    return L.shapeMarkers.xMarker(latlng, 50)
      })

myLayer.toGeoJSON()

my toGeoJSON comes back as empty.... I think it relates to roughly these lines in the L.GeoJSON , it's a bit of an edge case but it's effected my app, if I work out a good way to fix it I'll let you know!

Getting "layer._containsPoint is not a function" if preferCanvas is set to true.

While using this package with preferCanvas={true}, I am getting error as "layer._containsPoint is not a function" .
TypeError: layer._containsPoint is not a function
NewClass._handleMouseHover
/src/layer/vector/Canvas.js:391
388 |
389 | for (var order = this._drawFirst; order; order = order.next) {
390 | layer = order.layer;

391 | if (layer.options.interactive && layer._containsPoint(point)) {
| ^ 392 | candidateHoveredLayer = layer;
393 | }
394 | }

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.