JupyterLab的GeoJSON渲染器
项目描述
jupyterlab-geojson
JupyterLab的GeoJSON渲染扩展
需求
- JupyterLab >= 3.0
安装
pip install jupyterlab-geojson
用法
在IPython中渲染GeoJSON输出
from IPython.display import GeoJSON
GeoJSON({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-118.4563712, 34.0163116]
}
})
使用特定的瓦片集
GeoJSON(
data={
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-118.4563712, 34.0163116]
}
}, url_template="https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=[MAPBOX_ACCESS_TOKEN]",
layer_options={
"id": "mapbox.streets",
"attribution" : '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}
)
在火星上渲染GeoJSON
GeoJSON(
data={
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [11.8, -45.04]
}
}, url_template="http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png",
layer_options={
"basemap_id": "celestia_mars-shaded-16k_global",
"attribution" : "Celestia/praesepe",
"tms": True,
"minZoom" : 0,
"maxZoom" : 5
}
)
要渲染.geojson
或.geo.json
文件,只需打开它。
贡献
开发安装
注意:您需要NodeJS来构建扩展包。
该jlpm
命令是JupyterLab中预装版本的yarn。您可以使用yarn
或npm
代替下面的jlpm
。
# Clone the repo to your local environment
# Change directory to the jupyterlab-geojson directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm run build
您可以在不同的终端中同时监视源目录并运行JupyterLab,以监视扩展源的变化并自动重新构建扩展。
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab
在运行监视命令的情况下,每次保存的更改都将立即在本地构建并可供运行的JupyterLab使用。刷新JupyterLab以在浏览器中加载更改(您可能需要等待几秒钟以等待扩展重新构建)。
默认情况下,jlpm run build
命令生成此扩展的源映射,以便更容易使用浏览器开发者工具进行调试。要为JupyterLab核心扩展也生成源映射,可以运行以下命令
jupyter lab build --minimize=False
卸载
pip uninstall jupyterlab-geojson
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
jupyterlab_geojson-3.4.0.tar.gz (570.3 kB 查看哈希值)
构建分布
关闭
jupyterlab_geojson-3.4.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | cc7f6015f75f7816240402880134cd7174af64fbef010b1556071729f98a291f |
|
MD5 | 1a043fadf786fc38683e6c81f7a85414 |
|
BLAKE2b-256 | 4775c4ba4e915c077ec1de6dd3037f06bb4f1ed1c00e9d453fb3307eee9eac50 |
关闭
jupyterlab_geojson-3.4.0-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 56d9bed9253d0a3b4c6e5ae8ac0685039bfb43775cd356e4979bdf147e89dfc5 |
|
MD5 | 03c05273185b9c41902dff23c6548dd4 |
|
BLAKE2b-256 | 7c6d113e7d1fd8deedda14fc1a3ad3ad8e98a73dc72b7e6d2cafe032c1c16521 |