ablakey / leaflet.simplegraticule Goto Github PK
View Code? Open in Web Editor NEWA graticule for Leaflet maps in the L.CRS.Simple coordinate system
License: BSD 2-Clause "Simplified" License
A graticule for Leaflet maps in the L.CRS.Simple coordinate system
License: BSD 2-Clause "Simplified" License
Hi,
I've used your great plugin for a game map.
I've specifically set my bounds to 0,0 1000,1000 however the grid is drawn outside this.
Printing this._bounds to console shows that the bounds for the grid aren't being drawn from the original map
First, congratulations for your first open source project. Your comment encouraged me to offer my feedback and help.
I use SimpleGraticule with these intervals:
zoomIntervals:[
{start:0,end:3,interval:20},
{start:4,end:5,interval:10},
{start:6,end:7,interval:5},
{start:8,end:10,interval:1},
{start:11,end:12,interval:0.5},
{start:13,end:18,interval:0.2},
]
When the interval goes below 1, the labels will, sometimes, appear like -4.00000000001 or -3.9999999998.
I've added this to the getMins funcion:
this.dec=0;
if (Math.floor(s)<s){
var sd=s;
while(Math.floor(sd)<sd){
this.dec++;
sd=s*Math.pow(10, this.dec);
}
}
And changed the way x and y values are calculated on the constructLines function to:
var x = Math.round((mins.x + i * this.options.interval) * Math.pow(10, this.dec)) / Math.pow(10, this.dec);
Maybe this is not the optimal way to do it, but it solved the problem. Hope this helps to improve your plugin.
Best,
Marcelo Gallacci
Filing for later.
The default lineStyle.clickable
should be changed from clickable
to interactive
.
At the moment there seems to be no reason why both can't exist be there.
npm login
...
npm publish
I experienced strange buggy behavior when calling removeLayer
on a SimpleGraticule layer, then inspected it and found something odd. I believe this.map
was typed instead of this._map
.
onRemove: function(map) {
map.off('viewreset '+ this.options.redraw, this.map);
this.eachLayer(this.removeLayer, this);
},
Notice that it's calling map.off
, with the input this.map
. I don't believe this.map
exists, just this._map
.
Would something like this make more sense?
onRemove: function(map) {
var graticule = this;
this._map.off('viewreset ' + this.options.redraw, graticule.redraw, graticule);
this.eachLayer(this.removeLayer, this);
},
Hello,
Thank you for this useful plugin. I downloaded it using npm, but I noticed that the version distributed on npm.js (https://www.npmjs.com/package/leaflet-simple-graticule) is different from the current one.
On the npm version zoomIntervals
options is not available, and probably other differences occur. Are you planing to update it, or should I make a fork?
Thank a lot!
Hi there, I'd like to use your SimpleGraticule plugin, but I can't unless you attach a license to your project by putting a LICENSE file in your root directory.
If you don't have a strong opinion about what license to choose, you might consider using the one that Leaflet itself uses, the BSD 2-Clause (similar to MIT in that it's very simple and permissive):
https://github.com/Leaflet/Leaflet/blob/master/LICENSE
You'd just need to change the Copyright statements in the beginning to the appropriate name(s) and years.
Thank you for your consideration!
While using on my recent project, I used the cdn
<script type="text/javascript" src="L.SimpleGraticule.js"></script>
given in the example.html file in this repository. But it is giving a 404 error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.