我正在学习由牛郎星绘制地图,下面是图片库-世界投影的例子。
如何将地球地图的中心设置在我想要的拉特龙点?
下面是我失败的代码,试图在Latitude= 40和Longitude=140周围对地图进行居中:
import altair as alt
from vega_datasets import data
countries = alt.topo_feature(data.world_110m.url, 'countries')
alt.Chart(countries).mark_geoshape(
fill='#666666',
stroke='white'
).project(
type= 'orthographic'
).properties(
title='Orthographic'
).configure_projection(
center= [140,40]
)正如你所看到的,地图仍然以大西洋为中心,可能在很长的地方,Lat = 0,0。

发布于 2020-04-04 12:29:26
对于正交投影,决定投影如何居中的是rotate属性,而不是center属性。rotate属性由围绕三个主轴的旋转度组成。例如,要构造围绕long=140,lat=40的投影,可以这样做:
import altair as alt
from vega_datasets import data
countries = alt.topo_feature(data.world_110m.url, 'countries')
alt.Chart(countries).mark_geoshape(
fill='#666666',
stroke='white'
).project(
type= 'orthographic',
rotate=[-140, -40 ,0]
).properties(
title='Orthographic'
)

您可以在这个站点上动态地探索一些可用的投影及其配置:https://vega.github.io/vega/docs/projections/。
https://stackoverflow.com/questions/61025130
复制相似问题