鍍金池/ 問答/Java  網(wǎng)絡(luò)安全  HTML/ 百度地圖API能夠根據(jù)經(jīng)緯度繪制地圖?

百度地圖API能夠根據(jù)經(jīng)緯度繪制地圖?

從后端API接口獲取到如下的JSON數(shù)據(jù)

clipboard.png

現(xiàn)在要根據(jù)JSON數(shù)據(jù)中的location中的經(jīng)緯度(","分隔,前經(jīng)度,后緯度):
要繪制成如下的圖表,請問有什么好的解決方案沒有?

clipboard.png

回答
編輯回答
祈歡

你把location拆一下不就好了么...

var lng = locationStr.split(',')[0];
var lat = locationStr.split(',')[1];
var point = new BMap.Point(lng, lat);
2017年8月4日 23:40
編輯回答
淺時光
var options = {
                size: BMAP_POINT_SIZE_BIG,
                shape: BMAP_POINT_SHAPE_CIRCLE,
                color: '#db2e3169'
            }
            //console.log(points);
            var pointCollection = new BMap.PointCollection(p, options);  // 初始化PointCollection
            pointCollection.addEventListener('mouseover', function (e) {
                console.log(e)
                console.log('單擊點的坐標(biāo)為:' + e.point.lng + ',' + e.point.lat);  // 監(jiān)聽點擊事件
            });
            map.addOverlay(pointCollection);  // 添加Overlay
2017年6月6日 06:28