'EPSG:4326'-经纬度坐标-WGS84
'EPSG:3857'- xy坐标-web墨卡托
ol3默认的坐标系为3857,即在创建ol.map的时候,若不指定projection,则默认为EPSG:3857
转换方法如下:
var m_center=[116.35,39.9];//地图中心点-经纬度坐标 //经纬度转至xy m_center = ol.proj.transform(m_center,'EPSG:4326', 'EPSG:3857' ); //反过来 var m_center=[12914838.35,4814529.9];//地图中心点-xy坐标 //经纬度转至经纬度 m_center = ol.proj.transform(m_center, 'EPSG:3857' ,'EPSG:4326');