{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "[![image](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/giswqs/mapwidget/blob/master/docs/examples/cesium.ipynb)\n", "[![image](https://img.shields.io/badge/Open-Planetary%20Computer-black?style=flat&logo=microsoft)](https://pccompute.westeurope.cloudapp.azure.com/compute/hub/user-redirect/git-pull?repo=https://github.com/giswqs/mapwidget&urlpath=lab/tree/mapwidget/docs/examples/cesium.ipynb&branch=master)\n", "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/giswqs/mapwidget/blob/master/docs/examples/cesium.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# %pip install mapwidget" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import mapwidget.cesium as mapwidget" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You need a Cesium access token to use the Cesium widget. First, [sign up](https://ion.cesium.com/signup/) for a free Cesium account. Then, you can create a token by following the instructions [here](https://cesium.com/learn/ion/cesium-ion-access-tokens/). Set `CESIUM_TOKEN` as an environment variable to use the Cesium widget. Alternatively, uncomment the following code block and replace `YOUR-CESIUM-TOKEN` with your Cesium access token." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "if os.environ.get('CESIUM_TOKEN') is None:\n", " token = 'YOUR-CESIUM-TOKEN'\n", "else:\n", " token = os.environ.get('CESIUM_TOKEN')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "San Francisco" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = mapwidget.Map(center=[37.655, -122.4175], altitude=400, height='600px', token=token)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://i.imgur.com/gK2wA4p.gif)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "New York City" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = mapwidget.Map(center=[40.70605, -74.01177], altitude=600, height='600px', token=token)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://i.imgur.com/6quoDtN.gif)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m.center" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m.zoom" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" } }, "nbformat": 4, "nbformat_minor": 4 }