javascript - Leaflet circle radius doesn't matter -


i'm working on extension game map displays active map server. map working , isn't me. important they're using simple crs work around game coordinates.

now want create circle radius. radius should bind map unit (latlng) , not pixels, if zoom in circle should have bigger radius on screen, relative world map same radius.

so i've code extension map:

var bla = l.circle([0,0], 1000, {'color': '#ffffff'}).addto(map); 

as can see, test only. there should circle radius 1000 (i think it's in map "units" because value in docs named "meters"). can see circle isn't more dot.

if set radius size, there no effect:

var bla = l.circle([0,0], 100000, {'color': '#ffffff'}).addto(map); 

and radius of 1000000000000000 doesn't matter radius calculation. negative radius doesn't work, too.

have ideas?

this happens when use 0.7 leaflet l.crs.simple projection.

they've fixed in 1.0 beta added bunch of new bugs (for example - lots of leaflet.draw plugin features refuse work new version)

i've managed find 2 workarounds this:

option 1: upgrading 1.0 beta or higher

option 2: since they've got earth projection hardcoded l.circle, can hack leaflet-src.js this:

change from

_getlatradius: function () {     return (this._mradius / 40075017) * 360; },  _getlngradius: function () {     return this._getlatradius() / math.cos(l.latlng.deg_to_rad * this._latlng.lat); }, 

to

_getlatradius: function () {     return this._mradius; },  _getlngradius: function () {     return this._mradius; }, 

hope helps someone


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -