简体   繁体   English

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

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

I'm rendering some data onto a map using vega-lite. 我正在使用vega-lite将一些数据渲染到地图上。 Currently, I have this schema, which renders the attached image: 当前,我有此架构,该架构呈现了附加的图像:

{
  "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"
        }
      }
    }
  ]
}

此架构的渲染视图

Now this looks pretty nice overall! 现在,整体看起来不错! I'm happy with it! 我很高兴! But I would really like to be able to provide a rendered image zoomed into the densest areas of data, specifically Europe and the continental US. 但我真的很希望能够提供放大到最密集数据区域(尤其是欧洲和美国大陆)的渲染图像。 I've tried everything I can think of as specified in the vega and vega-lite documentation to no avail (all the properties I try have been weird—like rendering all the circles at a single pixel or just clipping the map.) 我已经尝试了vega和vega-lite文档中指定的所有我想不到的东西(我尝试的所有属性都很奇怪,例如将所有圆圈渲染为单个像素或仅剪切地图)。

What I'd really like is just a way to say "show me a view of data+map between lat°long° and lat°long°", but nothing jumps out at me as being designed for that purpose. 我真正想要的只是一种方式:“向我展示纬度和纬度之间的数据+地图视图”,但是为达到这个目的而设计时,并没有让我惊讶。 How can I do this? 我怎样才能做到这一点?

In the current Vega-Lite release, panning and zooming are not available for geographic projections. 在当前的Vega-Lite版本中,平移和缩放不适用于地理投影。 See https://github.com/vega/vega-lite/issues/3306 for more details. 有关更多详细信息,请参见https://github.com/vega/vega-lite/issues/3306

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

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