admin管理员组文章数量:1336391
Hi I want display quantity value around the marker with the help of circles. Basically if the circle is bigger then it means available quantity at that location is maximum than the small circles. I am able to display markers on map. But I am trying display circles . radius value for circles is in value variable. I want convert this available quantity value based on earths radius and then display circles.
Here is the code snippets
// var map = L.mapbox.map('map', 'examples.map-i86nkdio')
var map=L.mapbox.map('map','hexample.j1m1kko7')
.setView([42.274260, -83.365717], 9);
for (i = 0; i < lats.length; i++)
{
var marker = L.marker([lats[i], longs[i]], {
icon: L.mapbox.marker.icon({
'marker-color': '#E80000'
})
})
.bindPopup('<button class="trigger">' + FacName[i] + '</button>')
.addTo(map);
L.circleMarker([lats[i], longs[i]], value[i])
.addTo(map);
}
Can I use polylines or polygoans to display circles as Circlemarker will create the markers.
Hi I want display quantity value around the marker with the help of circles. Basically if the circle is bigger then it means available quantity at that location is maximum than the small circles. I am able to display markers on map. But I am trying display circles . radius value for circles is in value variable. I want convert this available quantity value based on earths radius and then display circles.
Here is the code snippets
// var map = L.mapbox.map('map', 'examples.map-i86nkdio')
var map=L.mapbox.map('map','hexample.j1m1kko7')
.setView([42.274260, -83.365717], 9);
for (i = 0; i < lats.length; i++)
{
var marker = L.marker([lats[i], longs[i]], {
icon: L.mapbox.marker.icon({
'marker-color': '#E80000'
})
})
.bindPopup('<button class="trigger">' + FacName[i] + '</button>')
.addTo(map);
L.circleMarker([lats[i], longs[i]], value[i])
.addTo(map);
}
Can I use polylines or polygoans to display circles as Circlemarker will create the markers.
Share Improve this question edited Jul 25, 2014 at 12:49 user2897967 asked Jul 24, 2014 at 20:17 user2897967user2897967 3372 gold badges8 silver badges24 bronze badges2 Answers
Reset to default 3I faced the same problem the other day and ended up using L.circle 's like this
marker = L.circle(latlng, radius).addTo(map);
And also place a regular marker on the same latlng position. Give it a try!
Unfortunately MapBox seems to have updated this, well at-least it didn't work for me - so maybe someone else might find this helpful.
I had to use L.circleMarker
to get it to function.
Example:
var circle = L.circleMarker([55.37911044801047, -2.8125], {radius: 100}).addTo(map);
More documentation here: https://www.mapbox./mapbox.js/api/v2.1.9/l-circlemarker/
版权声明:本文标题:javascript - How to draw circles around markers with the specified radius value using mapbox.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742270957a2444295.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论