We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在开发中客户提出让中国居中,目前我的解决思路是使用如下算法:
import worldJson from './world.zh.json' // 对世界地图的json文件中的经纬度坐标进行处理 const process = item => { if (item > -30) { item = item - 180 } else { item = item + 180 } return item } // 格陵兰处理 const processGreenland = item => { return item + 180 } worldJson.features.map((district, index) => { if (district.properties.name === '格陵兰') { if (district.geometry.type === 'Polygon') { district.geometry.coordinates.map(border => { border.map(coord => { coord[0] = processGreenland(coord[0]) }) }) } else { district.geometry.coordinates.map(border => { border.map(coordinates => { coordinates.map(coord => { coord[0] = processGreenland(coord[0]) }) }) }) } } else { if (district.geometry.type == 'Polygon') { district.geometry.coordinates.map(border => { border.map(coord => { coord[0] = process(coord[0]) }) }) } else { district.geometry.coordinates.map(border => { border.map(coordinates => { coordinates.map(coord => { coord[0] = process(coord[0]) }) }) }) } } }) export default worldJson
现在有一个问题:南极洲部分我还没有想到合适的处理方式 因为客户没有要求显示南极洲,目前效果是这样的:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在开发中客户提出让中国居中,目前我的解决思路是使用如下算法:
现在有一个问题:南极洲部分我还没有想到合适的处理方式
因为客户没有要求显示南极洲,目前效果是这样的:
The text was updated successfully, but these errors were encountered: