簡體   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