javascript - How to draw circles around markers with the specified radius value using mapbox.js - Stack Overflow

Hi I want display quantity value around the marker with the help of circles.Basically if the circle is

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 badges
Add a ment  | 

2 Answers 2

Reset to default 3

I 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/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742270957a4412689.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信