leaflet 集成百度地图小例子二
上节实现了leaflet的小例子,节集成百度地图 1.由于所有地图的经纬度计算的规则不统一,所以需要引如两个js实现坐标转换 <script src="proj4-compressed.js"></script> <script src="proj4leaflet.js"></script> <script src="proj4.js"></script> 2.初始化地图 //初始化地图 $(document).ready(function () { var map = L.map('map', { crs: L.CRS.Baidu, minZoom: 3, maxZoom: 18, attributionControl: false, center: [31.834912, 117.220102], zoom: 12 }); 3.引入proj后对百度地图经纬度进行调整 L.CRS.Baidu = new L.Proj.CRS('EPSG:900913', '+proj=merc +a=6378206 +b=6356584.314245179 +lat_ts=0.0 +lon_0=0.0 +x_0=0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', { resolutions: function () {