繁体   English   中英

如何使用vega-lite放大地图?

[英]how can I zoom into a map using vega-lite?

我正在使用vega-lite将一些数据渲染到地图上。 当前,我有此架构,该架构呈现了附加的图像:

{
  "title": "What's the nearest city to you?",
  "data": {
    "values": "...",
    "format": {
      "type": "csv"
    }
  },
  "encoding": {},
  "projection": {
    "type": "mercator"
  },
  "layer": [
    {
      "data": {
        "values": "...",
        "format": {
          "type": "topojson",
          "feature": "world-borders"
        }
      },
      "mark": {
        "type": "geoshape",
        "fill": "lightgrey",
        "stroke": "darkgrey"
      },
      "width": 800,
      "height": 600
    },
    {
      "mark": {
        "type": "circle",
        "size": 50
      },
      "encoding": {
        "latitude": {
          "field": "latitude",
          "type": "quantitative"
        },
        "longitude": {
          "field": "longitude",
          "type": "quantitative"
        },
        "color": {
          "field": "count",
          "type": "quantitative",
          "scale": {
            "range": [ "#f0f921", "#fcce25", "#fca636", "#f2844b", "#e16462", "#cc4778", "#b12a90", "#8f0da4", "#6a00a8", "#41049d", "#0d0887" ]
          }
        },
        "size": {
          "field": "count",
          "type": "quantitative"
        }
      }
    }
  ]
}

此架构的渲染视图

现在,整体看起来不错! 我很高兴! 但我真的很希望能够提供放大到最密集数据区域(尤其是欧洲和美国大陆)的渲染图像。 我已经尝试了vega和vega-lite文档中指定的所有我想不到的东西(我尝试的所有属性都很奇怪,例如将所有圆圈渲染为单个像素或仅剪切地图)。

我真正想要的只是一种方式:“向我展示纬度和纬度之间的数据+地图视图”,但是为达到这个目的而设计时,并没有让我惊讶。 我怎样才能做到这一点?

在当前的Vega-Lite版本中,平移和缩放不适用于地理投影。 有关更多详细信息,请参见https://github.com/vega/vega-lite/issues/3306

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM