echart展示县的geojson地图例子

echart展示县的geojson地图

html页面代码:

<body>
<div id="chart"></div>
<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/js/echarts/echarts.min.js?version=1.0.1"></script>
</body>

js代码:

$(function () {
   initChart();
});
      function initChart(){
	    $("#chart").css({"width":"1200px","height":"600px","margin":"auto"});
	    var myChart = echarts.init(document.getElementById("chart"));
	   // myChart.showLoading();
	    $.get('/static/js/geojson/map.geojson', function (dataJson) {
	       // myChart.hideLoading();

    
echarts.registerMap('region', dataJson);
 var   option = {
        series: [
            {
                name: '县级地图',
                type: 'map',
                roam: true,
                // zoom:0.5, //默认显示级别
                // scaleLimit:{min:0.1,max:3}, // 缩放级别
                map: 'region',
                itemStyle: {
                    normal: {
                        areaColor: '#45c8ff',
                        borderColor: '#fff'
                    },
                    emphasis: {
                        areaColor: '#00aeee'
                    }
                },
                // itemStyle:{
                //     emphasis:{label:{show:true}}
                // },
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: false
                    }
                } 
            }
        ]
    };
    myChart.setOption(option);
});

}

参考页面:
http://echarts.baidu.com/examples/editor.html?c=map-usa

下面的这个网站可以下载中国地图、省市县地图,在县地图的基础上画出具体的城镇图
http://datav.aliyun.com/tools/atlas/#&lat=33.578014746143985&lng=104.150390625&zoom=3

geojson格式地图生成推荐网站:
http://geojson.io/#map=2/20.0/0.0
此网站可以支持鼠标拖动画出geojson地图,县的城镇地图在网上没有找到资源,只能自己动手了。需要注意的是,echart只支持使用多边形画成的geojson地图。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值