You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2019/07/20 04:02:35 UTC

[GitHub] [incubator-echarts] luowengang commented on issue #3899: 世界地图的视图中心点可以定制吗

luowengang commented on issue #3899: 世界地图的视图中心点可以定制吗
URL: https://github.com/apache/incubator-echarts/issues/3899#issuecomment-513433554
 
 
   
   非常感谢,提供该功能方法,请问,这个从echarts哪个版本开始,可以支持?
   
   
   
   
   
   在 2019-06-10 23:04:04,"xiaopang" <no...@github.com> 写道:
   
   
   将以非洲为中心的geojson改成以亚洲为中心的geojson,方法如下:
   
   // 对纬度进行偏移
   
   const processLng = lng => {
   
       return lng > -30 ? lng - 150 : lng + 210
   
   }
   
   
   
   //引入世界地图
   
   import worldMap from '../data/world.json'
   
   
   
   const coordinatesList = []
   
   
   
   // 对世界地图的json文件中的经纬度坐标进行处理
   
   worldMap.features.map(district => {
   
       if (district.geometry.type == 'Polygon') {
   
         district.geometry.coordinates.map(border => {
   
           border.map(coord => {
   
             coord[0] = processLng(coord[0])
   
             coordinatesList.push(coord)
   
           })
   
         })
   
     } else {
   
         district.geometry.coordinates.map(border => {
   
           border.map(coordinates => {
   
             coordinates.map(coord => {
   
               coord[0] = processLng(coord[0])
   
               coordinatesList.push(coord)
   
             })
   
           })
   
         })
   
       }
   
     })
   
   
   
   这样世界地图的效果变成了期望的效果:
   
   
   —
   You are receiving this because you commented.
   Reply to this email directly, view it on GitHub, or mute the thread.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org