question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TerrainLayer binding in pydeck

See original GitHub issue

Target Use case

I want to be able to use the TerrainLayer in pydeck. It is not listed under the pydeck examples, so I guess it is not implemented yet?

Proposed feature

Sample code snippet of how it probably would be implemented:

import pydeck as pdk

ELEVATION_LAYER_DATA = 'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/website/terrain.png'
TEXTURE = 'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/website/terrain-mask.png'

layer = pdk.Layer(
        "TerrainLayer",
        data=ELEVATION_LAYER_DATA,
        elevationDecoder={
                'rScaler': 2,
                'gScaler': 0,
                'bScaler': 0,
                'offset': 0
                },
        texture=TEXTURE,
        bounds=[-122.5233, 37.6493, -122.3566, 37.8159]
        )

view_state = pdk.ViewState(latitude=37.7749295, longitude=-122.4194155, zoom=11, bearing=0, pitch=45)

# Render
r = pdk.Deck(layers=[layer], initial_view_state=view_state)
r.to_html("terrain_layer.html", notebook_display=False)

This sample was created following the style of the other pydeck examples and the deck.gl TerrainLayer example.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
kylebarroncommented, Apr 25, 2020

I made an example yesterday, but haven’t put it on the website yet:

image

You’ll need to add your own surface image satellite tile endpoint:

import pydeck as pdk
view_state = pdk.ViewState(latitude=46.24, longitude=-122.18, zoom=11.5, bearing=140, pitch=60)
TERRAIN_IMAGE = '"https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"'
SURFACE_IMAGE = '"..."'
ELEVATION_DECODER = {
  'rScaler': 256,
  'gScaler': 1,
  'bScaler': 1 / 256,
  'offset': -32768
};
layer = pdk.Layer('TerrainLayer', None, min_zoom=0, max_zoom=23, strategy='no-overlap', elevation_decoder=ELEVATION_DECODER, texture=SURFACE_IMAGE, elevation_data=TERRAIN_IMAGE)
r = pdk.Deck(
    layers=[layer],
    initial_view_state=view_state,
)
r.show()
1reaction
kylebarroncommented, Oct 25, 2020

Basically quantized mesh allows you to offload mesh creation to the backend instead of the frontend. Right now only Martini is used in the frontend because Delatin is significantly slower

Read more comments on GitHub >

github_iconTop Results From Across the Web

TerrainLayer — pydeck 0.8.0b4 documentation - Read the Docs
Built with Sphinx using a theme provided by Read the Docs. Read the Docs v: latest. Versions: latest.
Read more >
Visualizing geospatial data with pydeck and Earth Engine
Deck.gl provides Python bindings through pydeck. The new pydeck_earthengine_layers add-on module is available on both pip and conda.
Read more >
Visualizing planetary scale data with pydeck and Google ...
The fact that both the Earth Engine and the deck.gl APIs now have JavaScript and Python bindings allowed us to support both communities...
Read more >
docs/whats-new.md · Gitee 极速下载/deck-gl
Tiled Layers; GlobeView; Antimeridian Handling; Pydeck; Miscellaneous. deck.gl v8.1. Growing Tile Solutions. TileLayer; MVTTileLayer; TerrainLayer.
Read more >
数据源earth文件_使用pydeck和Earth引擎可视化地理空间数据
... view. deck.gl TerrainLayer 将Earth Engine栅格图块解释为高程数据, 并以透视图显示。 ... Deck.gl provides Python bindings through pydeck.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found