├── .github └── workflows │ ├── binder.yml │ ├── main.yml │ └── release.yml ├── .gitignore ├── .isort.cfg ├── .ort.yml ├── .readthedocs.yml ├── CHANGELOG.rst ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.md ├── RELEASE.md ├── binder ├── environment.yml └── postBuild ├── docs ├── Makefile ├── requirements.txt └── source │ ├── _static │ └── main_stylesheet.css │ ├── api_reference │ ├── basemap │ │ ├── basemap.rst │ │ ├── external_basemap.rst │ │ ├── japan.rst │ │ ├── map_tile.rst │ │ ├── raster.rst │ │ └── vector.rst │ ├── config │ │ ├── config.rst │ │ ├── default_layers_config.rst │ │ ├── misc_values.rst │ │ ├── service_names.rst │ │ └── service_urls.rst │ ├── control │ │ ├── control.rst │ │ ├── fullscreen.rst │ │ ├── layerscontrol.rst │ │ ├── mapsettings.rst │ │ ├── measurement.rst │ │ ├── scalebar.rst │ │ ├── searchcontrol.rst │ │ ├── splitmap.rst │ │ ├── widgetcontrol.rst │ │ ├── zoom.rst │ │ └── zoomrectangle.rst │ ├── element │ │ ├── element.rst │ │ ├── infobubble.rst │ │ └── style.rst │ ├── geometry │ │ ├── bbox.rst │ │ ├── geometry.rst │ │ ├── geomultipolygon.rst │ │ ├── geopolygon.rst │ │ ├── linestring.rst │ │ ├── multilinestring.rst │ │ ├── point.rst │ │ └── wkt.rst │ ├── layer │ │ ├── choropleth.rst │ │ ├── geo_json.rst │ │ ├── heatmap.rst │ │ ├── kml.rst │ │ ├── layer.rst │ │ ├── markercluster.rst │ │ ├── tile_layer.rst │ │ └── xyz.rst │ ├── map.rst │ └── object │ │ ├── circle.rst │ │ ├── domicon.rst │ │ ├── dommarker.rst │ │ ├── group.rst │ │ ├── icon.rst │ │ ├── marker.rst │ │ ├── object.rst │ │ ├── overlay.rst │ │ ├── polygon.rst │ │ ├── polyline.rst │ │ └── rectangle.rst │ ├── changelog.rst │ ├── conf.py │ ├── contribution.rst │ ├── gettingstarted.rst │ ├── index.rst │ ├── installation.rst │ ├── prerequisites.rst │ └── referenceguide.rst ├── examples ├── README.md ├── add_ipywidgets.ipynb ├── basemaps.ipynb ├── choropleth_layer.ipynb ├── circle.ipynb ├── countries.json ├── countries.json.license ├── custom_icons.ipynb ├── custom_marker_icon.ipynb ├── datahub_space.ipynb ├── datahub_space_style.ipynb ├── distance_measurement_control.ipynb ├── dom_marker.ipynb ├── extrusion.ipynb ├── forest_fire_analysis.ipynb ├── forest_fire_analysis.py ├── geodata.ipynb ├── geojson_point_style.ipynb ├── group_objects.ipynb ├── image_overlay.ipynb ├── image_tile_layer.ipynb ├── india_district.json ├── india_district.json.license ├── infobubble.ipynb ├── interactive_map_layer.ipynb ├── japan_data.ipynb ├── kml.ipynb ├── layers_control.ipynb ├── map_basics_demo.ipynb ├── map_settings_control.ipynb ├── marker_cluster.ipynb ├── marker_image.png ├── marker_trace_on_linestring.ipynb ├── movable_shapes_objects.ipynb ├── polygon.ipynb ├── rectangle.ipynb ├── search_control.ipynb ├── splitmap_control.ipynb ├── us-states.json ├── us-states.json.license ├── us_unemployment_oct2012.csv ├── us_unemployment_oct2012.csv.license └── xyz_style.yaml ├── here_map_widget ├── LICENSE ├── __init__.py ├── _version.py ├── configs.py └── map.py ├── images ├── basemaps.gif ├── external_basemaps.gif ├── geo-pandas.gif ├── geojson.gif ├── marker.gif ├── search-control.gif ├── widget-control.gif └── xyz.gif ├── jlab └── webpack.config.js ├── js ├── .babelrc ├── .yarnrc.yml ├── LICENSE ├── README.md ├── lib │ ├── Map.js │ ├── control │ │ ├── Control.js │ │ ├── DistanceMeasurementControl.js │ │ ├── FullscreenControl.js │ │ ├── LayersControl.js │ │ ├── MapSettingsControl.js │ │ ├── ScaleBar.js │ │ ├── SearchControl.js │ │ ├── SplitMapControl.js │ │ ├── WidgetControl.js │ │ ├── ZoomControl.js │ │ └── ZoomRectangle.js │ ├── element │ │ ├── .Element.js.swp │ │ ├── Element.js │ │ ├── InfoBubble.js │ │ └── Style.js │ ├── embed.js │ ├── extension.js │ ├── geometrys │ │ ├── Geometry.js │ │ ├── LineString.js │ │ ├── MultiLineString.js │ │ ├── MultiPolygon.js │ │ ├── Point.js │ │ ├── Polygon.js │ │ ├── Rect.js │ │ └── WKT.js │ ├── index.js │ ├── jupyter-map.js │ ├── labplugin.js │ ├── layers │ │ ├── GeoJSON.js │ │ ├── Kml.js │ │ ├── Layer.js │ │ ├── ObjectLayer.js │ │ └── TileLayer.js │ ├── notebook.js │ ├── objects │ │ ├── Circle.js │ │ ├── DomIcon.js │ │ ├── DomMarker.js │ │ ├── Group.js │ │ ├── Icon.js │ │ ├── Marker.js │ │ ├── Object.js │ │ ├── Overlay.js │ │ ├── Polygon.js │ │ ├── Polyline.js │ │ └── Rectangle.js │ ├── provider │ │ ├── HeatMap.js │ │ ├── IML.js │ │ ├── ImageTile.js │ │ ├── MapTile.js │ │ ├── MarkerCluster.js │ │ ├── OMV.js │ │ ├── Provider.js │ │ └── XYZ.js │ ├── service │ │ ├── DefaultLayers.js │ │ ├── Platform.js │ │ └── Service.js │ └── static │ │ ├── fullscreen.css │ │ ├── fullscreen.png │ │ ├── fullscreen@2x.png │ │ ├── layout.css │ │ ├── loader.gif │ │ ├── map-view.css │ │ ├── range-icon.png │ │ ├── range.css │ │ ├── search-icon.png │ │ └── searchcontrol.css ├── package.json ├── webpack.config.js └── yarn.lock ├── map-widget-for-jupyter.json ├── pyproject.toml ├── requirements.txt ├── requirements_dev.txt ├── setup.cfg └── setup.py /.github/workflows/binder.yml: -------------------------------------------------------------------------------- 1 | name: Binder build 2 | on: 3 | push: 4 | branches: 5 | - master 6 | 7 | jobs: 8 | trigger-binder-build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: s-weigand/trigger-mybinder-build@v1 12 | with: 13 | target-repo: heremaps/here-map-widget-for-jupyter/HEAD 14 | service-name: gh 15 | debug: true 16 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | defaults: 12 | run: 13 | shell: bash -l {0} 14 | 15 | jobs: 16 | run: 17 | runs-on: ${{ matrix.os }} 18 | 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | os: [ubuntu-latest, macos-latest] 23 | python-version: [3.12] 24 | 25 | steps: 26 | - uses: actions/checkout@v2 27 | 28 | - name: Setup conda 29 | uses: conda-incubator/setup-miniconda@v3 30 | with: 31 | mamba-version: "*" 32 | channels: conda-forge 33 | 34 | - name: Mamba install dependencies 35 | run: mamba install python=${{ matrix.python-version }} pip nodejs jupyter-packaging 36 | 37 | - name: Mamba install JupyterLab 3 38 | run: mamba install jupyterlab=3.5 ipywidgets=7.6 39 | 40 | - name: Install here-map-widget-for-jupyter 41 | run: | 42 | npm config set @here:registry https://repo.platform.here.com/artifactory/api/npm/here-node/ 43 | pip install .[dev] 44 | 45 | - name: Check installation files 46 | run: | 47 | test -d $CONDA_PREFIX/share/jupyter/nbextensions/@here/map-widget-for-jupyter 48 | test -f $CONDA_PREFIX/share/jupyter/nbextensions/@here/map-widget-for-jupyter/extension.js 49 | test -f $CONDA_PREFIX/share/jupyter/nbextensions/@here/map-widget-for-jupyter/index.js 50 | test -d $CONDA_PREFIX/share/jupyter/labextensions/@here/map-widget-for-jupyter 51 | test -f $CONDA_PREFIX/share/jupyter/labextensions/@here/map-widget-for-jupyter/package.json 52 | 53 | - name: Lint check 54 | run: make lint 55 | 56 | - name: Import check 57 | run: python -c 'import here_map_widget' 58 | 59 | - name: Build the package (Only on Linux for saving time) 60 | if: matrix.os == 'ubuntu-latest' 61 | run: | 62 | python setup.py sdist bdist_wheel 63 | 64 | - name: Build docs (Only on Linux for saving time) 65 | if: matrix.os == 'ubuntu-latest' 66 | env: 67 | XYZ_TOKEN: ${{ secrets.XYZ_TOKEN }} 68 | LS_API_KEY: ${{ secrets.LS_API_KEY }} 69 | run: | 70 | mamba install sphinx sphinx_rtd_theme 71 | pip install -r docs/requirements.txt 72 | cd docs 73 | make html 74 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Publish to PyPI and NPM 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | defaults: 8 | run: 9 | shell: bash -l {0} 10 | 11 | jobs: 12 | publish: 13 | runs-on: ${{ matrix.os }} 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | os: [ubuntu-latest] 18 | python-version: [3.12] 19 | steps: 20 | - uses: actions/checkout@v2 21 | 22 | - name: Setup conda 23 | uses: conda-incubator/setup-miniconda@v3 24 | with: 25 | mamba-version: "*" 26 | channels: conda-forge 27 | 28 | - name: Mamba install dependencies 29 | run: mamba install python=${{ matrix.python-version }} pip nodejs yarn jupyter-packaging 30 | 31 | - name: Mamba install JupyterLab 3 32 | run: mamba install jupyterlab=3.5 ipywidgets=7.6 33 | 34 | - name: Install tools 35 | run: | 36 | python -m pip install --upgrade pip 37 | pip install setuptools wheel twine jupyter-packaging 38 | - name: Build the package 39 | run: | 40 | node --version 41 | npm --version 42 | yarn --version 43 | npm config set @here:registry https://repo.platform.here.com/artifactory/api/npm/here-node/ 44 | pip install . 45 | python setup.py sdist bdist_wheel 46 | - name: Publish to PyPI 47 | uses: pypa/gh-action-pypi-publish@master 48 | with: 49 | user: __token__ 50 | password: ${{ secrets.PYPI_TOKEN }} 51 | verbose: true 52 | - name: Use Node.js 22 53 | uses: actions/setup-node@v1 54 | with: 55 | node-version: 22 56 | - name: Publish to NPM 57 | run: | 58 | cd js 59 | npm config set @here:registry https://repo.platform.here.com/artifactory/api/npm/here-node/ 60 | npm install --legacy-peer-deps 61 | npm run build 62 | npm config delete @here:registry https://repo.platform.here.com/artifactory/api/npm/here-node/ 63 | npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} 64 | npm publish --access=public 65 | env: 66 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.egg-info/ 2 | .ipynb_checkpoints/ 3 | dist/ 4 | build/ 5 | *.py[cod] 6 | node_modules/ 7 | .idea/ 8 | .vscode/ 9 | 10 | # Compiled javascript 11 | here_map_widget/static/ 12 | src/* 13 | *package-lock.json 14 | 15 | # OS X 16 | .DS_Store 17 | venv 18 | 19 | # Compiled javascript 20 | here_map_widget/nbextension/ 21 | here_map_widget/labextension/ 22 | js/dist/ 23 | yarn.lock -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | line_length=90 3 | multi_line_output=3 4 | include_trailing_comma=True 5 | force_grid_wrap=0 6 | use_parentheses=True -------------------------------------------------------------------------------- /.ort.yml: -------------------------------------------------------------------------------- 1 | --- 2 | excludes: 3 | paths: 4 | - pattern: "examples/**" 5 | reason: "EXAMPLE_OF" 6 | comment: "Directory only includes examples. Not included in released artifacts." 7 | - pattern: "docs/**" 8 | reason: "DOCUMENTATION_OF" 9 | comment: "Directory is only used for documentation. Not included in released artifacts." 10 | - pattern: "requirements_dev.txt" 11 | reason: "BUILD_TOOL_OF" 12 | comment: "Optional dependencies only used for development / testing." 13 | - pattern: "scripts/**" 14 | reason: "DOCUMENTATION_OF" 15 | comment: "Directory is only used for generating documentation for gitlab pages." 16 | scopes: 17 | - name: "devDependencies" 18 | reason: "DEV_DEPENDENCY_OF" 19 | comment: "Packages for development only." -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Build documentation in the docs/ directory with Sphinx 9 | sphinx: 10 | builder: html 11 | configuration: docs/source/conf.py 12 | 13 | # Build documentation with MkDocs 14 | #mkdocs: 15 | # configuration: mkdocs.yml 16 | 17 | # Optionally build your docs in additional formats such as PDF 18 | formats: 19 | - pdf 20 | 21 | # Optionally set the version of Python and requirements required to build your docs 22 | python: 23 | version: 3.8 24 | install: 25 | - requirements: requirements.txt 26 | - requirements: requirements_dev.txt 27 | - requirements: docs/requirements.txt -------------------------------------------------------------------------------- /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | ========= 3 | 4 | 5 | here-map-widget-for-jupyter 1.1.2 (2021-08-19) 6 | ---------------------------------------------- 7 | 8 | - Added support for external basemaps using `xyzservices `_. 9 | - Removed support for python3.6 due to `xyzservices `_. 10 | 11 | here-map-widget-for-jupyter 1.1.1 (2021-06-16) 12 | ---------------------------------------------- 13 | 14 | - Added bounds trait to map object 15 | - Added point_style for GeoJSON layer 16 | - Fixed JS bundle load issue for unpkg.com 17 | 18 | here-map-widget-for-jupyter 1.1.0 (2021-06-09) 19 | ---------------------------------------------- 20 | 21 | - Added transparent_bg parameter in WidgetControl 22 | - Added dedicated LayersControl to toggle layers on the map. 23 | - Fix layout issue of ipywidgets 24 | - Fix basemap trait for Map object 25 | - Fix MapSettingsControl dynamic update 26 | 27 | here-map-widget-for-jupyter 1.0.1 (2021-03-31) 28 | ---------------------------------------------- 29 | 30 | - Add ``ImageTileProvider`` to support XYZ and WMTS Tile layer. 31 | - Add support for ``+=`` and ``-=`` operators to add and remove Layers, Controls, and Objects. 32 | 33 | 34 | here-map-widget-for-jupyter 1.0.0 (2021-02-26) 35 | ---------------------------------------------- 36 | 37 | - Add support for JupyterLab 3 38 | - Add support for custom XYZ URL for XYZ space layer. 39 | 40 | 41 | here-map-widget-for-jupyter 0.1.1 (2021-02-08) 42 | ---------------------------------------------- 43 | 44 | - Added binder setup for the example notebooks. 45 | - Fixed readthedocs build. 46 | - Updated README. 47 | 48 | here-map-widget-for-jupyter 0.1.0 (2021-02-04) 49 | ---------------------------------------------- 50 | 51 | - Initial release 52 | 53 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to HERE Map Widget for Jupyter 2 | 3 | Thank you for taking the time to contribute. 4 | 5 | The following is a set of guidelines for contributing to this package. 6 | These are mostly guidelines, not rules. Use your best judgement and feel free to propose 7 | changes to this document in a pull request. 8 | 9 | ## Coding Guidelines 10 | 1. Lint your code contributions as per [pep8 guidelines](https://www.python.org/dev/peps/pep-0008/). 11 | 12 | To help you out, we have included a `Makefile` in the root directory which supports the commands below: 13 | 14 | Autoformat code using black: 15 | 16 | ```bash 17 | make black 18 | ``` 19 | 20 | Check for linting errors: 21 | 22 | ```bash 23 | make lint 24 | ``` 25 | 26 | 2. Sort the imports in each python file as per [pep8 guidelines](https://www.python.org/dev/peps/pep-0008/#imports) 27 | Please execute the isort utility to have the imports sorted auto-magically. 28 | 29 | #### Notebooks 30 | 31 | Example notebooks are provided in [/examples](./examples). 32 | 33 | ## Signing each Commit 34 | 35 | When you file a pull request, we ask that you sign off the 36 | [Developer Certificate of Origin](https://developercertificate.org/) (DCO) in each commit. 37 | Any Pull Request with commits that are not signed off will be rejected by the 38 | [DCO check](https://probot.github.io/apps/dco/). 39 | 40 | A DCO is a lightweight way to confirm that a contributor wrote or otherwise has the right 41 | to submit code or documentation to a project. Simply add `Signed-off-by` as shown in the example below 42 | to indicate that you agree with the DCO. 43 | 44 | The git flag `-s` can be used to sign a commit: 45 | 46 | ```bash 47 | git commit -s -m 'README.md: Fix minor spelling mistake' 48 | ``` 49 | 50 | The result is a signed commit message: 51 | 52 | ``` 53 | README.md: Fix minor spelling mistake 54 | 55 | Signed-off-by: John Doe 56 | ``` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (C) 2019-2024 HERE Europe B.V. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include here_map_widget/nbextension *.* 2 | recursive-include here_map_widget/labextension *.* 3 | include map-widget-for-jupyter.json 4 | graft js/lib 5 | include README.md 6 | include LICENSE 7 | include requirements*.txt 8 | include examples/* 9 | include js/*tgz 10 | include js/package.json 11 | include js/webpack.config.js 12 | include setup.py 13 | include pyproject.toml -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts 2 | 3 | clean-build: ## remove build artifacts 4 | rm -fr build/ 5 | rm -fr dist/ 6 | rm -fr .eggs/ 7 | find . -name '*.egg-info' -exec rm -fr {} + 8 | find . -name '*.egg' -exec rm -f {} + 9 | rm -rf js/*.tgz 10 | rm -rf here_map_widget/nbextension 11 | rm -rf here_map_widget/labextension 12 | rm -rf js/dist 13 | rm -rf js/node_modules 14 | rm -rf js/package-lock.json 15 | 16 | clean-pyc: ## remove Python file artifacts 17 | find . -name '*.pyc' -exec rm -f {} + 18 | find . -name '*.pyo' -exec rm -f {} + 19 | find . -name '*~' -exec rm -f {} + 20 | find . -name '__pycache__' -exec rm -fr {} + 21 | 22 | clean-test: ## remove test and coverage artifacts 23 | rm -fr .tox/ 24 | rm -f .coverage 25 | rm -fr htmlcov/ 26 | rm -fr .mypy_cache 27 | rm -fr .pytest_cache 28 | find . -name '.ipynb_checkpoints' -exec rm -fr {} + 29 | 30 | black: 31 | black -l 99 . 32 | isort --atomic . 33 | 34 | lint: 35 | isort --check --diff . 36 | black -l 99 --diff --check . 37 | 38 | 39 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Release Instructions 2 | This document describes the release process of here-map-widget-for-jupyter, and is mostly intended for package maintainers. 3 | 4 | ## Preparation 5 | 6 | The following are mandatory pre-release steps to bring the repository into a proper shape: 7 | 8 | - Update version in [here_map_widget/_version.py](here_map_widget/_version.py) as desired. 9 | - Update [js/package.json](js/package.json) with new npm package version. 10 | - Make sure all tests listed in `CONTRIBUTING.md` pass successfully. 11 | - Make sure badges appear as expected in the [README.md on GitHub](https://github.com/heremaps/here-map-widget-for-jupyter/blob/master/README.md). 12 | 13 | ## Release on PyPI 14 | 15 | - Create a new release in the GitHub UI by clicking on [Draft a new release](https://github.com/heremaps/here-map-widget-for-jupyter/releases/new) button, then update the tag version and release description. 16 | - Click on the `Publish release` button to release the [package on PyPI](https://pypi.org/project/here-map-widget-for-jupyter/). 17 | - Once released verify that `pip install here-map-widget-for-jupyter` does indeed install the latest release. 18 | 19 | 20 | ## Release on Anaconda's conda-forge channel 21 | 22 | - Go to the [here-map-widget-for-jupyter-feedstock](https://github.com/conda-forge/here-map-widget-for-jupyter-feedstock) repository. 23 | - Create a new release branch and update `version`, `url`, `sha256` hash of the released tar and dependencies in [meta.yml](https://github.com/conda-forge/here-map-widget-for-jupyter-feedstock/blob/master/recipe/meta.yaml) 24 | - Verify `requirements` in [meta.yml](https://github.com/conda-forge/here-map-widget-for-jupyter-feedstock/blob/master/recipe/meta.yaml) 25 | - Raise a PR for this release branch and merge the changes in master. 26 | - It can take hours for a new release to [appear on Anaconda.org](https://anaconda.org/conda-forge/here-map-widget-for-jupyter). 27 | - Once available verify that `conda install -c conda-forge here-map-widget-for-jupyter` does indeed install the latest release. 28 | -------------------------------------------------------------------------------- /binder/environment.yml: -------------------------------------------------------------------------------- 1 | name: here_map_widget 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - pip 6 | - xyzspaces 7 | - jupyterlab=3 8 | - pip: 9 | - "-r ../docs/requirements.txt" 10 | - here-map-widget-for-jupyter 11 | -------------------------------------------------------------------------------- /binder/postBuild: -------------------------------------------------------------------------------- 1 | # Notebooks with extensions that auto-run code must be "trusted" to work the first time 2 | jupyter trust examples/*.ipynb -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | jupyter-sphinx==0.2.4a1 2 | sphinx_rtd_theme 3 | pandas 4 | geopandas 5 | here-map-widget-for-jupyter -------------------------------------------------------------------------------- /docs/source/_static/main_stylesheet.css: -------------------------------------------------------------------------------- 1 | .wy-nav-content{ 2 | max-width: 1000px; 3 | margin: auto; 4 | } 5 | -------------------------------------------------------------------------------- /docs/source/api_reference/basemap/basemap.rst: -------------------------------------------------------------------------------- 1 | Base Maps 2 | ----------- 3 | 4 | These are the various basemaps supported by ``here-map-widget-for-jupyter`` 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | japan 10 | raster 11 | vector 12 | map_tile 13 | external_basemap -------------------------------------------------------------------------------- /docs/source/api_reference/basemap/external_basemap.rst: -------------------------------------------------------------------------------- 1 | External Basemaps 2 | ================= 3 | ``here-map-widget-for-jupyter`` also supports basemaps from external tile providers. 4 | We use tile providers defined in `xyzservices `_ 5 | :attr:`here_map_widget.basemaps` is mapped to :class:`xyzservices.providers` 6 | 7 | 8 | Example 9 | ------- 10 | 11 | .. jupyter-execute:: 12 | 13 | import os 14 | from here_map_widget import Map, basemaps 15 | 16 | m = Map( 17 | api_key=os.environ["LS_API_KEY"], 18 | center=[52.51477270923461, 13.39846691425174], 19 | zoom=4, 20 | basemap=basemaps.OpenStreetMap.Mapnik, 21 | ) 22 | m 23 | 24 | 25 | 26 | Attributes 27 | ---------- 28 | 29 | =================== ============================================================ === 30 | Attribute Type Doc 31 | =================== ============================================================ === 32 | basemap object The basemap is object of :class:`xyzservices.lib.TileProvider`, defined under :attr:`here_map_widget.basemaps`. 33 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/basemap/japan.rst: -------------------------------------------------------------------------------- 1 | Japan Basemap 2 | ============== 3 | 4 | ``Japan Basemap`` is the type of basemap of ``here-map-widget-for-jupyter`` which shows basemap data for Japan. 5 | For more information on basemap with Japan data please check this `link `_. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | import os 13 | from here_map_widget import Map, OMV, Platform, Style, TileLayer 14 | from here_map_widget import ServiceNames, OMVUrl 15 | 16 | services_config = { 17 | ServiceNames.omv: { 18 | OMVUrl.scheme: "https", 19 | OMVUrl.host: "vector.hereapi.com", 20 | OMVUrl.path: "/v2/vectortiles/core/mc", 21 | } 22 | } 23 | 24 | platform = Platform(api_key=os.environ["LS_API_KEY"], services_config=services_config) 25 | 26 | style = Style( 27 | config="https://js.api.here.com/v3/3.1/styles/omv/oslo/japan/normal.day.yaml", 28 | base_url="https://js.api.here.com/v3/3.1/styles/omv/oslo/japan/", 29 | ) 30 | 31 | omv_provider = OMV(path="v2/vectortiles/core/mc", platform=platform, style=style) 32 | 33 | omv_layer = TileLayer(provider=omv_provider, style={"max": 22}) 34 | 35 | center = [35.68026, 139.76744] 36 | m = Map(api_key=os.environ["LS_API_KEY"], center=center, zoom=8, basemap=omv_layer) 37 | m 38 | 39 | Attributes 40 | ---------- 41 | 42 | =================== ============================================================ === 43 | Attribute Type Doc 44 | =================== ============================================================ === 45 | basemap object The basemap is object of :class:`TileLayer`. 46 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/basemap/map_tile.rst: -------------------------------------------------------------------------------- 1 | Map Tile Basemap 2 | ================ 3 | 4 | ``MapTile Basemap`` is the type of basemap of ``here-map-widget-for-jupyter`` which shows basemap using `Map Tile API `_. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, Platform, MapTile, TileLayer 12 | from here_map_widget import ServiceNames, MapTileUrl 13 | import os 14 | 15 | services_config = { 16 | ServiceNames.maptile: { 17 | MapTileUrl.scheme: "https", 18 | MapTileUrl.host: "maps.ls.hereapi.com", 19 | MapTileUrl.path: "maptile/2.1", 20 | } 21 | } 22 | 23 | platform = Platform(api_key=os.environ["LS_API_KEY"], services_config=services_config) 24 | 25 | maptile = MapTile( 26 | tile_type="maptile", 27 | scheme="hybrid.day", 28 | tile_size=256, 29 | format="jpg", 30 | platform=platform, 31 | type="aerial", 32 | ) 33 | 34 | maptile_layer = TileLayer(provider=maptile, style={"max": 22}) 35 | 36 | m = Map( 37 | api_key=os.environ["LS_API_KEY"], 38 | center=[35.68026, 139.76744], 39 | zoom=17, 40 | basemap=maptile_layer, 41 | ) 42 | m 43 | 44 | Attributes 45 | ---------- 46 | 47 | =================== ============================================================ === 48 | Attribute Type Doc 49 | =================== ============================================================ === 50 | basemap object The basemap is object of :class:`TileLayer`. 51 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/basemap/raster.rst: -------------------------------------------------------------------------------- 1 | Raster Basemaps 2 | =============== 3 | 4 | ``Raster Basemaps`` are pre-configured set of HERE layers for convenient use as basemap supported by ``here-map-widget-for-jupyter``. 5 | Detailed information about raster basemaps supported by ``HERE Maps API for JavaScript`` can be found `here `_. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import Map, DefaultLayers, DefaultLayerNames, Platform 13 | import os 14 | 15 | default_layer = DefaultLayers(layer_name=DefaultLayerNames.raster.satellite.map) 16 | 17 | m = Map( 18 | api_key=os.environ["LS_API_KEY"], basemap=default_layer, center=[44.2002, -72.7566] 19 | ) 20 | m 21 | 22 | Attributes 23 | ---------- 24 | 25 | =================== ============================================================ === 26 | Attribute Type Doc 27 | =================== ============================================================ === 28 | basemap object Object of :class:`DefaultLayers`. for various types of ``layer_name`` supported by ``DefaultLayers``, please check :ref:`config `. 29 | =================== ============================================================ === 30 | -------------------------------------------------------------------------------- /docs/source/api_reference/basemap/vector.rst: -------------------------------------------------------------------------------- 1 | Vector Basemaps 2 | =============== 3 | 4 | ``Vector Basemaps`` are pre-configured set of HERE layers for convenient use as basemap supported by ``here-map-widget-for-jupyter``. 5 | Detailed information about vector basemaps supported by ``HERE Maps API for JavaScript`` can be found `here `_. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import Map, DefaultLayers, DefaultLayerNames, Platform 13 | import os 14 | 15 | default_layer = DefaultLayers(layer_name=DefaultLayerNames.vector.normal.map) 16 | 17 | m = Map( 18 | api_key=os.environ["LS_API_KEY"], basemap=default_layer, center=[44.2002, -72.7566] 19 | ) 20 | m 21 | 22 | Attributes 23 | ---------- 24 | 25 | =================== ============================================================ === 26 | Attribute Type Doc 27 | =================== ============================================================ === 28 | basemap object Object of ``DefaultLayers``. for various types of ``layer_name`` supported by ``DefaultLayers``, please check :ref:`config `. 29 | =================== ============================================================ === 30 | -------------------------------------------------------------------------------- /docs/source/api_reference/config/config.rst: -------------------------------------------------------------------------------- 1 | Configs 2 | ----------- 3 | This section describes various configuration options supported by ``here-map-widget-for-jupyter``. 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | default_layers_config 9 | service_names 10 | service_urls -------------------------------------------------------------------------------- /docs/source/api_reference/config/misc_values.rst: -------------------------------------------------------------------------------- 1 | .. _misc_values: 2 | 3 | Miscellaneous Values 4 | ==================== 5 | This section describes values for input parameters of ``controls`` and ``layers`` and their description. 6 | 7 | Control Alignment 8 | ----------------- 9 | ``alignment`` is input parameter for all ``controls`` it determines where control will be postioned on the map. 10 | 11 | ================= ============ 12 | Name Description 13 | ================= ============ 14 | TOP_LEFT control will be added on top of the map on the left corner and control will be horizontal. 15 | TOP_CENTER control will be added on top of the map on center and control will be horizontal. 16 | TOP_RIGHT control will be added on top of the map on the right corner and control will be horizontal. 17 | LEFT_TOP control will be added on the left side of the map and on top and control will be vertical. 18 | LEFT_MIDDLE control will be added on the left side of the map and in the middle and control will be vertical. 19 | LEFT_BOTTOM control will be added on the left side of the map and in the bottom and control will be vertical. 20 | RIGHT_TOP control will be added on the right side of the map and on top and control will be vertical. 21 | RIGHT_MIDDLE control will be added on the right side of the map and in the middle and control will be vertical. 22 | RIGHT_BOTTOM control will be added on the right side of the map and in the bottom and control will be vertical. 23 | BOTTOM_LEFT control will be added on bottom of the map on the left corner and control will be horizontal. 24 | BOTTOM_CENTER control will be added on bottom of the map on center and control will be horizontal. 25 | BOTTOM_RIGHT control will be added on bottom of the map on the right corner and control will be horizontal. 26 | ================= ============ 27 | 28 | 29 | Event Type 30 | ---------- 31 | ``evt_type`` is input parameter for some ``layers``. Event listeners listen to this type of event. 32 | 33 | ================= ============ 34 | Name Description 35 | ================= ============ 36 | tap Represents mouse click by the user. 37 | pointermove Represents mosue hover by the user. 38 | ================= ============ -------------------------------------------------------------------------------- /docs/source/api_reference/config/service_names.rst: -------------------------------------------------------------------------------- 1 | Service Names 2 | ============= 3 | Config for service names is maintained in :class:`ServiceNames`. 4 | 5 | Service Names Example 6 | --------------------- 7 | 8 | .. jupyter-execute:: 9 | 10 | from here_map_widget import Map, Platform, MapTile 11 | from here_map_widget import ServiceNames, MapTileUrl 12 | import os 13 | 14 | services_config = { 15 | ServiceNames.maptile: { 16 | MapTileUrl.scheme: "https", 17 | MapTileUrl.host: "maps.ls.hereapi.com", 18 | MapTileUrl.path: "maptile/2.1", 19 | } 20 | } 21 | 22 | platform = Platform(api_key=os.environ["LS_API_KEY"], services_config=services_config) 23 | 24 | Service Names 25 | ------------- 26 | 27 | ================================================ ============ ================================================ 28 | Object Type Value 29 | ================================================ ============ ================================================ 30 | ServiceNames.omv string omv 31 | ServiceNames.maptile string maptile 32 | ServiceNames.xyz string xyz 33 | ================================================ ============ ================================================ -------------------------------------------------------------------------------- /docs/source/api_reference/control/control.rst: -------------------------------------------------------------------------------- 1 | Controls 2 | ----------- 3 | 4 | This are the various UI controls supported by ``here-map-widget-for-jupyter`` 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | fullscreen 10 | mapsettings 11 | measurement 12 | scalebar 13 | searchcontrol 14 | splitmap 15 | zoom 16 | zoomrectangle 17 | widgetcontrol -------------------------------------------------------------------------------- /docs/source/api_reference/control/fullscreen.rst: -------------------------------------------------------------------------------- 1 | Fullscreen Control 2 | =================== 3 | 4 | ``Fullscreen Control`` is an ``here-map-widget-for-jupyter`` class that allows you to add a control which contains a button that will put the Map in full-screen when clicked. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, FullscreenControl 12 | import os 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"]) 15 | m.center = [44.20022717941052, -72.75660780639646] 16 | fs = FullscreenControl() 17 | m.add_control(fs) 18 | m 19 | 20 | Attributes 21 | ---------- 22 | 23 | =================== ============================================================ === 24 | Attribute Type Doc 25 | =================== ============================================================ === 26 | name string Unique id of the widget, default value is FullscreenControl 27 | alignment string The layout alignment which should be applied to the ``Fullscreen Control``, please check :ref:`allowed values `, defaults to ``TOP_LEFT``. 28 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/control/layerscontrol.rst: -------------------------------------------------------------------------------- 1 | Layers Control 2 | ================= 3 | 4 | ``LayersControl`` is an ``here-map-widget-for-jupyter`` class which is useful to show/hide layers on map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import GeoJSON, Map, LayersControl 12 | import os 13 | 14 | m = Map(api_key=os.environ['LS_API_KEY'], center=[43.052, -62.49]) 15 | 16 | countries = GeoJSON( 17 | url="https://gist.githubusercontent.com/peaksnail/5d4f07ca00ed7c653663d7874e0ab8e7/raw/64c2a975482efd9c42e54f6f6869f091055053cd/countries.geo.json", 18 | disable_legacy_mode=True, 19 | style={"color": "black", "opacity": 0.1}, 20 | name="world countries", 21 | ) 22 | 23 | us_states = GeoJSON( 24 | url="https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json", 25 | disable_legacy_mode=True, 26 | style={"color": "black", "opacity": 0.1}, 27 | name="US states", 28 | ) 29 | m.add_layers([countries, us_states]) 30 | lc = LayersControl(alignment="RIGHT_TOP") 31 | m.add_control(lc) 32 | m 33 | 34 | 35 | 36 | Attributes 37 | ---------- 38 | 39 | =================== ============================================================ === 40 | Attribute Type Doc 41 | =================== ============================================================ === 42 | alignment string The layout alignment which should be applied to the ``LayersControl``, please check :ref:`allowed values `, defaults to ``RIGHT_TOP`` 43 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/control/mapsettings.rst: -------------------------------------------------------------------------------- 1 | Map Settings Control 2 | ==================== 3 | 4 | ``Map Settings Control`` is an ``here-map-widget-for-jupyter`` class that allows you to add a control that allows the user to select the base map types as well as add additional layers on top. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import GeoJSON, Map, MapSettingsControl 12 | from here_map_widget import TileLayer, XYZ 13 | import os 14 | 15 | center = [51.1657, 10.4515] 16 | 17 | m = Map(api_key=os.environ["LS_API_KEY"], center=center) 18 | 19 | xyz_token = os.environ["XYZ_TOKEN"] 20 | provider = XYZ(space_id="m2pcsiNi", token=xyz_token) 21 | space = TileLayer(provider=provider) 22 | 23 | geojson = GeoJSON( 24 | url="https://gist.githubusercontent.com/peaksnail/" 25 | + "5d4f07ca00ed7c653663d7874e0ab8e7/raw/" 26 | + "64c2a975482efd9c42e54f6f6869f091055053cd/countries.geo.json", 27 | disable_legacy_mode=True, 28 | style={"color": "black", "opacity": 0.1}, 29 | ) 30 | 31 | 32 | setttings = MapSettingsControl( 33 | layers=[ 34 | {"label": "space", "layer": space}, 35 | {"label": "countries", "layer": geojson}, 36 | ], 37 | basemaps=["raster.satellite.map", "raster.terrain.map"], 38 | ) 39 | 40 | m.add_control(setttings) 41 | 42 | m 43 | 44 | 45 | Attributes 46 | ---------- 47 | 48 | =================== ============================================================ === 49 | Attribute Type Doc 50 | =================== ============================================================ === 51 | alignment string The layout alignment which should be applied to the ``Map Settings Control``, please check :ref:`allowed values `, defaults to ``TOP_RIGHT``. 52 | basemaps List of strings The list of base layers to be shown in the map settings control, selecting an entry changes map base layer 53 | layers List of Layers The list of layers to be shown in the map settings control after the baseLayers list 54 | =================== ============================================================ === 55 | 56 | Methods 57 | ------- 58 | 59 | ============= =============== === 60 | Method Arguments Doc 61 | ============= =============== === 62 | add_layers List Add layers to control 63 | remove_layers List Remove layers from control 64 | ============= =============== === -------------------------------------------------------------------------------- /docs/source/api_reference/control/scalebar.rst: -------------------------------------------------------------------------------- 1 | Scale Bar Control 2 | ================= 3 | 4 | ``Scale Bar Control`` is an ``here-map-widget-for-jupyter`` class that represents a UI element that shows the zoom scale. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, ScaleBar 12 | import os 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"]) 15 | sb = ScaleBar() 16 | m.add_control(sb) 17 | m 18 | 19 | 20 | Attributes 21 | ---------- 22 | 23 | =================== ============================================================ === 24 | Attribute Type Doc 25 | =================== ============================================================ === 26 | alignment string The layout alignment which should be applied to the ``Scale Bar Control``, please check :ref:`allowed values `, defaults to ``RIGHT_BOTTOM`` 27 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/control/splitmap.rst: -------------------------------------------------------------------------------- 1 | Split Map Control 2 | ================= 3 | 4 | ``Split Map Control`` is an ``here-map-widget-for-jupyter`` class that allows comparing layers by splitting the map in two. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, SplitMapControl, GeoJSON 12 | import os 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"]) 15 | left_geojson = GeoJSON( 16 | url="https://gist.githubusercontent.com/peaksnail/" 17 | + "5d4f07ca00ed7c653663d7874e0ab8e7/raw/64c2a975482efd9c42e54f6f6869f091055053cd/" 18 | + "countries.geo.json", 19 | disable_legacy_mode=True, 20 | style={"fillColor": "#ff0000", "color": "black", "opacity": 0.1}, 21 | ) 22 | right_geojson = GeoJSON( 23 | url="https://gist.githubusercontent.com/peaksnail/" 24 | + "5d4f07ca00ed7c653663d7874e0ab8e7/raw/64c2a975482efd9c42e54f6f6869f091055053cd/" 25 | + "countries.geo.json", 26 | disable_legacy_mode=True, 27 | style={"fillColor": "#00ff00", "color": "black", "opacity": 0.1}, 28 | ) 29 | 30 | sp = SplitMapControl(left_layer=left_geojson, right_layer=right_geojson) 31 | m.add_control(sp) 32 | m 33 | 34 | 35 | Attributes 36 | ---------- 37 | 38 | =================== ============================================================ === 39 | Attribute Type Doc 40 | =================== ============================================================ === 41 | name string Unique id of the widget, default value is SplitMapControl 42 | left_layer object of layer Layer to be added on left side of the control 43 | right_layer object of layer Layer to be added on right side of the control 44 | =================== ============================================================ === 45 | 46 | .. warning:: 47 | ``Split Map Control`` is standalone control and can not be used with any other control. -------------------------------------------------------------------------------- /docs/source/api_reference/control/widgetcontrol.rst: -------------------------------------------------------------------------------- 1 | Widget Control 2 | ============== 3 | 4 | ``Widget Control`` is an ``here-map-widget-for-jupyter`` class that allows integration of various `ipywidgets `_ with ``here-map-widget-for-jupyter``. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import WidgetControl, Map 12 | from ipywidgets import FloatSlider, ColorPicker, jslink 13 | import os 14 | 15 | m = Map(api_key=os.environ['LS_API_KEY']) 16 | 17 | zoom_slider = FloatSlider(description='Tilt level:', min=0, max=90, value=0) 18 | jslink((zoom_slider, 'value'), (m, 'tilt')) 19 | widget_control1 = WidgetControl(widget=zoom_slider, alignment="TOP_RIGHT", name="FloatSlider") 20 | 21 | m.add_control(widget_control1) 22 | m 23 | 24 | 25 | Attributes 26 | ---------- 27 | 28 | =================== ============================================================ === 29 | Attribute Type Doc 30 | =================== ============================================================ === 31 | name string Unique id of the widget, default value is SplitMapControl 32 | alignment string The layout alignment which should be applied to the ``Widget Control``, please check :ref:`allowed values `, defaults to ``RIGHT_BOTTOM`` 33 | widget object of ipywidget The ipywidget to be added 34 | transparent_bg boolean If set to ``True``, widget will be added with transparent background. Default False. 35 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/control/zoom.rst: -------------------------------------------------------------------------------- 1 | Zoom Control 2 | ============ 3 | 4 | ``Zoom Control`` is an ``here-map-widget-for-jupyter`` class that represents the UI control that allows the user to change the map zoom level. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, ZoomControl, GeoJSON 12 | import os 13 | 14 | m = Map(api_key=os.environ['LS_API_KEY']) 15 | zc = ZoomControl(alignment='BOTTOM_RIGHT', slider=True) 16 | m.add_control(zc) 17 | m 18 | 19 | Attributes 20 | ---------- 21 | 22 | =================== ============================================================ === 23 | Attribute Type Doc 24 | =================== ============================================================ === 25 | zoomSpeed float The zoom speed in levels per second, defaults to 4 26 | fractionalZoom boolean A flag indicating whether fractional zoom levels are allowed (True, default) or not (False). 27 | alignment string The layout alignment which should be applied to the ``Zoom Control``, please check :ref:`allowed values `, defaults to ``RIGHT_MIDDLE`` 28 | slider boolean A flag indicating whether to show the slider (True) or not (False, default) 29 | sliderSnaps boolean A flag indicating whether the slider should snap to integer values or not, defaults to False 30 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/control/zoomrectangle.rst: -------------------------------------------------------------------------------- 1 | Zoom Rectangle Control 2 | ====================== 3 | 4 | ``Zoom Rectangle Control`` is an ``here-map-widget-for-jupyter`` class that represents a zoom rectangle control element that allows zooming to the selected area on the screen. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, ZoomRectangle 12 | import os 13 | 14 | m = Map(api_key=os.environ['LS_API_KEY']) 15 | zr = ZoomRectangle(alignment='BOTTOM_RIGHT') 16 | m.add_control(zr) 17 | m 18 | 19 | Attributes 20 | ---------- 21 | 22 | =================== ============================================================ === 23 | Attribute Type Doc 24 | =================== ============================================================ === 25 | alignment string The layout alignment which should be applied to the ``Zoom Rectangle Control``, please check :ref:`allowed values `, defaults to ``BOTTOM_RIGHT`` 26 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/element/element.rst: -------------------------------------------------------------------------------- 1 | Elements 2 | ----------- 3 | 4 | These are the various elements supported by ``here-map-widget-for-jupyter`` 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | infobubble 10 | style -------------------------------------------------------------------------------- /docs/source/api_reference/element/infobubble.rst: -------------------------------------------------------------------------------- 1 | Info Bubble Element 2 | =================== 3 | 4 | ``Info Bubble`` is an ``here-map-widget-for-jupyter`` class that allows to make a information bubble and bound it to a geographic position on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, Marker, Point 12 | from here_map_widget import InfoBubble 13 | import os 14 | 15 | m = Map(api_key=os.environ["LS_API_KEY"], zoom=8) 16 | m.center = [19.0760, 72.8777] 17 | m.zoom = 8 18 | 19 | info = InfoBubble( 20 | position=Point(lat=18.9389, lng=72.8258), 21 | content='' 23 | + "
Wankhede Stadium
Capacity: 33,108
", 24 | ) 25 | 26 | mumbai_marker = Marker( 27 | lat=18.9389, lng=72.8258, info=info, evt_type="tap", show_bubble=True 28 | ) 29 | 30 | m.add_object(mumbai_marker) 31 | m 32 | 33 | Attributes 34 | ---------- 35 | 36 | =================== =============== === 37 | Attribute Type Doc 38 | =================== =============== === 39 | content string The content to be added to the info bubble 40 | position object of Point The geographic location to which this info bubble corresponds 41 | =================== =============== === 42 | -------------------------------------------------------------------------------- /docs/source/api_reference/element/style.rst: -------------------------------------------------------------------------------- 1 | Style Element 2 | ============== 3 | 4 | ``Style`` is an ``here-map-widget-for-jupyter`` class that allows to configure style for various elements of the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, Style 12 | import os 13 | 14 | style = Style( 15 | config="https://heremaps.github.io/maps-api-for-javascript-examples/" 16 | + "change-style-at-load/data/dark.yaml", 17 | base_url="https://js.api.here.com/v3/3.1/styles/omv/", 18 | ) 19 | 20 | 21 | m = Map( 22 | api_key=os.environ["LS_API_KEY"], 23 | style=style, 24 | center=[52.51477270923461, 13.39846691425174], 25 | zoom=13, 26 | ) 27 | 28 | m 29 | 30 | Attributes 31 | ---------- 32 | 33 | =================== =============== === 34 | Attribute Type Doc 35 | =================== =============== === 36 | config string Either a URL to load the style from, YAML formatted string or an object describing the rendering style 37 | base_url string The base URL to use for resolving relative URLs in the style like textures, fonts 38 | =================== =============== === 39 | -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/bbox.rst: -------------------------------------------------------------------------------- 1 | BBOX 2 | ===== 3 | 4 | A ``bbox`` is a subclass of ``Geometry`` class which is used to create a ``Rectangle`` object which can then be visualised on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | import os 12 | from here_map_widget import Map 13 | from here_map_widget import Bbox, Rectangle 14 | 15 | 16 | m = Map( 17 | api_key=os.environ["LS_API_KEY"], 18 | center=[46.017618898512374, 23.91982511231513], 19 | zoom=3, 20 | ) 21 | 22 | style = {"strokeColor": "#829", "lineWidth": 4} 23 | 24 | bbox = Bbox(top=53.1, left=13.1, bottom=43.1, right=40.1) 25 | rectangle = Rectangle(bbox=bbox, style=style, draggable=True) 26 | m.add_object(rectangle) 27 | m 28 | 29 | 30 | Attributes 31 | ---------- 32 | 33 | =================== ============================================================ === 34 | Attribute Type Doc 35 | =================== ============================================================ === 36 | top Float A value indicating the northern-most latitude. 37 | left Float A value indicating the left-most longitude. 38 | bottom Float A value indicating the southern-most latitude. 39 | right Float A value indicating the right-most latitude. 40 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/geometry.rst: -------------------------------------------------------------------------------- 1 | Geometries 2 | ----------- 3 | 4 | These are the various layer types supported by ``here-map-widget-for-jupyter`` 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | point 10 | linestring 11 | multilinestring 12 | geopolygon 13 | geomultipolygon 14 | bbox 15 | wkt -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/geomultipolygon.rst: -------------------------------------------------------------------------------- 1 | GeoMultiPolygon 2 | =============== 3 | 4 | ``GeoMultiPolygon`` is a subclass of Geometry class that allows you to create a ``Polygon`` object which then can be visualised on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | import os 12 | from here_map_widget import Map, GeoPolygon, LineString, Polygon, GeoMultiPolygon 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"], center=[51.1657, 10.4515]) 15 | 16 | l1 = [52, 13, 100, 48, 2, 100, 48, 16, 100, 52, 13, 100] 17 | 18 | ls1 = LineString(points=l1) 19 | 20 | gpg1 = GeoPolygon(linestring=ls1) 21 | 22 | style = {"strokeColor": "#829", "lineWidth": 4} 23 | 24 | l2 = [55, 19, 99, 52, 2, 100, 52, 16, 100, 55, 19, 99] 25 | ls2 = LineString(points=l2) 26 | 27 | gpg2 = GeoPolygon(linestring=ls2) 28 | 29 | gmp = GeoMultiPolygon(polygons=[gpg1]) 30 | 31 | pg = Polygon(object=gmp, style=style, draggable=False) 32 | 33 | m.add_object(pg) 34 | m 35 | 36 | 37 | Attributes 38 | ---------- 39 | 40 | =================== ============================================================ === 41 | Attribute Type Doc 42 | =================== ============================================================ === 43 | polygons A list of GeoPolygon objects. A list of GeoPolygon objects. 44 | =================== ============================================================ === 45 | 46 | Methods 47 | ------- 48 | 49 | =============== ========================== === 50 | Method Arguments Doc 51 | =============== ========================== === 52 | push_polygon GeoPolygon object Add polygon in the GeoMultiPolygon 53 | add_polygons list of GeoPolygon objects Add polygons in the GeoMultiPolygon 54 | remove_polygon GeoPolygon object Remove polygon from the GeoMultiPolygon 55 | =============== ========================== === -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/geopolygon.rst: -------------------------------------------------------------------------------- 1 | GeoPolygon 2 | =========== 3 | 4 | ``GeoPolygon`` is a subclass of Geometry class that allows you to create a ``Polygon`` object which then can be visualised on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | import os 12 | from here_map_widget import Map, GeoPolygon, LineString, Polygon 13 | 14 | l = [52, 13, 100, 48, 2, 100, 48, 16, 100, 52, 13, 100] 15 | 16 | ls = LineString(points=l) 17 | 18 | gpg = GeoPolygon(linestring=ls) 19 | 20 | style = {"strokeColor": "#829", "lineWidth": 4} 21 | 22 | obj = Polygon(object=gpg, style=style, draggable=False) 23 | 24 | m = Map(api_key=os.environ["LS_API_KEY"], center=[51.1657, 10.4515]) 25 | 26 | m.add_object(obj) 27 | m 28 | 29 | 30 | Attributes 31 | ---------- 32 | 33 | =================== ============================================================ === 34 | Attribute Type Doc 35 | =================== ============================================================ === 36 | linestring LineString object. The LineString Geometry. 37 | holes A list of LineString objects. A list of LineStrings. 38 | =================== ============================================================ === 39 | 40 | 41 | Methods 42 | ------- 43 | 44 | ============ =========================== === 45 | Method Arguments Doc 46 | ============ =========================== === 47 | push_hole LineString object Add hole on GeoPolygon. 48 | add_holes list of LineString objects Add holes on GeoPolygon 49 | remove_hole LineString object Remove hole from the GeoPolygon 50 | ============ =========================== === -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/linestring.rst: -------------------------------------------------------------------------------- 1 | LineString 2 | ========== 3 | 4 | ``LineString`` is subclass of ``Geometry`` class which then can be used to create a ``Polyline`` which will be visualised on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | import os 12 | from here_map_widget import LineString, Polyline 13 | from here_map_widget import Map 14 | 15 | m = Map(api_key=os.environ["LS_API_KEY"]) 16 | m.center = [51.1657, 10.4515] 17 | style = {"lineWidth": 15} 18 | l = [53.3477, -6.2597, 0, 51.5008, -0.1224, 0, 48.8567, 2.3508, 0, 52.5166, 13.3833, 0] 19 | ls = LineString(points=l) 20 | pl = Polyline(object=ls, style=style) 21 | m.add_object(pl) 22 | m 23 | 24 | Attributes 25 | ---------- 26 | 27 | =================== ============================================================ === 28 | Attribute Type Doc 29 | =================== ============================================================ === 30 | points A list of Point objects. A list of Point objects to construct Linestring. 31 | =================== ============================================================ === 32 | 33 | 34 | Methods 35 | ------- 36 | 37 | ========== =============== === 38 | Method Arguments Doc 39 | ========== =============== === 40 | push_point lat,lng,alt Pushes Point with given lat,lng,alt at the end of LineString. 41 | ========== =============== === -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/multilinestring.rst: -------------------------------------------------------------------------------- 1 | MultiLineString 2 | =============== 3 | 4 | ``MultiLineString`` is subclass of ``Geometry`` class which then can be used to create a ``Polyline`` which will be visualised on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map 12 | from here_map_widget import LineString, MultiLineString, Polyline 13 | import os 14 | 15 | m = Map(api_key=os.environ['LS_API_KEY'], center=[51.1657, 10.4515]) 16 | style = { 'lineWidth': 15 } 17 | l = [53.3477, -6.2597, 0, 51.5008, -0.1224, 0, 48.8567, 2.3508, 0, 52.5166, 13.3833, 0] 18 | l_1 = [-53.3477, 6.2597, 0, -51.5008, 0.1224, 0, 48.8567, 2.3508, 0, 52.5166, 13.3833, 0] 19 | ls = LineString(points=l) 20 | ls_1 = LineString(points=l_1) 21 | ml = MultiLineString(lines=[ls]) 22 | pl = Polyline(object=ml, style=style) 23 | m.add_object(pl) 24 | m 25 | 26 | Attributes 27 | ---------- 28 | 29 | =================== ============================================================ === 30 | Attribute Type Doc 31 | =================== ============================================================ === 32 | lines A list of LineString objects. A list of LineString objects. 33 | =================== ============================================================ === 34 | 35 | 36 | =========== ========================== === 37 | Method Arguments Doc 38 | =========== ========================== === 39 | push_line LineString object Pushes Linestring end of MultiLineString. 40 | add_lines list of LineString objects Pushes multiple Linestrings end of MultiLineString. 41 | remove_line LineString object Removes LineString from MultiLineString. 42 | =========== ========================== === -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/point.rst: -------------------------------------------------------------------------------- 1 | Point 2 | ====== 3 | 4 | A ``Point`` is subclass of ``Geometry`` class which can be used in multiple objects. One of the example is to define the center of the Circle. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map 12 | from here_map_widget import Point, Circle 13 | import os 14 | 15 | m = Map(api_key=os.environ['LS_API_KEY'], center=[19.152761, 72.87869], zoom=10) 16 | 17 | style = {"strokeColor": "#829", "lineWidth": 4} 18 | 19 | point = Point(lat=19.152761, lng=72.87869) 20 | circle = Circle(center=point, radius=10000, style=style, draggable=True) 21 | m.add_object(circle) 22 | m 23 | 24 | Attributes 25 | ---------- 26 | 27 | =================== ============================================================ === 28 | Attribute Type Doc 29 | =================== ============================================================ === 30 | lat Float Latitude of the Point. 31 | lng Float Longitude of the Point. 32 | alt Float Altitude of the Point. 33 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/geometry/wkt.rst: -------------------------------------------------------------------------------- 1 | WKT 2 | ==== 3 | 4 | A ``WKT`` is a subclass of ``Geometry`` class which will be used to visualise WKT data on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | import os 12 | from here_map_widget import WKT, Marker 13 | from here_map_widget import Map 14 | 15 | m = Map(api_key=os.environ["LS_API_KEY"]) 16 | m.center = [19.0760, 72.8777] 17 | m.zoom = 9 18 | wkt = WKT(data="POINT (72.8777 19.0760)") 19 | mumbai_marker = Marker(object=wkt) 20 | m.add_object(mumbai_marker) 21 | m 22 | 23 | Attributes 24 | ---------- 25 | 26 | =================== ============================================================ === 27 | Attribute Type Doc 28 | =================== ============================================================ === 29 | data string A WKT string. 30 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/layer/geo_json.rst: -------------------------------------------------------------------------------- 1 | GeoJSON 2 | ======= 3 | 4 | ``GeoJSON`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a `GeoJSON Data 5 | `_ on the Map. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import Map, GeoJSON 13 | import os 14 | 15 | # Add GeoJSON from URL 16 | m = Map(api_key=os.environ["LS_API_KEY"]) 17 | url = ( 18 | "https://gist.githubusercontent.com/peaksnail/" 19 | + "5d4f07ca00ed7c653663d7874e0ab8e7/raw/" 20 | + "64c2a975482efd9c42e54f6f6869f091055053cd/countries.geo.json" 21 | ) 22 | geojson = GeoJSON( 23 | url=url, 24 | disable_legacy_mode=True, 25 | style={"fillColor": "rgba(245, 176, 65, 0.5)", "strokeColor": "black"}, 26 | show_bubble=True, 27 | ) 28 | m.add_layer(geojson) 29 | m 30 | 31 | 32 | Attributes 33 | ---------- 34 | 35 | =================== =============== === 36 | Attribute Type Doc 37 | =================== =============== === 38 | data dict GeoJSON Data to be plotted 39 | url string GeoJSON Data URL to be plotted 40 | disable_legacy_mode boolean Disable legacy mode for parsing GeoJSON data. Default value is True 41 | style dict The style to use for rendering GeoJSON data. Example: {'fillColor': 'rgba(245, 176, 65, 0.5)', 'strokeColor': 'black', 'lineWidth': 10, 'lineCap': 'square', lineJoin: 'bevel'} 42 | hover_style dict The style to use for rendering data when hovered over. Example: {'fillColor': 'rgba(245, 176, 65, 0.5)', 'strokeColor': 'black', 'lineWidth': 10} 43 | evt_type string Event type to be used to apply hover_style, please check :ref:`allowed values `, default value is ``tap``. 44 | show_bubble boolean To determine whether to show info bubble for space data or not 45 | style_callback Callable object A callback function which is called for each feature to generate style for the feature 46 | point_style dict The style to use for rendering Points in GeoJSON if not provided default Markers will be used. Example: {"strokeColor": 'white', "lineWidth": 1, "fillColor": "#1b468d", "fillOpacity": 0.7, "radius": 5}, radius should be between 2 to 8. 47 | =================== =============== === 48 | 49 | Methods 50 | ------- 51 | 52 | ========= =============== === 53 | Method Arguments Doc 54 | ========= =============== === 55 | on_click Callable object Adds a callback on click event 56 | on_hover Callable object Adds a callback on hover event 57 | ========= =============== === 58 | -------------------------------------------------------------------------------- /docs/source/api_reference/layer/heatmap.rst: -------------------------------------------------------------------------------- 1 | HeatMap Layer 2 | ============= 3 | 4 | ``Heat Map`` is an ``here-map-widget-for-jupyter`` class that allows you to generate a Heat Map for your data. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from random import uniform 12 | from here_map_widget import TileLayer, HeatMap 13 | from here_map_widget import Map 14 | import os 15 | 16 | data = [[uniform(-80, 80), uniform(-180, 180), uniform(0, 1000)] for i in range(1000)] 17 | 18 | heat_map_data = [] 19 | for row in data: 20 | heat_map_data.append({"lat": row[0], "lng": row[1], "value": row[2]}) 21 | 22 | m = Map(api_key=os.environ["LS_API_KEY"]) 23 | provider = HeatMap(interpolate=True, opacity=0.6, assume_values=True) 24 | provider.add_data(heat_map_data) 25 | heatmap = TileLayer(provider=provider) 26 | m.add_layer(heatmap) 27 | m 28 | 29 | 30 | Attributes 31 | ---------- 32 | 33 | =================== ================= === 34 | Attribute Type Doc 35 | =================== ================= === 36 | colors dict An dict object defining the color stops for example `{'0.0': 'blue', '0.5': 'yellow', '1': 'red'}` 37 | interpolate boolean A value indicating whether interpolation is to be used to display smooth color transitions in the heat map 38 | opacity float The opacity which is used for the rendering of the heatmap in range [0..1] 39 | assume_values boolean A Boolean value indicating whether to paint assumed values in regions where no data is available 40 | data list Data list which is used to generate heat map 41 | hardReload boolean A value indicating whether to invalidate in hard mode (True) or in soft mode (False) while adding data 42 | =================== ================= === 43 | 44 | Methods 45 | ------- 46 | 47 | ========= =============== === 48 | Method Arguments Doc 49 | ========= =============== === 50 | add_data data Data list which is used to generate heat map 51 | clear Clear Heat Map 52 | ========= =============== === 53 | -------------------------------------------------------------------------------- /docs/source/api_reference/layer/kml.rst: -------------------------------------------------------------------------------- 1 | KML Layer 2 | ========== 3 | 4 | ``KML`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize `KML Data 5 | `_ on the Map. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import Map, KML 13 | import os 14 | 15 | m = Map( 16 | api_key=os.environ["LS_API_KEY"], center=[44.20022717941052, -72.75660780639646] 17 | ) 18 | url = ( 19 | "https://heremaps.github.io/maps-api-for-javascript-examples/" 20 | + "display-kml-on-map/data/us-states.kml" 21 | ) 22 | kml = KML(url=url) 23 | m.add_layer(kml) 24 | m 25 | 26 | 27 | Attributes 28 | ---------- 29 | 30 | =================== ================= === 31 | Attribute Type Doc 32 | =================== ================= === 33 | url string KML Data URL to be plotted 34 | =================== ================= === 35 | -------------------------------------------------------------------------------- /docs/source/api_reference/layer/layer.rst: -------------------------------------------------------------------------------- 1 | Layers 2 | ----------- 3 | 4 | These are the various layer types supported by ``here-map-widget-for-jupyter`` 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | geo_json 10 | geodata 11 | xyz 12 | choropleth 13 | kml 14 | heatmap 15 | markercluster -------------------------------------------------------------------------------- /docs/source/api_reference/layer/markercluster.rst: -------------------------------------------------------------------------------- 1 | MarkerCluster Layer 2 | =================== 3 | 4 | Sometimes, you may need to display a large set of data on the map, for example several thousand points. 5 | There are two potential problems you may encounter: one is a possible performance degradation when all the points (markers) are visible 6 | at lower zoom levels, the other is the fact that the markers located in close geographic proximity to one another 7 | may visibly overlap and even hide one another at lower zoom levels. 8 | A solution to both these problems is offered by ``MarkerCluster Layer``. 9 | 10 | 11 | 12 | Example 13 | ------- 14 | 15 | .. jupyter-execute:: 16 | 17 | import os 18 | from here_map_widget import Map, MarkerCluster, ZoomControl, ObjectLayer 19 | 20 | 21 | m = Map(api_key=os.environ["LS_API_KEY"], center=[51.01, 0.01], zoom=7) 22 | 23 | data = """ 24 | 25 | 26 | 27 |

Marker

28 |

{}

29 | 30 | 31 | """ 32 | p1 = dict(lat=51.01, lng=0.01, data=data.format("First Marker")) 33 | p2 = dict(lat=50.04, lng=1.01, data=data.format("Second Marker")) 34 | p3 = dict(lat=51.45, lng=1.01, data=data.format("Third Marker")) 35 | p4 = dict(lat=51.01, lng=2.01, data=data.format("Fourth Marker")) 36 | 37 | provider = MarkerCluster(data_points=[p1, p2, p3, p4], show_bubble=True) 38 | layer = ObjectLayer(provider=provider) 39 | m.add_layer(layer) 40 | zc = ZoomControl(alignment="LEFT_TOP") 41 | m.add_control(zc) 42 | m 43 | 44 | 45 | Attributes of MarkerCluster 46 | --------------------------- 47 | 48 | =================== ================= === 49 | Attribute Type Doc 50 | =================== ================= === 51 | data_points List A list of dictionaries, each dictionary will have keys: ``lat`` for latitude of the point, ``lng`` for longitude of the point, ``data`` for data associated with point which should be HTML string, ``weight`` for weight of the point as a positive number, the default is 1. 52 | eps Int The epsilon parameter for cluster calculations. It must not exceed 256 and must take values that are a power of 2. Default is 32. 53 | min_weight Int The minimum point weight sum to form a cluster, the default is 2. 54 | min_zoom Int The minimum supported zoom level, the default is 0. 55 | max_zoom Int The maximum supported zoom level, the default is 22. 56 | show_bubble Boolean If ``True`` then shows data associated with point as ``InfoBubble``, default is ``False``. 57 | evt_type string The type of event to be used to show ``InfoBubble``. please check :ref:`allowed values `. Default value is ``tap``. 58 | =================== ================= === 59 | -------------------------------------------------------------------------------- /docs/source/api_reference/layer/tile_layer.rst: -------------------------------------------------------------------------------- 1 | ImageTile Layer 2 | =============== 3 | To load tiles from XYZ tile servers like `OpenStreetMap `_ tile servers or WMTS tile servers, ``ImageTileProvider`` is used as a source of data 4 | for TileLayer. 5 | 6 | XYZ Tile server Example 7 | ----------------------- 8 | 9 | .. jupyter-execute:: 10 | 11 | import os 12 | from here_map_widget import Map, ImageTileProvider, TileLayer 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"], center=[39.40, -104.08], zoom=3) 15 | 16 | url = "https://a.tile.openstreetmap.org/{z}/{x}/{y}.png" 17 | attribution = ( 18 | 'Map data (c) OpenStreetMap contributors' 19 | ) 20 | provider = ImageTileProvider(url=url, attribution=attribution) 21 | layer = TileLayer(provider=provider) 22 | m.add_layer(layer) 23 | m 24 | 25 | 26 | WMTS Example 27 | ------------ 28 | 29 | .. jupyter-execute:: 30 | 31 | import os 32 | from here_map_widget import Map, ImageTileProvider, TileLayer 33 | 34 | 35 | m = Map(api_key=os.environ["LS_API_KEY"], center=[39.40, -104.08], zoom=3.66) 36 | 37 | url = "https://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_Density/MapServer/WMTS/?layer=0&style=default&tilematrixset=EPSG%3A4326&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={z}&TileCol={x}&TileRow={y}" 38 | provider = ImageTileProvider(url=url) 39 | layer = TileLayer(provider=provider) 40 | m.add_layer(layer) 41 | m 42 | 43 | 44 | 45 | Attributes 46 | ---------- 47 | 48 | .. csv-table:: 49 | :header: "Attribute", "Type", "Doc" 50 | :widths: 30, 30, 30 51 | 52 | "url", "String", "URL of the Tile server." 53 | "min_zoom", "Int", "Optional, The minimum supported zoom level, the default is 0" 54 | "max_zoom", "Int", "Optional, The maximum supported zoom level, the default is 22" 55 | "opacity", "Float", "Optional, The opacity to use for the rendering of the provided tiles in range [0..1] where 0.0 means full transparent and 1.0 means full opaque." 56 | "tile_size", "Int", "Optional, The size of a tile as edge length in pixels. It must be 2^n where n is in the range [0 ... 30]." 57 | "headers", "Dict", "Optional,A dictionaary of headers to be sent with each request made by the provider." 58 | "attribution", "String", "Optional, Tiles service attribution." 59 | 60 | -------------------------------------------------------------------------------- /docs/source/api_reference/layer/xyz.rst: -------------------------------------------------------------------------------- 1 | XYZ Space Layer 2 | ================ 3 | 4 | ``XYZ`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a `XYZ Space 5 | `_ on the Map. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import TileLayer, XYZ 13 | from here_map_widget import Map 14 | import os 15 | 16 | m = Map(api_key=os.environ["LS_API_KEY"]) 17 | m.zoom = 9 18 | m.center = [44.20022717941052, -72.75660780639646] 19 | 20 | style_flagged = { 21 | "layers.xyz.points.Places": { 22 | "filter": {"properties.GPSFLG": "Flagged for coordinate check"}, 23 | "draw": { 24 | "points": { 25 | "color": "blue", 26 | "text": { 27 | "priority": 0, 28 | "font": { 29 | "size": "12px", 30 | "fill": "red", 31 | "stroke": {"color": "white", "width": "0.5px"}, 32 | }, 33 | }, 34 | } 35 | }, 36 | } 37 | } 38 | 39 | xyz_token = os.environ["XYZ_TOKEN"] 40 | provider = XYZ(space_id="m2pcsiNi", token=xyz_token, show_bubble=True) 41 | space = TileLayer(provider=provider, style=style_flagged) 42 | m.add_layer(space) 43 | m 44 | 45 | 46 | Attributes 47 | ---------- 48 | 49 | =================== ================= === 50 | Attribute Type Doc 51 | =================== ================= === 52 | token string XYZ token to access XYZ space data 53 | space_id string Space id from which to access the data 54 | evt_type string Event on which to show info bubble for space data, please check :ref:`allowed values `, default value is ``tap``. 55 | show_bubble boolean To determine whether to show info bubble for space data or not 56 | style dict/Style object To provide style to for the XYZ space data 57 | platform Platform Optional required only for custom Data Hub endpoints. 58 | =================== ================= === 59 | 60 | Methods 61 | ------- 62 | 63 | ========= =============== === 64 | Method Arguments Doc 65 | ========= =============== === 66 | on_click Callable object Adds a callback on click event 67 | on_hover Callable object Adds a callback on hover event 68 | ========= =============== === 69 | -------------------------------------------------------------------------------- /docs/source/api_reference/object/circle.rst: -------------------------------------------------------------------------------- 1 | Circle Object 2 | ============= 3 | 4 | ``Circle`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a circle on the Map. 5 | Style of object is a dictionary, to get more information on all possible keys of style dictionary, example: {'fillColor': 'rgba(245, 176, 65, 0.5)', 'strokeColor': 'black', 'lineWidth': 10, 'lineCap': 'square', lineJoin: 'bevel'}. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import Map 13 | from here_map_widget import Point, Circle, FullscreenControl 14 | import os 15 | 16 | center = [19.152761, 72.87869] 17 | 18 | m = Map(api_key=os.environ["LS_API_KEY"], center=center, zoom=10) 19 | 20 | style = {"strokeColor": "#829", "lineWidth": 4} 21 | 22 | point = Point(lat=19.152761, lng=72.87869) 23 | circle = Circle(center=point, radius=10000, style=style, draggable=True) 24 | m.add_object(circle) 25 | m.add_control(FullscreenControl()) 26 | m 27 | 28 | Attributes 29 | ---------- 30 | 31 | =================== ================= === 32 | Attribute Type Doc 33 | =================== ================= === 34 | center Point object The geographical coordinates of the center of the circle 35 | radius float The radius of the circle in meters 36 | style dict The style to be used when tracing the polyline (circle) 37 | draggable boolean To make circle draggable 38 | extrusion float The extrusion height for the circle in meters, default is 0 39 | elevation float The elevation height of the circle in meters, default is 0 40 | =================== ================= === 41 | -------------------------------------------------------------------------------- /docs/source/api_reference/object/domicon.rst: -------------------------------------------------------------------------------- 1 | DomIcon Object 2 | ============== 3 | 4 | ``DomIcon`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a marker with a custom DomIcon on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, FullscreenControl, DomMarker, DomIcon 12 | import os 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"]) 15 | m.center = [41.8625, -87.6166] 16 | m.zoom = 15 17 | icon = DomIcon( 18 | element='
\ 19 |
C
\ 22 |
' 23 | ) 24 | marker = DomMarker(lat=41.8625, lng=-87.6166, icon=icon) 25 | m.add_object(marker) 26 | m 27 | 28 | 29 | Attributes 30 | ---------- 31 | 32 | =================== ================= === 33 | Attribute Type Doc 34 | =================== ================= === 35 | element string The element or markup to use for this icon 36 | =================== ================= === 37 | -------------------------------------------------------------------------------- /docs/source/api_reference/object/dommarker.rst: -------------------------------------------------------------------------------- 1 | DomMarker Object 2 | ================ 3 | 4 | ``DomMarker`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a DomIcon on the Map. A marker which supports HTML (and SVG) content, which can be dynamic. Markers of this type are best displayed individually or in small sets. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, FullscreenControl, DomMarker, DomIcon 12 | import os 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"]) 15 | m.center = [41.8625, -87.6166] 16 | m.zoom = 15 17 | icon = DomIcon( 18 | element='
\ 19 |
C
\ 22 |
' 23 | ) 24 | marker = DomMarker(lat=41.8625, lng=-87.6166, icon=icon) 25 | m.add_object(marker) 26 | m 27 | 28 | Attributes 29 | ---------- 30 | 31 | =================== ================= === 32 | Attribute Type Doc 33 | =================== ================= === 34 | lat float Latitude for the marker to be added 35 | lng float The element or markup to use for this icon 36 | alt float Altitude for the marker to be added, default value is 0 37 | icon DomIcon object DomIcon object to be added as marker 38 | =================== ================= === 39 | -------------------------------------------------------------------------------- /docs/source/api_reference/object/group.rst: -------------------------------------------------------------------------------- 1 | Group Object 2 | ============ 3 | 4 | ``Group`` is an ``here-map-widget-for-jupyter`` class that is a container for other map objects. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import LineString, Polyline, Marker, Group 12 | from here_map_widget import Map, Bbox, Rectangle, Point, Circle, LineString, Polygon 13 | import os 14 | 15 | m = Map(api_key=os.environ["LS_API_KEY"], center=[51.1657, 10.4515]) 16 | 17 | # Polyline 18 | plstyle = {"lineWidth": 15} 19 | l = [53.3477, -6.2597, 0, 51.5008, -0.1224, 0, 48.8567, 2.3508, 0, 52.5166, 13.3833, 0] 20 | ls = LineString(points=l) 21 | pl = Polyline(object=ls, style=plstyle, draggable=True) 22 | 23 | 24 | # Rectangle 25 | rstyle = {"strokeColor": "#829", "lineWidth": 4} 26 | bbox = Bbox(top=53.1, left=13.1, bottom=43.1, right=40.1) 27 | rectangle = Rectangle(bbox=bbox, style=rstyle, draggable=True) 28 | 29 | 30 | # Circle 31 | point = Point(lat=51.1657, lng=10.4515) 32 | cstyle = {"strokeColor": "#829", "lineWidth": 4} 33 | circle = Circle(center=point, radius=1000000, style=cstyle, draggable=True) 34 | 35 | 36 | # Polygon 37 | pgstyle = {"strokeColor": "#829", "lineWidth": 4} 38 | 39 | l = [52, 13, 100, 48, 2, 100, 48, 16, 100, 52, 13, 100] 40 | 41 | ls = LineString(points=l) 42 | 43 | pg = Polygon(object=ls, style=pgstyle, draggable=True) 44 | 45 | 46 | marker = Marker(lat=51.1657, lng=10.4515, evt_type="tap", draggable=True) 47 | 48 | # Group 49 | group = Group(volatility=True) 50 | 51 | group.add_objects([pl, rectangle, circle, pg, marker]) 52 | 53 | m.add_object(group) 54 | m 55 | 56 | 57 | Attributes 58 | ---------- 59 | 60 | =================== ================= === 61 | Attribute Type Doc 62 | =================== ================= === 63 | volatility boolean Indicates whether the map object is volatile, the default is false 64 | =================== ================= === 65 | 66 | 67 | Methods 68 | ------- 69 | 70 | ============== ================ === 71 | Method Arguments Doc 72 | ============== ================ === 73 | add_object Object Add object to the group 74 | add_objects List of Objects Add objects to the group 75 | remove_object Object Remove object from the group 76 | remove_objects List of Objects Remove objects from the group 77 | ============== ================ === -------------------------------------------------------------------------------- /docs/source/api_reference/object/icon.rst: -------------------------------------------------------------------------------- 1 | Icon Object 2 | =========== 3 | 4 | ``Icon`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a marker with a custom Icon on the Map. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, Marker, WKT, Icon 12 | import os 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"], zoom=12) 15 | m.center = [19.1663, 72.8526] 16 | svg_markup = ( 17 | '' 19 | + 'M' 23 | ) 24 | 25 | svg_icon = Icon(bitmap=svg_markup, height=30, width=30) 26 | 27 | mumbai_marker = Marker(lat=19.1663, lng=72.8526, icon=svg_icon) 28 | m.add_object(mumbai_marker) 29 | m 30 | 31 | 32 | Attributes 33 | ---------- 34 | 35 | =================== ================= === 36 | Attribute Type Doc 37 | =================== ================= === 38 | bitmap string An image URL, an SVG (string), an bitmap image or a canvas 39 | height float Height of the icon 40 | width float Width of the icon 41 | anchor dict The anchor point in pixels, the default is bottom-center 42 | =================== ================= === 43 | -------------------------------------------------------------------------------- /docs/source/api_reference/object/marker.rst: -------------------------------------------------------------------------------- 1 | Marker Object 2 | ============= 3 | 4 | ``Marker`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize an icon on the Map. A "normal" marker that uses a static image as an icon. Large numbers of markers of this types can be added to the map very quickly and efficiently. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, Marker, WKT, Icon 12 | import os 13 | 14 | m = Map(api_key=os.environ["LS_API_KEY"], zoom=12) 15 | m.center = [19.1663, 72.8526] 16 | svg_markup = ( 17 | '' 19 | + 'M' 23 | ) 24 | 25 | svg_icon = Icon(bitmap=svg_markup, height=30, width=30) 26 | 27 | mumbai_marker = Marker(lat=19.1663, lng=72.8526, icon=svg_icon) 28 | m.add_object(mumbai_marker) 29 | m 30 | 31 | 32 | Attributes 33 | ---------- 34 | 35 | =================== ================= === 36 | Attribute Type Doc 37 | =================== ================= === 38 | lat float Latitude for the marker to be added 39 | lng float The element or markup to use for this icon 40 | alt float Altitude for the marker to be added, default value is 0 41 | data string Optional arbitrary data to be stored with the given map object 42 | draggable boolean To make Marker draggable 43 | evt_type string Event type on which info bubble is showed, please check :ref:`allowed values `, default value is `tap` 44 | show_bubble boolean To determine whether to show info bubble for marker or not 45 | object WKT object A WKT object to set position of Marker 46 | info InfoBubble object A InfoBubble object which is set for the Marker 47 | icon Icon object A Icon object which is set for the Marker 48 | =================== ================= === 49 | -------------------------------------------------------------------------------- /docs/source/api_reference/object/object.rst: -------------------------------------------------------------------------------- 1 | Objects 2 | ----------- 3 | 4 | These are the various object types supported by ``here-map-widget-for-jupyter`` 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | circle 10 | domicon 11 | dommarker 12 | group 13 | icon 14 | marker 15 | overlay 16 | polygon 17 | polyline 18 | rectangle -------------------------------------------------------------------------------- /docs/source/api_reference/object/overlay.rst: -------------------------------------------------------------------------------- 1 | Overlay Object 2 | ============== 3 | 4 | ``Overlay`` is an ``here-map-widget-for-jupyter`` class that allows you to visual a rectangular area on a Map in the form of a bitmap. 5 | 6 | Example 7 | ------- 8 | 9 | .. jupyter-execute:: 10 | 11 | from here_map_widget import Map, Overlay, Rectangle, Bbox, FullscreenControl 12 | from ipywidgets import Image 13 | import os 14 | 15 | m = Map(api_key=os.environ["LS_API_KEY"]) 16 | m.center = [53.1, 13.1] 17 | m.zoom = 3 18 | bbox = Bbox( 19 | top=70.72849153520343, 20 | left=-24.085683364175395, 21 | bottom=29.569664922291, 22 | right=44.216452317817016, 23 | ) 24 | 25 | overlay = Overlay( 26 | boundingBox=bbox, 27 | bitmap="https://heremaps.github.io/" 28 | + "maps-api-for-javascript-examples/image-overlay/data/0.png", 29 | volatility=True, 30 | ) 31 | m.add_object(overlay) 32 | m.add_control(FullscreenControl()) 33 | m 34 | 35 | 36 | Attributes 37 | ---------- 38 | 39 | =================== ================= === 40 | Attribute Type Doc 41 | =================== ================= === 42 | content string Optional arbitrary data to be stored with the map overlay 43 | boundingBox Bbox object A rectangular area of the overlay defined in terms of the geographical coordinates of its top-left and bottom-right corners 44 | bitmap string An image URL, an SVG image (markup), a bitmap image or a canvas 45 | min float The minimum zoom level at which the object is visible, the default is -Infinity 46 | max float The maximum zoom level at which the object is visible, the default is Infinity 47 | opacity float The opacity of the object in range from 0 (transparent) to 1 (opaque), the default is 1 48 | visibility boolean Indicates whether the map object is visible, the default is True 49 | volatility boolean Indicates whether the map object is volatile, the default is False 50 | =================== ================= === 51 | 52 | Methods 53 | ------- 54 | 55 | ========== =============== === 56 | Method Arguments Doc 57 | ========== =============== === 58 | set_bitmap string Set bitmap for Overlay 59 | ========== =============== === 60 | -------------------------------------------------------------------------------- /docs/source/api_reference/object/polygon.rst: -------------------------------------------------------------------------------- 1 | Polygon Object 2 | ============== 3 | 4 | ``Polygon`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize LineString, WKT, GeoPolygon and GeoMultiPolygon as Polygon on the Map. 5 | Style of object is a dictionary, to get more information on all possible keys of style dictionary example: {'fillColor': 'rgba(245, 176, 65, 0.5)', 'strokeColor': 'black', 'lineWidth': 10, 'lineCap': 'square', lineJoin: 'bevel'}. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import Map, GeoPolygon, LineString, Polygon 13 | import os 14 | 15 | center = [51.1657, 10.4515] 16 | 17 | l = [52, 13, 100, 48, 2, 100, 48, 16, 100, 52, 13, 100] 18 | 19 | ls = LineString(points=l) 20 | 21 | gpg = GeoPolygon(linestring=ls) 22 | 23 | style = {"strokeColor": "#829", "lineWidth": 4} 24 | 25 | obj = Polygon(object=gpg, style=style, draggable=False) 26 | 27 | m = Map(api_key=os.environ["LS_API_KEY"], center=center) 28 | 29 | m.add_object(obj) 30 | m 31 | 32 | 33 | Attributes 34 | ---------- 35 | 36 | =================== ============================================================ === 37 | Attribute Type Doc 38 | =================== ============================================================ === 39 | object object of LineString or WKT or GeoPolygon or GeoMultiPolygon The geometry that defines the surface of the polygon 40 | style dict The style to be used when tracing the spatial object 41 | draggable boolean To make a draggable polygon 42 | extrusion float The extrusion height for the polygon in meters, default is 0 43 | elevation float The elevation height of the polygon in meters, default is 0 44 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/object/polyline.rst: -------------------------------------------------------------------------------- 1 | Polyline Object 2 | =============== 3 | 4 | ``Polyline`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a LineString, MultiLineString and WKT as Line on the Map. 5 | Style of object is a dictionary, to get more information on all possible keys of style dictionary, example: {'fillColor': 'rgba(245, 176, 65, 0.5)', 'strokeColor': 'black', 'lineWidth': 10, 'lineCap': 'square', lineJoin: 'bevel'}. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import LineString, Polyline 13 | from here_map_widget import Map 14 | import os 15 | 16 | m = Map(api_key=os.environ["LS_API_KEY"]) 17 | m.center = [51.1657, 10.4515] 18 | style = {"lineWidth": 15} 19 | l = [53.3477, -6.2597, 0, 51.5008, -0.1224, 0, 48.8567, 2.3508, 0, 52.5166, 13.3833, 0] 20 | ls = LineString(points=l) 21 | pl = Polyline(object=ls, style=style) 22 | m.add_object(pl) 23 | m 24 | 25 | 26 | Attributes 27 | ---------- 28 | 29 | =================== ============================================================ === 30 | Attribute Type Doc 31 | =================== ============================================================ === 32 | object object of LineString or WKT or MultiLineString The geometry that defines the line segments of the polyline 33 | style dict The style to be used when tracing the polyline 34 | draggable boolean To make a draggable polyline 35 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/api_reference/object/rectangle.rst: -------------------------------------------------------------------------------- 1 | Rectangle Object 2 | ================ 3 | 4 | ``Rectangle`` is an ``here-map-widget-for-jupyter`` class that allows you to visualize a Bounding Box as Rectangle on the Map. 5 | Style of object is a dictionary, to get more information on all possible keys of style dictionary, example: {'fillColor': 'rgba(245, 176, 65, 0.5)', 'strokeColor': 'black', 'lineWidth': 10, 'lineCap': 'square', lineJoin: 'bevel'}. 6 | 7 | Example 8 | ------- 9 | 10 | .. jupyter-execute:: 11 | 12 | from here_map_widget import Map 13 | from here_map_widget import Bbox, Rectangle 14 | import os 15 | 16 | center = [46.017618898512374, 23.91982511231513] 17 | 18 | m = Map(api_key=os.environ["LS_API_KEY"], center=center, zoom=3) 19 | 20 | style = {"strokeColor": "#829", "lineWidth": 4} 21 | 22 | bbox = Bbox(top=53.1, left=13.1, bottom=43.1, right=40.1) 23 | rectangle = Rectangle(bbox=bbox, style=style, draggable=True) 24 | m.add_object(rectangle) 25 | m 26 | 27 | 28 | Attributes 29 | ---------- 30 | 31 | =================== ============================================================ === 32 | Attribute Type Doc 33 | =================== ============================================================ === 34 | bbox object of Bbox The geographical bounding box for the rectangle 35 | style dict The style to be used when tracing the spatial object 36 | draggable boolean To make a draggable rectangle 37 | extrusion float The extrusion height for the rectangle in meters, default is 0 38 | elevation float The elevation height of the rectangle in meters, default is 0 39 | =================== ============================================================ === -------------------------------------------------------------------------------- /docs/source/changelog.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../CHANGELOG.rst 2 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | import sphinx_rtd_theme 2 | 3 | extensions = [ 4 | "jupyter_sphinx", 5 | ] 6 | 7 | templates_path = ["_templates"] 8 | 9 | 10 | def setup(app): 11 | app.add_css_file("main_stylesheet.css") 12 | 13 | 14 | master_doc = "index" 15 | source_suffix = ".rst" 16 | 17 | # General information about the project. 18 | project = "HERE Map Widget for Jupyter" 19 | copyright = "Copyright (C) 2019-2024 HERE Europe B.V." 20 | author = "HERE Europe B.V." 21 | 22 | exclude_patterns = [] 23 | highlight_language = "python" 24 | pygments_style = "sphinx" 25 | 26 | # Output file base name for HTML help builder. 27 | html_theme = "sphinx_rtd_theme" 28 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 29 | htmlhelp_basename = "here-map-widget-for-jupyter-doc" 30 | html_static_path = ["_static"] 31 | 32 | # PDf Output 33 | # pdf_documents = [('index', u'rst2pdf', u'Sample rst2pdf doc', u'Your Name'),] 34 | -------------------------------------------------------------------------------- /docs/source/gettingstarted.rst: -------------------------------------------------------------------------------- 1 | Getting Started 2 | ================ 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | prerequisites 8 | installation -------------------------------------------------------------------------------- /docs/source/installation.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: sh 2 | 3 | Installation 4 | ============ 5 | 6 | Install HERE Map Widget for Jupyter with conda from the Anaconda `conda-forge channel `_ using the below command:: 7 | 8 | $ conda install -c conda-forge here-map-widget-for-jupyter 9 | 10 | Install HERE Map Widget for Jupyter from `PyPI `_ using the below command:: 11 | 12 | $ pip install here-map-widget-for-jupyter 13 | 14 | Below extra commands are required only if you are using classic Jupyter Notebook (version 5.3 or older):: 15 | 16 | $ jupyter nbextension install --py --sys-prefix here_map_widget 17 | $ jupyter nbextension enable here_map_widget --py --sys-prefix 18 | 19 | Below extra commands are required only if you are using JupyterLab (version 2 or older):: 20 | 21 | $ npm config set @here:registry https://repo.platform.here.com/artifactory/api/npm/here-node/ 22 | $ jupyter labextension install @jupyter-widgets/jupyterlab-manager @here/map-widget-for-jupyter 23 | 24 | 25 | Installation from source repository on GitHub 26 | --------------------------------------------- 27 | 28 | For a development installation (requires yarn, you can install it with ``conda install -c conda-forge yarn``):: 29 | 30 | $ git clone https://github.com/heremaps/here-map-widget-for-jupyter.git 31 | $ cd here-map-widget-for-jupyter 32 | $ pip install -e . 33 | 34 | If you are using the classic Jupyter Notebook you need to install the nbextension:: 35 | 36 | $ jupyter nbextension install --py --sys-prefix here_map_widget 37 | $ jupyter nbextension enable here_map_widget --py --sys-prefix 38 | 39 | 40 | Note for developers: 41 | 42 | - the ``-e`` pip option allows one to modify the Python code in-place. Restart the kernel in order to see the changes. 43 | - the ``--symlink`` argument on Linux or OS X allows one to modify the JavaScript code in-place. This feature is not available with Windows. 44 | 45 | For developing with JupyterLab:: 46 | 47 | $ jupyter labextension develop --overwrite here_map_widget 48 | -------------------------------------------------------------------------------- /docs/source/prerequisites.rst: -------------------------------------------------------------------------------- 1 | Prerequisites 2 | ============= 3 | 4 | Before you install the ``here-map-widget-for-jupyter`` make sure you meet the following prerequisites: 5 | 6 | - A Python installation, 3.6+ recommended, with the ``pip`` command available to install dependencies. 7 | - A HERE developer account, freely available under `HERE Developer Portal`_. 8 | - An `API key`_ from the `HERE Developer Portal`_. 9 | 10 | .. _API key: https://developer.here.com/documentation/identity-access-management/dev_guide/topics/dev-apikey.html 11 | .. _HERE Developer Portal: https://developer.here.com/ -------------------------------------------------------------------------------- /docs/source/referenceguide.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 1 3 | 4 | changelog 5 | -------------------------------------------------------------------------------- /examples/circle.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from here_map_widget import Map\n", 31 | "from here_map_widget import Point, Circle\n", 32 | "import os\n", 33 | "\n", 34 | "center = [19.152761, 72.87869]\n", 35 | "\n", 36 | "m = Map(api_key=os.environ[\"LS_API_KEY\"], center=center, zoom=10)\n", 37 | "\n", 38 | "style = {\"strokeColor\": \"#829\", \"lineWidth\": 4}\n", 39 | "\n", 40 | "point = Point(lat=19.152761, lng=72.87869)\n", 41 | "circle = Circle(center=point, radius=10000, style=style, draggable=True)\n", 42 | "m.add_object(circle)\n", 43 | "m" 44 | ] 45 | } 46 | ], 47 | "metadata": { 48 | "kernelspec": { 49 | "display_name": "Python 3", 50 | "language": "python", 51 | "name": "python3" 52 | }, 53 | "language_info": { 54 | "codemirror_mode": { 55 | "name": "ipython", 56 | "version": 3 57 | }, 58 | "file_extension": ".py", 59 | "mimetype": "text/x-python", 60 | "name": "python", 61 | "nbconvert_exporter": "python", 62 | "pygments_lexer": "ipython3", 63 | "version": "3.7.9" 64 | } 65 | }, 66 | "nbformat": 4, 67 | "nbformat_minor": 4 68 | } 69 | -------------------------------------------------------------------------------- /examples/custom_icons.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from here_map_widget import Map, Marker, WKT, Icon\n", 31 | "import os\n", 32 | "\n", 33 | "m = Map(api_key=os.environ[\"LS_API_KEY\"], zoom=12)\n", 34 | "m.center = [19.1663, 72.8526]\n", 35 | "m" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": null, 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [ 44 | "# Svg Icon example\n", 45 | "\n", 46 | "svg_markup = (\n", 47 | " ''\n", 49 | " + 'M'\n", 53 | ")\n", 54 | "\n", 55 | "svg_icon = Icon(bitmap=svg_markup, height=30, width=30)\n", 56 | "\n", 57 | "mumbai_marker = Marker(lat=19.1663, lng=72.8526, icon=svg_icon)\n", 58 | "m.add_object(mumbai_marker)" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": null, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [ 67 | "m.remove_object(mumbai_marker)" 68 | ] 69 | } 70 | ], 71 | "metadata": { 72 | "kernelspec": { 73 | "display_name": "Python 3", 74 | "language": "python", 75 | "name": "python3" 76 | }, 77 | "language_info": { 78 | "codemirror_mode": { 79 | "name": "ipython", 80 | "version": 3 81 | }, 82 | "file_extension": ".py", 83 | "mimetype": "text/x-python", 84 | "name": "python", 85 | "nbconvert_exporter": "python", 86 | "pygments_lexer": "ipython3", 87 | "version": "3.7.9" 88 | } 89 | }, 90 | "nbformat": 4, 91 | "nbformat_minor": 4 92 | } 93 | -------------------------------------------------------------------------------- /examples/custom_marker_icon.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from here_map_widget import Marker, Icon\n", 31 | "\n", 32 | "center = [40.82859218023296, -73.89739292971197]\n", 33 | "i = Icon(bitmap=\"marker_image.png\", height=60, width=60)\n", 34 | "marker = Marker(lat=center[0], lng=center[1], icon=i)" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": null, 40 | "metadata": {}, 41 | "outputs": [], 42 | "source": [ 43 | "from here_map_widget import Map\n", 44 | "import os\n", 45 | "\n", 46 | "m = Map(\n", 47 | " api_key=os.environ[\"LS_API_KEY\"],\n", 48 | " center=center,\n", 49 | " zoom=17.84,\n", 50 | " tilt=51.03,\n", 51 | " heading=163.63,\n", 52 | ")\n", 53 | "m.add_object(marker)\n", 54 | "m" 55 | ] 56 | } 57 | ], 58 | "metadata": { 59 | "kernelspec": { 60 | "display_name": "Python 3", 61 | "language": "python", 62 | "name": "python3" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": { 66 | "name": "ipython", 67 | "version": 3 68 | }, 69 | "file_extension": ".py", 70 | "mimetype": "text/x-python", 71 | "name": "python", 72 | "nbconvert_exporter": "python", 73 | "pygments_lexer": "ipython3", 74 | "version": "3.7.9" 75 | } 76 | }, 77 | "nbformat": 4, 78 | "nbformat_minor": 4 79 | } 80 | -------------------------------------------------------------------------------- /examples/datahub_space_style.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key and XYZ access token. \n", 9 | " Please see README.md for more info on API key and XYZ access token.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here.\n", 22 | "os.environ[\"XYZ_TOKEN\"] = \"MY-XYZ-TOKEN\" # replace your XYZ access token here." 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "# Create a normal map view\n", 32 | "from here_map_widget import TileLayer, XYZ\n", 33 | "from here_map_widget import Map\n", 34 | "import os\n", 35 | "\n", 36 | "m = Map(api_key=os.environ[\"LS_API_KEY\"])\n", 37 | "m.center = [44.20022717941052, -72.75660780639646]" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": null, 43 | "metadata": {}, 44 | "outputs": [], 45 | "source": [ 46 | "with open(\"xyz_style.yaml\") as fh:\n", 47 | " config = fh.read()" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [ 56 | "from here_map_widget import Style\n", 57 | "\n", 58 | "st = Style(config=config)\n", 59 | "\n", 60 | "xyz_token = os.environ[\"XYZ_TOKEN\"]\n", 61 | "provider = XYZ(space_id=\"m2pcsiNi\", token=xyz_token, show_bubble=True, style=st)\n", 62 | "space = TileLayer(provider=provider)\n", 63 | "m.add_layer(space)\n", 64 | "m" 65 | ] 66 | } 67 | ], 68 | "metadata": { 69 | "kernelspec": { 70 | "display_name": "Python 3", 71 | "language": "python", 72 | "name": "python3" 73 | }, 74 | "language_info": { 75 | "codemirror_mode": { 76 | "name": "ipython", 77 | "version": 3 78 | }, 79 | "file_extension": ".py", 80 | "mimetype": "text/x-python", 81 | "name": "python", 82 | "nbconvert_exporter": "python", 83 | "pygments_lexer": "ipython3", 84 | "version": "3.7.9" 85 | } 86 | }, 87 | "nbformat": 4, 88 | "nbformat_minor": 4 89 | } 90 | -------------------------------------------------------------------------------- /examples/dom_marker.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from here_map_widget import Map, FullscreenControl, DomMarker, DomIcon\n", 31 | "import os\n", 32 | "\n", 33 | "m = Map(api_key=os.environ[\"LS_API_KEY\"], center=[41.8625, -87.6166], zoom=15)\n", 34 | "\n", 35 | "icon = DomIcon(\n", 36 | " element='
\\\n", 37 | "
C
\\\n", 38 | "
'\n", 39 | ")\n", 40 | "marker = DomMarker(lat=41.8625, lng=-87.6166, icon=icon)\n", 41 | "m.add_object(marker)\n", 42 | "m" 43 | ] 44 | } 45 | ], 46 | "metadata": { 47 | "kernelspec": { 48 | "display_name": "Python 3", 49 | "language": "python", 50 | "name": "python3" 51 | }, 52 | "language_info": { 53 | "codemirror_mode": { 54 | "name": "ipython", 55 | "version": 3 56 | }, 57 | "file_extension": ".py", 58 | "mimetype": "text/x-python", 59 | "name": "python", 60 | "nbconvert_exporter": "python", 61 | "pygments_lexer": "ipython3", 62 | "version": "3.7.9" 63 | } 64 | }, 65 | "nbformat": 4, 66 | "nbformat_minor": 4 67 | } 68 | -------------------------------------------------------------------------------- /examples/forest_fire_analysis.py: -------------------------------------------------------------------------------- 1 | def _get_count_features(feature, forest_space, country_forest_count_list): 2 | geometry = feature["geometry"] 3 | count = 0 4 | # Using Data Hub spatial search using geometry 5 | for _ in forest_space.spatial_search_geometry(data=geometry): 6 | count += 1 7 | feature["properties"]["fire_count"] = count 8 | country_forest_count_list.append(feature) 9 | return str(count) + " " + feature["properties"]["name"] 10 | -------------------------------------------------------------------------------- /examples/geodata.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "import geopandas\n", 31 | "import json\n", 32 | "from here_map_widget import Map, GeoData, FullscreenControl\n", 33 | "import os\n", 34 | "\n", 35 | "rivers = geopandas.read_file(\n", 36 | " \"https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_rivers_lake_centerlines.zip\"\n", 37 | ")\n", 38 | "\n", 39 | "m = Map(center=(52.3, 8.0), zoom=3, api_key=os.environ[\"LS_API_KEY\"])\n", 40 | "\n", 41 | "rivers_data = GeoData(\n", 42 | " geo_dataframe=rivers,\n", 43 | " style={\"strokeColor\": \"rgba(128,0,128,1)\"},\n", 44 | " hover_style={\"strokeColor\": \"rgba(255,0,0,1)\"},\n", 45 | " name=\"Rivers\",\n", 46 | ")\n", 47 | "\n", 48 | "m.add_layer(rivers_data)\n", 49 | "m.add_control(FullscreenControl())\n", 50 | "m" 51 | ] 52 | } 53 | ], 54 | "metadata": { 55 | "kernelspec": { 56 | "display_name": "Python 3", 57 | "language": "python", 58 | "name": "python3" 59 | }, 60 | "language_info": { 61 | "codemirror_mode": { 62 | "name": "ipython", 63 | "version": 3 64 | }, 65 | "file_extension": ".py", 66 | "mimetype": "text/x-python", 67 | "name": "python", 68 | "nbconvert_exporter": "python", 69 | "pygments_lexer": "ipython3", 70 | "version": "3.7.9" 71 | } 72 | }, 73 | "nbformat": 4, 74 | "nbformat_minor": 4 75 | } 76 | -------------------------------------------------------------------------------- /examples/geojson_point_style.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "surprised-burden", 6 | "metadata": {}, 7 | "source": [ 8 | "
\n", 9 | "Warning: Before running below cells please make sure you have API key. \n", 10 | " Please see README.md for more info on API key.\n", 11 | "
" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "id": "identical-raise", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "import os\n", 22 | "import requests\n", 23 | "\n", 24 | "from here_map_widget import Map, GeoJSON" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": null, 30 | "id": "demanding-making", 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": null, 40 | "id": "double-springer", 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [ 44 | "url = \"http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_month.geojson\"\n", 45 | "earthquakes = requests.get(url).json()" 46 | ] 47 | }, 48 | { 49 | "cell_type": "code", 50 | "execution_count": null, 51 | "id": "accessible-crest", 52 | "metadata": {}, 53 | "outputs": [], 54 | "source": [ 55 | "m = Map(api_key=os.environ[\"LS_API_KEY\"])\n", 56 | "\n", 57 | "point_style = {\n", 58 | " \"strokeColor\": \"white\",\n", 59 | " \"lineWidth\": 1,\n", 60 | " \"fillColor\": \"red\",\n", 61 | " \"fillOpacity\": 0.7,\n", 62 | " \"radius\": 5,\n", 63 | "}\n", 64 | "\n", 65 | "geo_layer = GeoJSON(data=earthquakes, show_bubble=True, point_style=point_style)\n", 66 | "\n", 67 | "m.add_layer(geo_layer)\n", 68 | "m" 69 | ] 70 | } 71 | ], 72 | "metadata": { 73 | "kernelspec": { 74 | "display_name": "Python 3", 75 | "language": "python", 76 | "name": "python3" 77 | }, 78 | "language_info": { 79 | "codemirror_mode": { 80 | "name": "ipython", 81 | "version": 3 82 | }, 83 | "file_extension": ".py", 84 | "mimetype": "text/x-python", 85 | "name": "python", 86 | "nbconvert_exporter": "python", 87 | "pygments_lexer": "ipython3", 88 | "version": "3.8.8" 89 | } 90 | }, 91 | "nbformat": 4, 92 | "nbformat_minor": 5 93 | } 94 | -------------------------------------------------------------------------------- /examples/image_overlay.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from here_map_widget import Map, Overlay, Rectangle, Bbox, FullscreenControl\n", 31 | "from ipywidgets import Image\n", 32 | "import os\n", 33 | "\n", 34 | "m = Map(api_key=os.environ[\"LS_API_KEY\"])\n", 35 | "m.center = [53.1, 13.1]\n", 36 | "m.zoom = 3\n", 37 | "bbox = Bbox(\n", 38 | " top=70.72849153520343,\n", 39 | " left=-24.085683364175395,\n", 40 | " bottom=29.569664922291,\n", 41 | " right=44.216452317817016,\n", 42 | ")\n", 43 | "\n", 44 | "overlay = Overlay(\n", 45 | " boundingBox=bbox,\n", 46 | " bitmap=\"https://heremaps.github.io/maps-api-for-javascript-examples/image-overlay/data/0.png\",\n", 47 | " volatility=True,\n", 48 | ")\n", 49 | "m.add_object(overlay)\n", 50 | "m.add_control(FullscreenControl())\n", 51 | "m" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": null, 57 | "metadata": {}, 58 | "outputs": [], 59 | "source": [ 60 | "import time\n", 61 | "\n", 62 | "i = 0\n", 63 | "while True:\n", 64 | " overlay.set_bitmap(\n", 65 | " \"https://heremaps.github.io/maps-api-for-javascript-examples/image-overlay/data/{}.png\".format(\n", 66 | " i\n", 67 | " )\n", 68 | " )\n", 69 | " i = i + 1\n", 70 | " if i == 11:\n", 71 | " i = 0\n", 72 | " time.sleep(0.25)" 73 | ] 74 | } 75 | ], 76 | "metadata": { 77 | "kernelspec": { 78 | "display_name": "Python 3", 79 | "language": "python", 80 | "name": "python3" 81 | }, 82 | "language_info": { 83 | "codemirror_mode": { 84 | "name": "ipython", 85 | "version": 3 86 | }, 87 | "file_extension": ".py", 88 | "mimetype": "text/x-python", 89 | "name": "python", 90 | "nbconvert_exporter": "python", 91 | "pygments_lexer": "ipython3", 92 | "version": "3.7.9" 93 | } 94 | }, 95 | "nbformat": 4, 96 | "nbformat_minor": 4 97 | } 98 | -------------------------------------------------------------------------------- /examples/india_district.json.license: -------------------------------------------------------------------------------- 1 | The dataset is shared under Creative Commons Attribution 2.5 India license. 2 | https://creativecommons.org/licenses/by/2.5/in/ 3 | -------------------------------------------------------------------------------- /examples/interactive_map_layer.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "id": "electoral-minutes", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "from here_map_widget import TileLayer, FullscreenControl, IML\n", 11 | "from here_map_widget import Map\n", 12 | "import os\n", 13 | "\n", 14 | "m = Map(api_key=os.environ.get(\"LS_API_KEY\"), center=[38.90192, -76.97605], zoom=12)\n", 15 | "provider = IML(catalog_hrn=\"hrn:here:data::olp-here:dh-showcase-dc-transit\", layer_id=\"dc-transit\")\n", 16 | "space_layer = TileLayer(provider=provider)\n", 17 | "m.add_layer(space_layer)\n", 18 | "fc = FullscreenControl()\n", 19 | "m.add_control(fc)\n", 20 | "m" 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.8.8" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 5 45 | } 46 | -------------------------------------------------------------------------------- /examples/japan_data.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "# Add Japan OMV data as basemap\n", 31 | "\n", 32 | "from here_map_widget import Map, OMV, Platform, Style, TileLayer\n", 33 | "from here_map_widget import ServiceNames, OMVUrl\n", 34 | "import os" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": null, 40 | "metadata": {}, 41 | "outputs": [], 42 | "source": [ 43 | "services_config = {\n", 44 | " ServiceNames.omv: {\n", 45 | " OMVUrl.scheme: \"https\",\n", 46 | " OMVUrl.host: \"vector.hereapi.com\",\n", 47 | " OMVUrl.path: \"/v2/vectortiles/core/mc\",\n", 48 | " }\n", 49 | "}\n", 50 | "\n", 51 | "platform = Platform(api_key=os.environ[\"LS_API_KEY\"], services_config=services_config)\n", 52 | "\n", 53 | "style = Style(\n", 54 | " config=\"https://js.api.here.com/v3/3.1/styles/omv/oslo/japan/normal.day.yaml\",\n", 55 | " base_url=\"https://js.api.here.com/v3/3.1/styles/omv/oslo/japan/\",\n", 56 | ")\n", 57 | "\n", 58 | "omv_provider = OMV(path=\"v2/vectortiles/core/mc\", platform=platform, style=style)\n", 59 | "\n", 60 | "omv_layer = TileLayer(provider=omv_provider, style={\"max\": 22})\n", 61 | "\n", 62 | "center = [35.68026, 139.76744]\n", 63 | "m = Map(api_key=os.environ[\"LS_API_KEY\"], center=center, zoom=8, basemap=omv_layer)\n", 64 | "m" 65 | ] 66 | } 67 | ], 68 | "metadata": { 69 | "kernelspec": { 70 | "display_name": "Python 3", 71 | "language": "python", 72 | "name": "python3" 73 | }, 74 | "language_info": { 75 | "codemirror_mode": { 76 | "name": "ipython", 77 | "version": 3 78 | }, 79 | "file_extension": ".py", 80 | "mimetype": "text/x-python", 81 | "name": "python", 82 | "nbconvert_exporter": "python", 83 | "pygments_lexer": "ipython3", 84 | "version": "3.7.9" 85 | } 86 | }, 87 | "nbformat": 4, 88 | "nbformat_minor": 4 89 | } 90 | -------------------------------------------------------------------------------- /examples/kml.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "# Create a normal map view\n", 31 | "from here_map_widget import Map\n", 32 | "import os\n", 33 | "\n", 34 | "m = Map(api_key=os.environ[\"LS_API_KEY\"], center=[44.20022717941052, -72.75660780639646])\n", 35 | "m" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": null, 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [ 44 | "from here_map_widget import KML\n", 45 | "\n", 46 | "kml = KML(\n", 47 | " url=\"https://heremaps.github.io/maps-api-for-javascript-examples/display-kml-on-map/data/us-states.kml\"\n", 48 | ")\n", 49 | "\n", 50 | "m.add_layer(kml)" 51 | ] 52 | } 53 | ], 54 | "metadata": { 55 | "kernelspec": { 56 | "display_name": "Python 3", 57 | "language": "python", 58 | "name": "python3" 59 | }, 60 | "language_info": { 61 | "codemirror_mode": { 62 | "name": "ipython", 63 | "version": 3 64 | }, 65 | "file_extension": ".py", 66 | "mimetype": "text/x-python", 67 | "name": "python", 68 | "nbconvert_exporter": "python", 69 | "pygments_lexer": "ipython3", 70 | "version": "3.7.9" 71 | } 72 | }, 73 | "nbformat": 4, 74 | "nbformat_minor": 4 75 | } 76 | -------------------------------------------------------------------------------- /examples/marker_cluster.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "# Marker Cluster Example\n", 31 | "\n", 32 | "import os\n", 33 | "from here_map_widget import Map, MarkerCluster, ZoomControl, ObjectLayer\n", 34 | "\n", 35 | "\n", 36 | "m = Map(api_key=os.environ[\"LS_API_KEY\"], center=[51.01, 0.01], zoom=7)\n", 37 | "\n", 38 | "data = \"\"\"\n", 39 | "\n", 40 | "\n", 41 | "\n", 42 | "

Marker

\n", 43 | "

{}

\n", 44 | "\n", 45 | "\n", 46 | "\"\"\"\n", 47 | "p1 = dict(lat=51.01, lng=0.01, data=data.format(\"First Marker\"))\n", 48 | "p2 = dict(lat=50.04, lng=1.01, data=data.format(\"Second Marker\"))\n", 49 | "p3 = dict(lat=51.45, lng=1.01, data=data.format(\"Third Marker\"))\n", 50 | "p4 = dict(lat=51.01, lng=2.01, data=data.format(\"Fourth Marker\"))\n", 51 | "\n", 52 | "provider = MarkerCluster(data_points=[p1, p2, p3, p4], show_bubble=True)\n", 53 | "layer = ObjectLayer(provider=provider)\n", 54 | "m.add_layer(layer)\n", 55 | "zc = ZoomControl(alignment=\"LEFT_TOP\")\n", 56 | "m.add_control(zc)\n", 57 | "m" 58 | ] 59 | } 60 | ], 61 | "metadata": { 62 | "kernelspec": { 63 | "display_name": "Python 3", 64 | "language": "python", 65 | "name": "python3" 66 | }, 67 | "language_info": { 68 | "codemirror_mode": { 69 | "name": "ipython", 70 | "version": 3 71 | }, 72 | "file_extension": ".py", 73 | "mimetype": "text/x-python", 74 | "name": "python", 75 | "nbconvert_exporter": "python", 76 | "pygments_lexer": "ipython3", 77 | "version": "3.7.9" 78 | } 79 | }, 80 | "nbformat": 4, 81 | "nbformat_minor": 4 82 | } 83 | -------------------------------------------------------------------------------- /examples/marker_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/examples/marker_image.png -------------------------------------------------------------------------------- /examples/rectangle.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from here_map_widget import Map\n", 31 | "from here_map_widget import Bbox, Rectangle\n", 32 | "import os\n", 33 | "\n", 34 | "center = [46.017618898512374, 23.91982511231513]\n", 35 | "\n", 36 | "m = Map(api_key=os.environ[\"LS_API_KEY\"], center=center, zoom=3)\n", 37 | "\n", 38 | "style = {\"strokeColor\": \"#829\", \"lineWidth\": 4}\n", 39 | "\n", 40 | "bbox = Bbox(top=53.1, left=13.1, bottom=43.1, right=40.1)\n", 41 | "rectangle = Rectangle(bbox=bbox, style=style, draggable=True)\n", 42 | "m.add_object(rectangle)\n", 43 | "m" 44 | ] 45 | } 46 | ], 47 | "metadata": { 48 | "kernelspec": { 49 | "display_name": "Python 3", 50 | "language": "python", 51 | "name": "python3" 52 | }, 53 | "language_info": { 54 | "codemirror_mode": { 55 | "name": "ipython", 56 | "version": 3 57 | }, 58 | "file_extension": ".py", 59 | "mimetype": "text/x-python", 60 | "name": "python", 61 | "nbconvert_exporter": "python", 62 | "pygments_lexer": "ipython3", 63 | "version": "3.7.9" 64 | } 65 | }, 66 | "nbformat": 4, 67 | "nbformat_minor": 4 68 | } 69 | -------------------------------------------------------------------------------- /examples/splitmap_control.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "
\n", 8 | "Warning: Before running below cells please make sure you have API key. \n", 9 | " Please see README.md for more info on API key.\n", 10 | "
" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import os\n", 20 | "\n", 21 | "os.environ[\"LS_API_KEY\"] = \"MY-API-KEY\" # replace your API key here." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from here_map_widget import Map, SplitMapControl, GeoJSON\n", 31 | "import os\n", 32 | "\n", 33 | "m = Map(api_key=os.environ[\"LS_API_KEY\"])\n", 34 | "left_geojson = GeoJSON(\n", 35 | " url=\"https://gist.githubusercontent.com/peaksnail/5d4f07ca00ed7c653663d7874e0ab8e7/raw/64c2a975482efd9c42e54f6f6869f091055053cd/countries.geo.json\",\n", 36 | " disable_legacy_mode=True,\n", 37 | " style={\"fillColor\": \"#ff0000\", \"color\": \"black\", \"opacity\": 0.1},\n", 38 | ")\n", 39 | "right_geojson = GeoJSON(\n", 40 | " url=\"https://gist.githubusercontent.com/peaksnail/5d4f07ca00ed7c653663d7874e0ab8e7/raw/64c2a975482efd9c42e54f6f6869f091055053cd/countries.geo.json\",\n", 41 | " disable_legacy_mode=True,\n", 42 | " style={\"fillColor\": \"#00ff00\", \"color\": \"black\", \"opacity\": 0.1},\n", 43 | ")\n", 44 | "\n", 45 | "sp = SplitMapControl(left_layer=left_geojson, right_layer=right_geojson)\n", 46 | "m.add_control(sp)\n", 47 | "m" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [ 56 | "m.remove_control(sp)" 57 | ] 58 | } 59 | ], 60 | "metadata": { 61 | "kernelspec": { 62 | "display_name": "Python 3", 63 | "language": "python", 64 | "name": "python3" 65 | }, 66 | "language_info": { 67 | "codemirror_mode": { 68 | "name": "ipython", 69 | "version": 3 70 | }, 71 | "file_extension": ".py", 72 | "mimetype": "text/x-python", 73 | "name": "python", 74 | "nbconvert_exporter": "python", 75 | "pygments_lexer": "ipython3", 76 | "version": "3.7.9" 77 | } 78 | }, 79 | "nbformat": 4, 80 | "nbformat_minor": 4 81 | } 82 | -------------------------------------------------------------------------------- /examples/us-states.json.license: -------------------------------------------------------------------------------- 1 | Source: https://datahub.io/core/geo-admin1-us 2 | 3 | Made with Natural Earth. Free vector and raster map data @ naturalearthdata.com. 4 | 5 | SPDX-License-Identifier: LicenseRef-scancode-public-domain -------------------------------------------------------------------------------- /examples/us_unemployment_oct2012.csv: -------------------------------------------------------------------------------- 1 | State,Unemployment 2 | AL,7.1 3 | AK,6.8 4 | AZ,8.1 5 | AR,7.2 6 | CA,10.1 7 | CO,7.7 8 | CT,8.4 9 | DE,7.1 10 | FL,8.2 11 | GA,8.8 12 | HI,5.4 13 | ID,6.6 14 | IL,8.8 15 | IN,8.4 16 | IA,5.1 17 | KS,5.6 18 | KY,8.1 19 | LA,5.9 20 | ME,7.2 21 | MD,6.8 22 | MA,6.7 23 | MI,9.1 24 | MN,5.6 25 | MS,9.1 26 | MO,6.7 27 | MT,5.8 28 | NE,3.9 29 | NV,10.3 30 | NH,5.7 31 | NJ,9.6 32 | NM,6.8 33 | NY,8.4 34 | NC,9.4 35 | ND,3.2 36 | OH,6.9 37 | OK,5.2 38 | OR,8.5 39 | PA,8 40 | RI,10.1 41 | SC,8.8 42 | SD,4.4 43 | TN,7.8 44 | TX,6.4 45 | UT,5.5 46 | VT,5 47 | VA,5.8 48 | WA,7.8 49 | WV,7.5 50 | WI,6.8 51 | WY,5.1 -------------------------------------------------------------------------------- /examples/us_unemployment_oct2012.csv.license: -------------------------------------------------------------------------------- 1 | Source: https://www.bls.gov/news.release/archives/laus_11202012.pdf 2 | 3 | The Bureau of Labor Statistics (BLS) is a Federal government agency and everything that we publish, 4 | both in hard copy and electronically, is in the public domain, except for previously 5 | copyrighted photographs and illustrations. 6 | 7 | You are free to use our public domain material without specific permission, 8 | although we do ask that you cite the Bureau of Labor Statistics as the source 9 | (per https://www.bls.gov/bls/linksite.htm). 10 | -------------------------------------------------------------------------------- /examples/xyz_style.yaml: -------------------------------------------------------------------------------- 1 | sources: 2 | xyz: 3 | type: MVT 4 | layers: 5 | m2pcsiNi: 6 | data: 7 | source: xyz 8 | points: 9 | filter: 10 | $geometry: point 11 | draw: 12 | points: 13 | color: red 14 | priority: 500 15 | placement: spaced 16 | size: 26px 17 | placement_spacing: 150px 18 | angle: auto 19 | flat: true 20 | interactive: true 21 | points_flagged: 22 | draw: 23 | points: 24 | color: blue 25 | priority: 500 26 | placement: spaced 27 | size: 26px 28 | placement_spacing: 150px 29 | angle: auto 30 | flat: true 31 | interactive: true 32 | filter: 33 | $geometry: "point" 34 | properties.GPSFLG: "Flagged for coordinate check" -------------------------------------------------------------------------------- /here_map_widget/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (C) 2019-2024 HERE Europe B.V. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /here_map_widget/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019-2024 HERE Europe B.V. 2 | # SPDX-License-Identifier: MIT 3 | 4 | """HERE Map Widget for Jupyter - use HERE Maps API for 5 | 6 | JavaScript in your Jupyter notebooks. 7 | This widget enables you to use the HERE Map View in Jupyter notebooks 8 | to make geospatial data analysis easier and more interactive. 9 | """ 10 | 11 | import sys 12 | 13 | import xyzservices.providers as basemaps # noqa E501 14 | 15 | from ._version import __version__, version_info 16 | from .configs import * 17 | from .map import * 18 | 19 | try: 20 | if "google.colab" in sys.modules: 21 | from google.colab import output 22 | 23 | output.enable_custom_widget_manager() 24 | except ImportError: 25 | pass 26 | 27 | 28 | def _jupyter_nbextension_paths(): 29 | """Called by Jupyter Notebook Server to detect if it is a valid nbextension and 30 | to install the widget 31 | 32 | Returns 33 | ======= 34 | section: The section of the Jupyter Notebook Server to change. 35 | Must be 'notebook' for widget extensions 36 | src: Source directory name to copy files from. Webpack outputs generated files 37 | into this directory and Jupyter Notebook copies from this directory during 38 | widget installation 39 | dest: Destination directory name to install widget files to. Jupyter Notebook copies 40 | from `src` directory into /nbextensions/ directory 41 | during widget installation 42 | require: Path to importable AMD JavaScript module inside the 43 | /nbextensions/ directory 44 | """ 45 | return [ 46 | { 47 | "section": "notebook", 48 | "src": "nbextension", 49 | "dest": "@here/map-widget-for-jupyter", 50 | "require": "@here/map-widget-for-jupyter/extension", 51 | } 52 | ] 53 | 54 | 55 | def _jupyter_labextension_paths(): 56 | return [{"src": "labextension", "dest": "@here/map-widget-for-jupyter"}] 57 | -------------------------------------------------------------------------------- /here_map_widget/_version.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019-2024 HERE Europe B.V. 2 | # SPDX-License-Identifier: MIT 3 | 4 | """Project version information.""" 5 | 6 | # Module version 7 | version_info = (1, 1, 3) 8 | 9 | # Module version accessible using here_map_widget.__version__ 10 | __version__ = "%s.%s.%s" % ( 11 | version_info[0], 12 | version_info[1], 13 | version_info[2], 14 | ) 15 | 16 | EXTENSION_VERSION = "^1.1.3" 17 | -------------------------------------------------------------------------------- /here_map_widget/configs.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019-2024 HERE Europe B.V. 2 | # SPDX-License-Identifier: MIT 3 | 4 | """ 5 | This module defines all the constants, which will be used as configuration parameters 6 | for HERE Location Services or basemaps. 7 | """ 8 | 9 | from argparse import Namespace 10 | 11 | 12 | class DefaultLayerNames: 13 | """This class defines pre-configured set of HERE layers for convenient use with the map.""" 14 | 15 | vector = Namespace( 16 | normal=Namespace( 17 | map="vector.normal.map", 18 | truck="vector.normal.truck", 19 | traffic="vector.normal.traffic", 20 | trafficincidents="vector.normal.trafficincidents", 21 | ) 22 | ) 23 | 24 | raster = Namespace( 25 | normal=Namespace( 26 | map="raster.normal.map", 27 | mapnight="raster.normal.mapnight", 28 | xbase="raster.normal.xbase", 29 | xbasenight="raster.normal.xbasenight", 30 | base="raster.normal.base", 31 | basenight="raster.normal.basenight", 32 | trafficincidents="raster.normal.trafficincidents", 33 | transit="raster.normal.transit", 34 | labels="raster.normal.labels", 35 | ), 36 | satellite=Namespace( 37 | map="raster.satellite.map", 38 | xbase="raster.satellite.xbase", 39 | base="raster.satellite.base", 40 | labels="raster.satellite.labels", 41 | ), 42 | terrain=Namespace( 43 | map="raster.terrain.map", 44 | xbase="raster.terrain.xbase", 45 | base="raster.terrain.base", 46 | labels="raster.terrain.labels", 47 | ), 48 | ) 49 | 50 | 51 | class ServiceNames: 52 | """This class implements configurations for Here Location Services.""" 53 | 54 | routing = "routing" 55 | omv = "omv" 56 | geocoding = "geocoding" 57 | maptile = "maptile" 58 | traffic = "traffic" 59 | xyz = "xyz" 60 | 61 | 62 | class URL: 63 | """This is base class for all urls of the services.""" 64 | 65 | scheme = "scheme" 66 | host = "host" 67 | path = "path" 68 | 69 | 70 | class OMVUrl(URL): 71 | """This class implements configurations OMV service url.""" 72 | 73 | pass 74 | 75 | 76 | class MapTileUrl(URL): 77 | """This class implements configurations for MapTile service url.""" 78 | 79 | pass 80 | 81 | 82 | class XYZUrl(URL): 83 | """This class implements configurations for XYZ service url.""" 84 | 85 | pass 86 | -------------------------------------------------------------------------------- /images/basemaps.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/basemaps.gif -------------------------------------------------------------------------------- /images/external_basemaps.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/external_basemaps.gif -------------------------------------------------------------------------------- /images/geo-pandas.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/geo-pandas.gif -------------------------------------------------------------------------------- /images/geojson.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/geojson.gif -------------------------------------------------------------------------------- /images/marker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/marker.gif -------------------------------------------------------------------------------- /images/search-control.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/search-control.gif -------------------------------------------------------------------------------- /images/widget-control.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/widget-control.gif -------------------------------------------------------------------------------- /images/xyz.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/images/xyz.gif -------------------------------------------------------------------------------- /jlab/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | node: { 3 | global: false 4 | } 5 | }; -------------------------------------------------------------------------------- /js/.babelrc: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019 - 2020 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | { 26 | "plugins": ["transform-object-rest-spread"] 27 | } -------------------------------------------------------------------------------- /js/.yarnrc.yml: -------------------------------------------------------------------------------- 1 | npmScopes: 2 | here: 3 | npmRegistryServer: "https://repo.platform.here.com/artifactory/api/npm/maps-api-for-javascript" 4 | 5 | -------------------------------------------------------------------------------- /js/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (C) 2019-2024 HERE Europe B.V. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /js/README.md: -------------------------------------------------------------------------------- 1 | HERE Map Widget for Jupyter 2 | =========================== 3 | Use [HERE Maps API for JavaScript](https://developer.here.com/develop/javascript-api) in your [Jupyter Notebook](https://jupyter.org/). 4 | 5 | Package Install 6 | --------------- 7 | 8 | **Prerequisites** 9 | - [node](http://nodejs.org/) 10 | 11 | ```bash 12 | npm config set @here:registry https://repo.platform.here.com/artifactory/api/npm/here-node/ 13 | 14 | npm install --save @here/map-widget-for-jupyter 15 | ``` 16 | -------------------------------------------------------------------------------- /js/lib/control/Control.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const widgets = require('@jupyter-widgets/base'); 6 | const _ = require('lodash'); 7 | import H from '@here/maps-api-for-javascript/bin/mapsjs.bundle.harp' 8 | 9 | export class ControlModel extends widgets.WidgetModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ControlView', 14 | _model_name: 'ControlModel', 15 | _view_module: '@here/map-widget-for-jupyter', 16 | _model_module: '@here/map-widget-for-jupyter', 17 | }; 18 | } 19 | } 20 | 21 | ControlModel.serializers = _.extend(widgets.WidgetModel.serializers); 22 | 23 | export class ControlView extends widgets.WidgetView { 24 | initialize(parameters) { 25 | super.initialize(parameters); 26 | this.map_view = this.options.map_view; 27 | 28 | } 29 | 30 | render() { 31 | return Promise.resolve(this.create_obj()).then(() => { 32 | this.model_events(); 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /js/lib/control/LayersControl.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const control = require('./Control.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class LayersControlModel extends control.ControlModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'LayersControlView', 14 | _model_name: 'LayersControlModel', 15 | 16 | name: "LayersControl", 17 | alignment: "RIGHT_TOP", 18 | }; 19 | } 20 | } 21 | 22 | export class LayersControlView extends control.ControlView { 23 | 24 | initialize(parameters) { 25 | super.initialize(parameters); 26 | this.map_view = this.options.map_view; 27 | } 28 | 29 | toggle_obj() { 30 | let controlName = this.model.get('name'); 31 | const cntrl = this.map_view.ui.getControl(controlName); 32 | this.map_view.ui.removeControl(controlName); 33 | return Promise.resolve(this.create_obj()).then(() => { 34 | this.map_view.ui.addControl(this.model.get('name'), this.obj); 35 | }); 36 | 37 | } 38 | 39 | model_events() { 40 | this.listenTo(this.map_view.model, 'change:layers', () => { 41 | this.toggle_obj(); 42 | }); 43 | } 44 | 45 | create_obj() { 46 | return Promise.all(this.map_view.layer_views.views) 47 | .then(views => { 48 | var overlays = views.reduce(function(ov, view) { 49 | ov[view.model.get('name')] = view.obj; 50 | return ov; 51 | }, {}); 52 | let layers = []; 53 | for (let key in overlays) { 54 | let entry = new H.ui.MapSettingsControl(); 55 | entry.label = key; 56 | entry.layer = overlays[key]; 57 | layers.push(entry); 58 | } 59 | let options = { 60 | alignment: _.get(H.ui.LayoutAlignment, this.model.get('alignment')), 61 | layers: layers 62 | } 63 | this.obj = new H.ui.MapSettingsControl(options); 64 | }); 65 | } 66 | } -------------------------------------------------------------------------------- /js/lib/control/ScaleBar.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const control = require('./Control.js'); 6 | const _ = require('lodash'); 7 | 8 | 9 | export class ScaleBarModel extends control.ControlModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ScaleBarView', 14 | _model_name: 'ScaleBarModel', 15 | 16 | name: "ScaleBar", 17 | alignment: "RIGHT_BOTTOM", 18 | }; 19 | } 20 | } 21 | 22 | export class ScaleBarView extends control.ControlView { 23 | create_obj() { 24 | var options = { 25 | alignment: _.get(H.ui.LayoutAlignment, this.model.get('alignment')) 26 | }; 27 | 28 | this.obj = new H.ui.ScaleBar(options); 29 | } 30 | 31 | model_events() { 32 | // 33 | } 34 | } -------------------------------------------------------------------------------- /js/lib/control/ZoomControl.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const control = require('./Control.js'); 6 | const _ = require('lodash'); 7 | 8 | 9 | export class ZoomControlModel extends control.ControlModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ZoomControlView', 14 | _model_name: 'ZoomControlModel', 15 | 16 | name: "ZoomControl", 17 | zoomSpeed: 4, 18 | fractionalZoom: true, 19 | alignment: "LEFT_TOP", 20 | slider: false, 21 | sliderSnaps: false, 22 | }; 23 | } 24 | } 25 | 26 | export class ZoomControlView extends control.ControlView { 27 | create_obj() { 28 | var options = { 29 | zoomSpeed: this.model.get('zoomSpeed'), 30 | fractionalZoom: this.model.get('fractionalZoom'), 31 | alignment: _.get(H.ui.LayoutAlignment, this.model.get('alignment')), 32 | slider: this.model.get('slider'), 33 | sliderSnaps: this.model.get('sliderSnaps') 34 | }; 35 | 36 | this.obj = new H.ui.ZoomControl(options); 37 | } 38 | 39 | model_events() { 40 | // 41 | } 42 | } -------------------------------------------------------------------------------- /js/lib/control/ZoomRectangle.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const control = require('./Control.js'); 6 | const _ = require('lodash'); 7 | 8 | 9 | export class ZoomRectangleModel extends control.ControlModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ZoomRectangleView', 14 | _model_name: 'ZoomRectangleModel', 15 | 16 | name: "ZoomRectangle", 17 | alignment: "BOTTOM_RIGHT", 18 | }; 19 | } 20 | } 21 | 22 | export class ZoomRectangleView extends control.ControlView { 23 | create_obj() { 24 | var options = { 25 | alignment: _.get(H.ui.LayoutAlignment, this.model.get('alignment')) 26 | }; 27 | 28 | this.obj = new H.ui.ZoomRectangle(options); 29 | } 30 | 31 | model_events() { 32 | // 33 | } 34 | } -------------------------------------------------------------------------------- /js/lib/element/.Element.js.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/js/lib/element/.Element.js.swp -------------------------------------------------------------------------------- /js/lib/element/Element.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const widgets = require('@jupyter-widgets/base'); 6 | const _ = require('lodash'); 7 | import H from '@here/maps-api-for-javascript/bin/mapsjs.bundle.harp' 8 | 9 | export class ElementModel extends widgets.WidgetModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ElementView', 14 | _model_name: 'ElementModel', 15 | _view_module: '@here/map-widget-for-jupyter', 16 | _model_module: '@here/map-widget-for-jupyter', 17 | }; 18 | } 19 | } 20 | 21 | ElementModel.serializers = _.extend(widgets.WidgetModel.serializers); 22 | 23 | export class ElementView extends widgets.WidgetView { 24 | initialize(parameters) { 25 | super.initialize(parameters); 26 | this.map_view = this.options.map_view; 27 | } 28 | 29 | render() { 30 | return Promise.resolve(this.create_obj()).then(() => { 31 | this.model_events(); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /js/lib/element/InfoBubble.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const element = require('./Element.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | 8 | export class InfoBubbleModel extends element.ElementModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'InfoBubbleView', 13 | _model_name: 'InfoBubbleModel', 14 | 15 | position: null, 16 | content: '', 17 | }; 18 | } 19 | } 20 | 21 | InfoBubbleModel.serializers = _.extend({ 22 | position: { 23 | deserialize: widgets.unpack_models 24 | }, 25 | }, widgets.DOMWidgetModel.serializers); 26 | 27 | export class InfoBubbleView extends element.ElementView { 28 | create_obj() { 29 | return this.create_child_view(this.model.get('position')).then((view) => { 30 | this.obj = new H.ui.InfoBubble(view.obj, { 31 | content: this.model.get('content') 32 | }); 33 | }); 34 | } 35 | 36 | model_events() { 37 | // 38 | } 39 | } -------------------------------------------------------------------------------- /js/lib/element/Style.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const element = require('./Element.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | 8 | export class StyleModel extends element.ElementModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'StyleView', 13 | _model_name: 'StyleModel', 14 | 15 | config: '', 16 | base_url: '', 17 | }; 18 | } 19 | } 20 | 21 | 22 | export class StyleView extends element.ElementView { 23 | create_obj() { 24 | const config = this.model.get('config'); 25 | const base_url = this.model.get('base_url'); 26 | this.obj = new H.map.render.webgl.Style(config, base_url); 27 | 28 | } 29 | 30 | model_events() { 31 | // 32 | } 33 | } -------------------------------------------------------------------------------- /js/lib/embed.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | 6 | // Entry point for the unpkg bundle containing custom model definitions. 7 | // 8 | // It differs from the notebook bundle in that it does not need to define a 9 | // dynamic baseURL for the static assets and may load some css that would 10 | // already be loaded by the notebook otherwise. 11 | 12 | // Export widget models and views, and the npm package version number. 13 | module.exports = require('./index.js'); 14 | -------------------------------------------------------------------------------- /js/lib/extension.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | 6 | // This file contains the JavaScript that is run when the notebook is loaded. 7 | // It contains some requirejs configuration and the `load_ipython_extension` 8 | // which is required for any notebook extension. 9 | // 10 | // Some static assets may be required by the custom widget javascript. The base 11 | // url for the notebook is not known at build time and is therefore computed 12 | // dynamically. 13 | __webpack_public_path__ = document.querySelector('body').getAttribute('data-base-url') + 'nbextensions/@here/map-widget-for-jupyter'; 14 | 15 | 16 | // Configure requirejs 17 | if (window.require) { 18 | window.require.config({ 19 | map: { 20 | "*" : { 21 | "@here/map-widget-for-jupyter": "nbextensions/@here/map-widget-for-jupyter/index", 22 | } 23 | } 24 | }); 25 | } 26 | 27 | // Export the required load_ipython_extension 28 | module.exports = { 29 | load_ipython_extension: function() {} 30 | }; 31 | -------------------------------------------------------------------------------- /js/lib/geometrys/Geometry.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const widgets = require('@jupyter-widgets/base'); 6 | const _ = require('lodash'); 7 | import H from '@here/maps-api-for-javascript/bin/mapsjs.bundle.harp' 8 | 9 | export class GeometryModel extends widgets.WidgetModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'GeometryView', 14 | _model_name: 'GeometryModel', 15 | _view_module: '@here/map-widget-for-jupyter', 16 | _model_module: '@here/map-widget-for-jupyter', 17 | }; 18 | } 19 | } 20 | 21 | GeometryModel.serializers = _.extend(widgets.WidgetModel.serializers); 22 | 23 | export class GeometryView extends widgets.WidgetView { 24 | initialize(parameters) { 25 | super.initialize(parameters); 26 | } 27 | 28 | render() { 29 | return Promise.resolve(this.create_obj()).then(() => { 30 | this.model_events(); 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /js/lib/geometrys/LineString.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const geometry = require('./Geometry.js'); 6 | 7 | 8 | export class LineStringModel extends geometry.GeometryModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'LineStringView', 13 | _model_name: 'LineStringModel', 14 | 15 | points: [], 16 | }; 17 | } 18 | } 19 | 20 | export class LineStringView extends geometry.GeometryView { 21 | create_obj() { 22 | this.obj = new H.geo.LineString(this.model.get('points')); 23 | } 24 | 25 | model_events() { 26 | this.listenTo( 27 | this.model, 28 | 'change:points', 29 | function() { 30 | var len = this.model.get('points').length; 31 | var array = this.model.get('points'); 32 | this.obj.pushPoint({ 33 | lat: array[array.length - 3], 34 | lng: array[array.length - 2], 35 | alt: array[array.length - 1] 36 | }); 37 | }, 38 | this 39 | ); 40 | } 41 | } -------------------------------------------------------------------------------- /js/lib/geometrys/MultiLineString.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const geometry = require('./Geometry.js'); 6 | const _ = require('lodash'); 7 | const widgets = require('@jupyter-widgets/base'); 8 | 9 | export class MultiLineStringModel extends geometry.GeometryModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'MultiLineStringView', 14 | _model_name: 'MultiLineStringModel', 15 | 16 | lines: [], 17 | }; 18 | } 19 | } 20 | 21 | MultiLineStringModel.serializers = _.extend({ 22 | lines: { 23 | deserialize: widgets.unpack_models 24 | }, 25 | }, widgets.DOMWidgetModel.serializers); 26 | 27 | export class MultiLineStringView extends geometry.GeometryView { 28 | remove_layer_view(child_view) { 29 | this.obj.remove(child_view.obj); 30 | child_view.remove(); 31 | } 32 | 33 | add_layer_model(child_model) { 34 | return this.create_child_view(child_model, { 35 | map_view: this 36 | }).then(view => { 37 | 38 | this.obj.push(view.obj); 39 | return view; 40 | }); 41 | } 42 | create_obj() { 43 | this.layer_views = new widgets.ViewList( 44 | this.add_layer_model, 45 | this.remove_layer_view, 46 | this 47 | ); 48 | 49 | this.create_child_view(this.model.get('lines')[0]).then((view) => { 50 | this.obj = new H.geo.MultiLineString([view.obj]); 51 | }); 52 | return this.layer_views.update(this.model.get('lines')); 53 | } 54 | 55 | model_events() { 56 | this.listenTo( 57 | this.model, 58 | 'change:lines', 59 | function() { 60 | return this.layer_views.update(this.model.get('lines')); 61 | }, 62 | this 63 | ); 64 | } 65 | } -------------------------------------------------------------------------------- /js/lib/geometrys/MultiPolygon.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const geometry = require('./Geometry.js'); 6 | const _ = require('lodash'); 7 | const widgets = require('@jupyter-widgets/base'); 8 | 9 | 10 | export class MultiPolygonGeoModel extends geometry.GeometryModel { 11 | defaults() { 12 | return { 13 | // ...super.defaults(), 14 | _view_name: 'MultiPolygonGeoView', 15 | _model_name: 'MultiPolygonGeoModel', 16 | 17 | polygons: [], 18 | }; 19 | } 20 | } 21 | 22 | MultiPolygonGeoModel.serializers = _.extend({ 23 | polygons: { 24 | deserialize: widgets.unpack_models 25 | }, 26 | }, widgets.DOMWidgetModel.serializers); 27 | 28 | export class MultiPolygonGeoView extends geometry.GeometryView { 29 | remove_polygon_view(child_view) { 30 | this.obj.remove(child_view.obj); 31 | child_view.remove(); 32 | } 33 | 34 | add_polygon_model(child_model) { 35 | return this.create_child_view(child_model, { 36 | map_view: this 37 | }).then(view => { 38 | this.obj.push(view.obj); 39 | return view; 40 | }); 41 | } 42 | 43 | create_obj() { 44 | this.polygon_views = new widgets.ViewList( 45 | this.add_polygon_model, 46 | this.remove_polygon_view, 47 | this 48 | ); 49 | 50 | this.create_child_view(this.model.get('polygons')[0]).then((view) => { 51 | this.obj = new H.geo.MultiPolygon([view.obj]); 52 | }); 53 | return this.polygon_views.update(this.model.get('polygons')); 54 | } 55 | 56 | model_events() { 57 | this.listenTo( 58 | this.model, 59 | 'change:polygons', 60 | function() { 61 | return this.polygon_views.update(this.model.get('polygons')); 62 | }, 63 | this 64 | ); 65 | } 66 | } -------------------------------------------------------------------------------- /js/lib/geometrys/Point.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const geometry = require('./Geometry.js'); 6 | 7 | 8 | export class PointModel extends geometry.GeometryModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'PointView', 13 | _model_name: 'PointModel', 14 | 15 | lat: 0, 16 | lng: 0, 17 | alt: 0.0, 18 | }; 19 | } 20 | } 21 | 22 | export class PointView extends geometry.GeometryView { 23 | create_obj() { 24 | var lat = this.model.get('lat'); 25 | var lng = this.model.get('lng'); 26 | var alt = this.model.get('alt'); 27 | this.obj = new H.geo.Point(lat, lng, alt); 28 | } 29 | 30 | model_events() { 31 | // 32 | } 33 | } -------------------------------------------------------------------------------- /js/lib/geometrys/Polygon.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const geometry = require('./Geometry.js'); 6 | const _ = require('lodash'); 7 | const widgets = require('@jupyter-widgets/base'); 8 | 9 | 10 | export class PolygonGeoModel extends geometry.GeometryModel { 11 | defaults() { 12 | return { 13 | // ...super.defaults(), 14 | _view_name: 'PolygonGeoView', 15 | _model_name: 'PolygonGeoModel', 16 | 17 | linestring: null, 18 | holes: [], 19 | }; 20 | } 21 | } 22 | 23 | PolygonGeoModel.serializers = _.extend({ 24 | linestring: { 25 | deserialize: widgets.unpack_models 26 | }, 27 | holes: { 28 | deserialize: widgets.unpack_models 29 | }, 30 | }, widgets.DOMWidgetModel.serializers); 31 | 32 | export class PolygonGeoView extends geometry.GeometryView { 33 | remove_layer_view(child_view) { 34 | this.obj.removeInterior(child_view.obj); 35 | child_view.remove(); 36 | } 37 | 38 | add_layer_model(child_model) { 39 | return this.create_child_view(child_model, { 40 | map_view: this 41 | }).then(view => { 42 | 43 | this.viewArr.push(view.obj); 44 | if (this.obj != null) { 45 | this.obj.pushInterior(view.obj); 46 | } 47 | return view; 48 | }); 49 | } 50 | create_obj() { 51 | this.layer_views = new widgets.ViewList( 52 | this.add_layer_model, 53 | this.remove_layer_view, 54 | this 55 | ); 56 | this.viewArr = []; 57 | return this.layer_views.update(this.model.get('holes')).then(() => { 58 | return this.create_child_view(this.model.get('linestring')).then((view) => { 59 | this.obj = new H.geo.Polygon(view.obj, this.viewArr); 60 | }); 61 | }); 62 | } 63 | 64 | model_events() { 65 | this.listenTo( 66 | this.model, 67 | 'change:holes', 68 | function() { 69 | return this.layer_views.update(this.model.get('holes')); 70 | }, 71 | this 72 | ); 73 | 74 | this.listenTo( 75 | this.model, 76 | 'change:linestring', 77 | function() { 78 | return this.create_child_view(this.model.get('linestring')).then((view) => { 79 | this.obj.setExterior(view.obj); 80 | }); 81 | }, 82 | this 83 | ); 84 | 85 | } 86 | } -------------------------------------------------------------------------------- /js/lib/geometrys/Rect.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const geometry = require('./Geometry.js'); 6 | 7 | 8 | export class RectModel extends geometry.GeometryModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'RectView', 13 | _model_name: 'RectModel', 14 | 15 | top: 0, 16 | left: 0, 17 | bottom: 0, 18 | right: 0 19 | }; 20 | } 21 | } 22 | 23 | export class RectView extends geometry.GeometryView { 24 | create_obj() { 25 | var top = this.model.get('top'); 26 | var left = this.model.get('left'); 27 | var bottom = this.model.get('bottom'); 28 | var right = this.model.get('right'); 29 | this.obj = new H.geo.Rect(top, left, bottom, right); 30 | } 31 | 32 | model_events() { 33 | // 34 | } 35 | } -------------------------------------------------------------------------------- /js/lib/geometrys/WKT.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const geometry = require('./Geometry.js'); 6 | 7 | 8 | export class WKTLayerModel extends geometry.GeometryModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'WKTLayerView', 13 | _model_name: 'WKTLayerModel', 14 | 15 | data: '', 16 | }; 17 | } 18 | } 19 | 20 | export class WKTLayerView extends geometry.GeometryView { 21 | create_obj() { 22 | this.obj = new H.util.wkt.toGeometry(this.model.get('data')); 23 | } 24 | 25 | model_events() { 26 | // 27 | } 28 | } -------------------------------------------------------------------------------- /js/lib/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | 6 | // Export widget models and views, and the npm package version number. 7 | 8 | //__webpack_public_path__ = document.querySelector('body').getAttribute('data-base-url') + 'nbextensions/@here/map-widget-for-jupyter/'; 9 | 10 | module.exports = require('./jupyter-map.js'); 11 | module.exports['version'] = require('../package.json').version; 12 | -------------------------------------------------------------------------------- /js/lib/labplugin.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | 6 | var plugin = require('./index'); 7 | var base = require('@jupyter-widgets/base'); 8 | 9 | module.exports = { 10 | id: '@here/map-widget-for-jupyter', 11 | requires: [base.IJupyterWidgetRegistry], 12 | activate: function(app, widgets) { 13 | widgets.registerWidget({ 14 | name: '@here/map-widget-for-jupyter', 15 | version: plugin.version, 16 | exports: plugin 17 | }); 18 | }, 19 | autoStart: true 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /js/lib/layers/Kml.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const layer = require('./Layer.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class KmlLayerModel extends layer.LayerModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'KmlLayerView', 14 | _model_name: 'KmlLayerModel', 15 | 16 | url: '', 17 | 18 | }; 19 | } 20 | } 21 | 22 | 23 | export class KmlLayerView extends layer.LayerView { 24 | create_obj() { 25 | var reader = new H.data.kml.Reader(this.model.get('url')); 26 | this.obj = reader.getLayer(); 27 | reader.parse(); 28 | 29 | } 30 | 31 | model_events() { 32 | // 33 | } 34 | mapjs_events() { 35 | // 36 | } 37 | } -------------------------------------------------------------------------------- /js/lib/layers/Layer.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const widgets = require('@jupyter-widgets/base'); 6 | const _ = require('lodash'); 7 | import H from '@here/maps-api-for-javascript/bin/mapsjs.bundle.harp' 8 | 9 | export class LayerModel extends widgets.WidgetModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'LayerView', 14 | _model_name: 'LayerModel', 15 | _view_module: '@here/map-widget-for-jupyter', 16 | _model_module: '@here/map-widget-for-jupyter', 17 | 18 | name: '' 19 | }; 20 | } 21 | } 22 | 23 | LayerModel.serializers = _.extend(widgets.WidgetModel.serializers); 24 | 25 | export class LayerView extends widgets.WidgetView { 26 | initialize(parameters) { 27 | super.initialize(parameters); 28 | this.map_view = this.options.map_view; 29 | } 30 | 31 | render() { 32 | return Promise.resolve(this.create_obj()).then(() => { 33 | this.model_events(); 34 | this.mapjs_events(); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /js/lib/layers/ObjectLayer.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const layer = require('./Layer.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class ObjectLayerModel extends layer.LayerModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ObjectLayerView', 14 | _model_name: 'ObjectLayerModel', 15 | 16 | provider: null, 17 | tile_size: 256, 18 | tile_cache_size: 32, 19 | data_cache_size: 512, 20 | pixel_ratio: 0 21 | }; 22 | } 23 | } 24 | 25 | ObjectLayerModel.serializers = _.extend({ 26 | provider: { 27 | deserialize: widgets.unpack_models 28 | }, 29 | }, widgets.DOMWidgetModel.serializers); 30 | 31 | export class ObjectLayerView extends layer.LayerView { 32 | create_obj() { 33 | return this.create_child_view(this.model.get('provider'), { 34 | map_view: this.map_view 35 | }).then((view) => { 36 | this.provider = view.obj; 37 | var tileSize = this.model.get('tile_size'); 38 | var tileCacheSize = this.model.get('tile_cache_size'); 39 | var dataCacheSize = this.model.get('data_cache_size'); 40 | var pixel_ratio = this.model.get('pixel_ratio'); 41 | var pixelRatio = pixel_ratio === 0 ? window.devicePixelRatio : pixel_ratio; 42 | var options = { 43 | tileSize: tileSize, 44 | tileCacheSize: tileCacheSize, 45 | dataCacheSize: dataCacheSize, 46 | pixelRatio: pixelRatio 47 | }; 48 | this.obj = new H.map.layer.ObjectLayer(this.provider, options); 49 | }); 50 | 51 | } 52 | 53 | model_events() {} 54 | mapjs_events() {} 55 | } -------------------------------------------------------------------------------- /js/lib/layers/TileLayer.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const layer = require('./Layer.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class TileLayerModel extends layer.LayerModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'TileLayerView', 14 | _model_name: 'TileLayerModel', 15 | 16 | provider: null, 17 | style: {}, 18 | }; 19 | } 20 | } 21 | 22 | TileLayerModel.serializers = _.extend({ 23 | provider: { 24 | deserialize: widgets.unpack_models 25 | }, 26 | }, widgets.DOMWidgetModel.serializers); 27 | 28 | export class TileLayerView extends layer.LayerView { 29 | create_obj() { 30 | return this.create_child_view(this.model.get('provider'), { 31 | map_view: this.map_view 32 | }).then((view) => { 33 | this.provider = view.obj; 34 | this.obj = new H.map.layer.TileLayer(this.provider, this.model.get('style')); 35 | }); 36 | 37 | } 38 | 39 | model_events() { 40 | this.listenTo( 41 | this.model, 42 | 'change:style', 43 | function() { 44 | var style = this.provider.getStyle(); 45 | for (var key in this.model.get('style')) { 46 | style.setProperty(key, this.model.get('style')[key]); 47 | } 48 | 49 | // make the objects within the provider interactive 50 | style.setInteractive(['xyz'], true); 51 | }, 52 | this 53 | ); 54 | } 55 | mapjs_events() { 56 | // 57 | } 58 | } -------------------------------------------------------------------------------- /js/lib/notebook.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | 6 | __webpack_public_path__ = document.querySelector('body').getAttribute('data-base-url') + 'nbextensions/@here/map-widget-for-jupyter/'; 7 | 8 | module.exports = require('./index.js'); -------------------------------------------------------------------------------- /js/lib/objects/Circle.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const object = require('./Object.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class CircleModel extends object.ObjectModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'CircleView', 14 | _model_name: 'CircleModel', 15 | 16 | center: null, 17 | radius: 100, 18 | style: {}, 19 | draggable: false, 20 | extrusion: 0.0, 21 | elevation: 0.0, 22 | }; 23 | } 24 | } 25 | 26 | CircleModel.serializers = _.extend({ 27 | center: { 28 | deserialize: widgets.unpack_models 29 | }, 30 | }, widgets.DOMWidgetModel.serializers); 31 | 32 | export class CircleView extends object.ObjectView { 33 | create_obj() { 34 | return this.create_child_view(this.model.get('center')).then((view) => { 35 | var radius = this.model.get('radius'); 36 | this.obj = new H.map.Circle(view.obj, radius, { 37 | style: this.model.get('style'), 38 | extrusion: this.model.get('extrusion'), 39 | elevation: this.model.get('elevation') 40 | }); 41 | this.obj.draggable = this.model.get('draggable'); 42 | }); 43 | 44 | } 45 | 46 | mapjs_events() { 47 | var map = this.map_view.obj; 48 | this.obj.addEventListener('dragstart', function(evnt) { 49 | var pointer = evnt.currentPointer, 50 | object = evnt.target, 51 | screenPositon = map.geoToScreen(object.getCenter()), 52 | offset = new H.math.Point(pointer.viewportX - screenPositon.x, pointer.viewportY - screenPositon.y); 53 | // store difference between starting mouse position and circle's center 54 | object.setData({ 55 | offset: offset 56 | }); 57 | evnt.stopPropagation(); 58 | }); 59 | 60 | this.obj.addEventListener('drag', function(evnt) { 61 | var pointer = evnt.currentPointer, 62 | object = evnt.target, 63 | offset = object.getData()['offset']; 64 | object.setCenter(map.screenToGeo(pointer.viewportX - offset.x, pointer.viewportY - offset.y)); 65 | evnt.stopPropagation(); 66 | }); 67 | 68 | } 69 | 70 | model_events() { 71 | this.listenTo( 72 | this.model, 73 | 'change:radius', 74 | function() { 75 | this.obj.setRadius(this.model.get('radius')); 76 | }, 77 | this 78 | ); 79 | 80 | this.listenTo( 81 | this.model, 82 | 'change:center', 83 | function() { 84 | this.create_child_view(this.model.get('center')).then((view) => { 85 | this.obj.setCenter(view.obj); 86 | }); 87 | }, 88 | this 89 | ); 90 | } 91 | } -------------------------------------------------------------------------------- /js/lib/objects/DomIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const object = require('./Object.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class DomIconModel extends object.ObjectModel { 10 | defaults() { 11 | return { 12 | _view_name: 'DomIconView', 13 | _model_name: 'DomIconModel', 14 | 15 | element: '', 16 | }; 17 | } 18 | } 19 | 20 | 21 | export class DomIconView extends object.ObjectView { 22 | create_obj() { 23 | this.obj = new H.map.DomIcon(this.model.get('element')); 24 | } 25 | 26 | mapjs_events() { 27 | // 28 | } 29 | 30 | model_events() { 31 | // 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /js/lib/objects/DomMarker.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const object = require('./Object.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class DomMarkerModel extends object.ObjectModel { 10 | defaults() { 11 | return { 12 | _view_name: 'DomMarkerView', 13 | _model_name: 'DomMarkerModel', 14 | 15 | lat: 0, 16 | lng: 0, 17 | alt: 0.0, 18 | icon: null, 19 | }; 20 | } 21 | } 22 | 23 | DomMarkerModel.serializers = _.extend({ 24 | icon: { 25 | deserialize: widgets.unpack_models 26 | }, 27 | }, widgets.DOMWidgetModel.serializers); 28 | 29 | export class DomMarkerView extends object.ObjectView { 30 | create_obj() { 31 | return this.create_child_view(this.model.get('icon')).then((view) => { 32 | this.obj = new H.map.DomMarker({ 33 | lat: this.model.get('lat'), 34 | lng: this.model.get('lng'), 35 | alt: this.model.get('alt') 36 | }, { 37 | icon: view.obj 38 | }); 39 | }); 40 | 41 | } 42 | 43 | mapjs_events() { 44 | // 45 | } 46 | 47 | model_events() { 48 | // 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /js/lib/objects/Group.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const object = require('./Object.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class GroupModel extends object.ObjectModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'GroupView', 14 | _model_name: 'GroupModel', 15 | 16 | volatility: false, 17 | objects: [], 18 | }; 19 | } 20 | } 21 | 22 | GroupModel.serializers = _.extend({ 23 | objects: { 24 | deserialize: widgets.unpack_models 25 | }, 26 | }, widgets.DOMWidgetModel.serializers); 27 | 28 | export class GroupView extends object.ObjectView { 29 | remove_object_view(child_view) { 30 | if (this.hasOwnProperty('obj')) { 31 | this.obj.removeObject(child_view.obj); 32 | child_view.remove(); 33 | } 34 | } 35 | 36 | add_object_model(child_model) { 37 | console.log("Object GROUP " + child_model + " " + child_model.state_change); 38 | return this.create_child_view(child_model, { 39 | map_view: this.map_view 40 | }).then(view => { 41 | if (this.hasOwnProperty('obj')) { 42 | this.obj.addObject(view.obj); 43 | } else { 44 | this.objArr.push(view.obj); 45 | } 46 | // Trigger the displayed event of the child view. 47 | this.displayed.then(() => { 48 | view.trigger('displayed', this); 49 | }); 50 | 51 | return view; 52 | }); 53 | } 54 | 55 | create_obj() { 56 | this.objArr = []; 57 | this.object_views = new widgets.ViewList( 58 | this.add_object_model, 59 | this.remove_object_view, 60 | this 61 | ); 62 | 63 | return this.object_views.update(this.model.get('objects')).then(() => { 64 | var options = { 65 | volatility: this.model.get('volatility'), 66 | objects: this.objArr 67 | }; 68 | this.obj = new H.map.Group(options); 69 | 70 | }); 71 | 72 | } 73 | mapjs_events() { 74 | // 75 | 76 | } 77 | model_events() { 78 | this.listenTo( 79 | this.model, 80 | 'change:objects', 81 | function() { 82 | this.object_views.update(this.model.get('objects')); 83 | }, 84 | this 85 | ); 86 | } 87 | } -------------------------------------------------------------------------------- /js/lib/objects/Icon.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const object = require('./Object.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class IconModel extends object.ObjectModel { 10 | defaults() { 11 | return { 12 | _view_name: 'IconView', 13 | _model_name: 'IconModel', 14 | 15 | bitmap: '', 16 | height: 256, 17 | width: 256, 18 | anchor: null, 19 | }; 20 | } 21 | } 22 | 23 | 24 | export class IconView extends object.ObjectView { 25 | create_obj() { 26 | var options = { 27 | size: { 28 | h: this.model.get('height'), 29 | w: this.model.get('width') 30 | } 31 | }; 32 | if (this.model.get('anchor')) { 33 | options['anchor'] = this.model.get('anchor'); 34 | } 35 | this.obj = new H.map.Icon(this.model.get('bitmap'), options); 36 | } 37 | 38 | mapjs_events() { 39 | // 40 | } 41 | 42 | model_events() { 43 | // 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /js/lib/objects/Object.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const widgets = require('@jupyter-widgets/base'); 6 | import H from '@here/maps-api-for-javascript/bin/mapsjs.bundle.harp' 7 | const _ = require('lodash'); 8 | 9 | export class ObjectModel extends widgets.WidgetModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ObjectView', 14 | _model_name: 'ObjectModel', 15 | _view_module: '@here/map-widget-for-jupyter', 16 | _model_module: '@here/map-widget-for-jupyter', 17 | extrusion: 0, 18 | elevation: 0, 19 | }; 20 | } 21 | } 22 | 23 | ObjectModel.serializers = _.extend(widgets.WidgetModel.serializers); 24 | 25 | export class ObjectView extends widgets.WidgetView { 26 | initialize(parameters) { 27 | super.initialize(parameters); 28 | this.map_view = this.options.map_view; 29 | } 30 | 31 | render() { 32 | return Promise.resolve(this.create_obj()).then(() => { 33 | this.model_events(); 34 | this.mapjs_events(); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /js/lib/objects/Overlay.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const object = require('./Object.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class OverlayModel extends object.ObjectModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'OverlayView', 14 | _model_name: 'OverlayModel', 15 | 16 | boundingBox: null, 17 | bitmap: '', 18 | min: Infinity, 19 | max: Infinity, 20 | opacity: 1, 21 | visibility: true, 22 | volatility: false, 23 | }; 24 | } 25 | } 26 | 27 | OverlayModel.serializers = _.extend({ 28 | boundingBox: { 29 | deserialize: widgets.unpack_models 30 | }, 31 | }, widgets.DOMWidgetModel.serializers); 32 | 33 | export class OverlayView extends object.ObjectView { 34 | create_obj() { 35 | return this.create_child_view(this.model.get('boundingBox'), { 36 | map_view: this.map_view, 37 | }).then((view) => { 38 | this.obj = new H.map.Overlay( 39 | view.obj, 40 | this.model.get('bitmap'), { 41 | min: this.model.get('min'), 42 | max: this.model.get('max'), 43 | opacity: this.model.get('opacity'), 44 | visibility: this.model.get('visibility'), 45 | volatility: this.model.get('volatility'), 46 | } 47 | ); 48 | }); 49 | 50 | } 51 | 52 | mapjs_events() { 53 | 54 | } 55 | 56 | model_events() { 57 | this.listenTo( 58 | this.model, 59 | 'change:bitmap', 60 | function() { 61 | this.obj.setBitmap(this.model.get('bitmap')); 62 | }, 63 | this 64 | ); 65 | } 66 | } -------------------------------------------------------------------------------- /js/lib/provider/HeatMap.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const provider = require('./Provider.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | 8 | export class HeatMapModel extends provider.ProviderModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'HeatMapView', 13 | _model_name: 'HeatMapModel', 14 | 15 | colors: {}, 16 | interpolate: false, 17 | opacity: 1.0, 18 | assume_values: false, 19 | data: [], 20 | hardReload: false, 21 | clear_flag: 1, 22 | }; 23 | } 24 | } 25 | 26 | 27 | export class HeatMapView extends provider.ProviderView { 28 | create_obj() { 29 | if (Object.keys(this.model.get('colors')).length !== 0) { 30 | this.colors = new H.data.heatmap.Colors(this.model.get('colors'), this.model.get('interpolate')); 31 | this.obj = new H.data.heatmap.Provider({ 32 | colors: this.colors, 33 | opacity: this.model.get('opacity'), 34 | // Paint assumed values in regions where no data is available 35 | assumeValues: this.model.get('assume_values') 36 | }); 37 | } else { 38 | this.obj = new H.data.heatmap.Provider({ 39 | opacity: this.model.get('opacity'), 40 | // Paint assumed values in regions where no data is available 41 | assumeValues: this.model.get('assume_values') 42 | }); 43 | } 44 | if (this.model.get('data').length != 0) { 45 | this.obj.addData(this.model.get('data'), this.model.get('hardReload')); 46 | this.model.set('data', []); 47 | } 48 | } 49 | 50 | model_events() { 51 | this.listenTo( 52 | this.model, 53 | 'change:data', 54 | function() { 55 | if (Object.keys(this.model.get('data')).length !== 0) { 56 | this.obj.addData(this.model.get('data'), this.model.get('hardReload')); 57 | this.model.set('data', []); 58 | } 59 | }, 60 | this 61 | ); 62 | 63 | this.listenTo( 64 | this.model, 65 | 'change:clear_flag', 66 | function() { 67 | this.obj.clear(); 68 | }, 69 | this 70 | ); 71 | 72 | this.listenTo( 73 | this.model, 74 | 'change:opacity', 75 | function() { 76 | this.obj.setOpacity(this.model.get('opacity')); 77 | }, 78 | this 79 | ); 80 | } 81 | 82 | mapjs_events() { 83 | 84 | } 85 | } -------------------------------------------------------------------------------- /js/lib/provider/IML.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const provider = require('./Provider.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | 8 | export class IMLModel extends provider.ProviderModel { 9 | defaults() { 10 | return { 11 | // ...super.defaults(), 12 | _view_name: 'IMLView', 13 | _model_name: 'IMLModel', 14 | 15 | catalog_hrn: '', 16 | layer_id: '', 17 | }; 18 | } 19 | } 20 | 21 | 22 | export class IMLView extends provider.ProviderView { 23 | create_obj() { 24 | const catalogHrn = this.model.get('catalog_hrn'); 25 | const layerId = this.model.get('layer_id'); 26 | const platform = new H.service.Platform({apikey: this.map_view.model.get('api_key')}); 27 | 28 | const service = platform.getIMLService(); 29 | this.obj = new H.service.iml.Provider(service, catalogHrn, layerId); 30 | } 31 | 32 | model_events() {} 33 | 34 | mapjs_events() {} 35 | 36 | } -------------------------------------------------------------------------------- /js/lib/provider/ImageTile.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const provider = require('./Provider.js'); 6 | 7 | 8 | export class ImageTileProviderModel extends provider.ProviderModel { 9 | defaults() { 10 | return { 11 | _view_name: 'ImageTileProviderView', 12 | _model_name: 'ImageTileProviderModel', 13 | 14 | url: '', 15 | min_zoom: 0, 16 | max_zoom: 22, 17 | opacity: 1.0, 18 | tile_size: 256, 19 | headers: {}, 20 | attribution: '', 21 | 22 | }; 23 | } 24 | } 25 | 26 | 27 | export class ImageTileProviderView extends provider.ProviderView { 28 | create_obj() { 29 | const url = this.model.get('url'); 30 | const min = this.model.get('min_zoom'); 31 | const max = this.model.get('max_zoom'); 32 | const opacity = this.model.get('opacity'); 33 | const tileSize = this.model.get('tile_size'); 34 | const headers = this.model.get('headers'); 35 | this.obj = new H.map.provider.ImageTileProvider({ 36 | min: min, 37 | max: max, 38 | opacity: opacity, 39 | tileSize: tileSize, 40 | headers: headers, 41 | getURL: function (x, y, z) { 42 | return url.replace('{z}', z).replace('{x}', x).replace('{y}', y); 43 | } 44 | 45 | }); 46 | const attribution = this.model.get('attribution'); 47 | if ( attribution ) { 48 | this.obj.getCopyrights = function (bounds, level) { 49 | return [{ 50 | label: attribution, 51 | alt: '' 52 | }]; 53 | }; 54 | } 55 | 56 | } 57 | 58 | model_events() { 59 | this.listenTo( 60 | this.model, 61 | 'change:opacity', 62 | function() { 63 | this.obj.setOpacity(this.model.get('opacity')); 64 | }, 65 | this 66 | ); 67 | } 68 | 69 | mapjs_events() {} 70 | 71 | } -------------------------------------------------------------------------------- /js/lib/provider/MapTile.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const provider = require('./Provider.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class MapTileModel extends provider.ProviderModel { 10 | defaults() { 11 | return { 12 | _view_name: 'MapTileView', 13 | _model_name: 'MapTileModel', 14 | 15 | tile_type: '', 16 | scheme: '', 17 | tile_size: 0, 18 | format: '', 19 | additional_params: null, 20 | path: 'maptile/2.1', 21 | headers: {}, 22 | type: 'base', 23 | version: null, 24 | shards: null, 25 | 26 | platform: null, 27 | 28 | }; 29 | } 30 | } 31 | 32 | 33 | MapTileModel.serializers = _.extend({ 34 | platform: { 35 | deserialize: widgets.unpack_models 36 | }, 37 | }, widgets.DOMWidgetModel.serializers); 38 | 39 | 40 | 41 | export class MapTileView extends provider.ProviderView { 42 | create_obj() { 43 | const pltform = this.model.get('platform'); 44 | const pltform_promise = pltform !== null ? this.create_child_view(pltform) : Promise.resolve(null); 45 | 46 | return Promise.all([pltform_promise]).then(result => { 47 | const pltform_view = result[0]; 48 | const platform = pltform_view !== null ? pltform_view.obj : null; 49 | 50 | var mapTilerOptions = {type: this.model.get('type')}; 51 | if (this.model.get('version')) { 52 | mapTilerOptions['version'] = this.model.get('version'); 53 | } 54 | if (this.model.get('shards')) { 55 | mapTilerOptions['shards'] = this.model.get('shards'); 56 | } 57 | if (this.model.get('headers')) { 58 | mapTilerOptions['headers'] = this.model.get('headers'); 59 | } 60 | var mapTiler = platform.getMapTileService(mapTilerOptions); 61 | 62 | var TileType = this.model.get('tile_type'); 63 | var scheme = this.model.get('scheme'); 64 | var TileSize = this.model.get('tile_size'); 65 | var format = this.model.get('format'); 66 | var options = {} 67 | if (this.model.get('additional_params')) { 68 | options['additionalParameters'] = this.model.get('additional_params'); 69 | } 70 | this.obj = mapTiler.createTileProvider(TileType, scheme, TileSize, format, options); 71 | }); 72 | } 73 | 74 | model_events() {} 75 | 76 | mapjs_events() {} 77 | 78 | } -------------------------------------------------------------------------------- /js/lib/provider/MarkerCluster.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const provider = require('./Provider.js'); 6 | const _ = require('lodash'); 7 | const widgets = require('@jupyter-widgets/base'); 8 | 9 | export class MarkerClusterModel extends provider.ProviderModel { 10 | defaults() { 11 | return { 12 | _view_name: 'MarkerClusterView', 13 | _model_name: 'MarkerClusterModel', 14 | 15 | data_points: [], 16 | eps: 32, 17 | min_weight: 2, 18 | min_zoom: 0, 19 | max_zoom: 22, 20 | show_bubble: false, 21 | evt_type: 'tap', 22 | }; 23 | } 24 | } 25 | 26 | 27 | export class MarkerClusterView extends provider.ProviderView { 28 | create_obj() { 29 | var eps = this.model.get('eps'); 30 | var minWeight = this.model.get('min_weight'); 31 | var clusteringOptions = { 32 | minWeight: minWeight, 33 | eps: eps 34 | }; 35 | var minZoom = this.model.get('min_zoom'); 36 | var maxZoom = this.model.get('max_zoom'); 37 | var data_points = this.model.get('data_points'); 38 | var dataPoints = []; 39 | data_points.forEach((point, index) => { 40 | var options = {}; 41 | if (point.weight) { 42 | options['weight'] = point.weight; 43 | } 44 | if (point.data) { 45 | options['data'] = point.data 46 | } 47 | dataPoints.push(new H.clustering.DataPoint(point.lat, point.lng, options.weight, options.data)); 48 | }); 49 | this.obj = new H.clustering.Provider(dataPoints, { 50 | clusteringOptions: clusteringOptions, 51 | min: minZoom, 52 | max: maxZoom 53 | }); 54 | } 55 | 56 | model_events() {} 57 | 58 | mapjs_events() { 59 | var evt_type = this.model.get('evt_type'); 60 | var ui = this.map_view.ui; 61 | this.bubble = null; 62 | var self = this; 63 | 64 | if (this.model.get('show_bubble')) { 65 | this.obj.addEventListener(evt_type, function(evt) { 66 | var position = evt.target.getGeometry(), 67 | data = evt.target.getData().a.data; 68 | if (!self.bubble) { 69 | self.bubble = new H.ui.InfoBubble(position, { 70 | content: data 71 | }); 72 | ui.addBubble(self.bubble); 73 | 74 | } else { 75 | self.bubble.setContent(data); 76 | self.bubble.setPosition(position); 77 | self.bubble.open(); 78 | } 79 | self.map_view.obj.setCenter(position, true); 80 | }); 81 | } 82 | } 83 | 84 | } -------------------------------------------------------------------------------- /js/lib/provider/OMV.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const provider = require('./Provider.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | 8 | export class OMVModel extends provider.ProviderModel { 9 | defaults() { 10 | return { 11 | _view_name: 'OMVView', 12 | _model_name: 'OMVModel', 13 | 14 | path: '', 15 | platform: null, 16 | style: null, 17 | }; 18 | } 19 | } 20 | 21 | OMVModel.serializers = _.extend({ 22 | platform: { 23 | deserialize: widgets.unpack_models 24 | }, 25 | style: { 26 | deserialize: widgets.unpack_models 27 | }, 28 | }, widgets.DOMWidgetModel.serializers); 29 | 30 | 31 | export class OMVView extends provider.ProviderView { 32 | create_obj() { 33 | const pltform = this.model.get('platform'); 34 | const style = this.model.get('style'); 35 | 36 | const style_promise = style !== null ? this.create_child_view(style) : Promise.resolve(null); 37 | const pltform_promise = pltform !== null ? this.create_child_view(pltform) : Promise.resolve(null); 38 | 39 | return Promise.all([pltform_promise, style_promise]).then(result => { 40 | const pltform_view = result[0]; 41 | const style_view = result[1]; 42 | const engineType = H.Map.EngineType["HARP"]; 43 | const platform = pltform_view !== null ? pltform_view.obj : null; 44 | const config = style_view !== null ? style_view.obj.po : null; 45 | const st = new H.map.render.harp.Style(config); 46 | var omvService = platform.getOMVService({ 47 | path: this.model.get('path') 48 | }); 49 | this.obj = new H.service.omv.Provider(omvService, st, {engineType, lg:"ja",}); 50 | }); 51 | } 52 | 53 | model_events() {} 54 | 55 | mapjs_events() {} 56 | 57 | } 58 | -------------------------------------------------------------------------------- /js/lib/provider/Provider.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const widgets = require('@jupyter-widgets/base'); 6 | const _ = require('lodash'); 7 | import H from '@here/maps-api-for-javascript/bin/mapsjs.bundle.harp' 8 | 9 | export class ProviderModel extends widgets.WidgetModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ProviderView', 14 | _model_name: 'ProviderModel', 15 | _view_module: '@here/map-widget-for-jupyter', 16 | _model_module: '@here/map-widget-for-jupyter', 17 | }; 18 | } 19 | } 20 | 21 | ProviderModel.serializers = _.extend(widgets.WidgetModel.serializers); 22 | 23 | export class ProviderView extends widgets.WidgetView { 24 | initialize(parameters) { 25 | super.initialize(parameters); 26 | this.map_view = this.options.map_view; 27 | } 28 | 29 | render() { 30 | return Promise.resolve(this.create_obj()).then(() => { 31 | this.model_events(); 32 | this.mapjs_events(); 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /js/lib/service/DefaultLayers.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const service = require('./Service.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | const _ = require('lodash'); 8 | 9 | export class DefaultLayersModel extends service.ServiceModel { 10 | defaults() { 11 | return { 12 | _view_name: 'DefaultLayersView', 13 | _model_name: 'DefaultLayersModel', 14 | 15 | layer_name: 'vector.normal.map', 16 | tile_size: 512, 17 | ppi: undefined, 18 | 19 | }; 20 | } 21 | } 22 | 23 | 24 | 25 | export class DefaultLayersView extends service.ServiceView { 26 | initialize(parameters) { 27 | super.initialize(parameters); 28 | this.map_view = this.options.parent; 29 | 30 | } 31 | create_obj() { 32 | var ppi = this.model.get('ppi') === null ? undefined : this.model.get('ppi'); 33 | const engineType = H.Map.EngineType['HARP']; 34 | var platform = new H.service.Platform({ 35 | apikey: this.map_view.model.get('api_key') 36 | }); 37 | var defaultLayers = platform.createDefaultLayers({ 38 | tileSize: this.model.get('tile_size'), 39 | ppi: ppi, 40 | engineType, 41 | }); 42 | this.obj = _.get(defaultLayers, this.model.get('layer_name')); 43 | } 44 | 45 | model_events() {} 46 | 47 | mapjs_events() { 48 | // 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /js/lib/service/Platform.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const service = require('./Service.js'); 6 | const widgets = require('@jupyter-widgets/base'); 7 | 8 | export class PlatformModel extends service.ServiceModel { 9 | defaults() { 10 | return { 11 | _view_name: 'PlatformView', 12 | _model_name: 'PlatformModel', 13 | 14 | api_key: null, 15 | services_config: null, 16 | }; 17 | } 18 | } 19 | 20 | 21 | export class PlatformView extends service.ServiceView { 22 | create_obj() { 23 | var services_config = this.model.get('services_config'); 24 | const config = {}; 25 | const getoptions = { 26 | apikey: this.model.get('api_key') 27 | }; 28 | if (services_config) { 29 | Object.keys(services_config).forEach(function(key) { 30 | config[key] = { 31 | baseUrl: new H.service.Url(services_config[key]['scheme'], 32 | services_config[key]['host'], 33 | services_config[key]['path'], 34 | getoptions 35 | ) 36 | }; 37 | }); 38 | } 39 | this.obj = new H.service.Platform({ 40 | apikey: this.model.get('api_key'), 41 | servicesConfig: config 42 | }); 43 | } 44 | 45 | model_events() {} 46 | 47 | mapjs_events() {} 48 | 49 | } -------------------------------------------------------------------------------- /js/lib/service/Service.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019-2024 HERE Europe B.V. 3 | SPDX-License-Identifier: MIT 4 | */ 5 | const widgets = require('@jupyter-widgets/base'); 6 | const _ = require('lodash'); 7 | import H from '@here/maps-api-for-javascript/bin/mapsjs.bundle.harp' 8 | 9 | export class ServiceModel extends widgets.WidgetModel { 10 | defaults() { 11 | return { 12 | // ...super.defaults(), 13 | _view_name: 'ServiceView', 14 | _model_name: 'ServiceModel', 15 | _view_module: '@here/map-widget-for-jupyter', 16 | _model_module: '@here/map-widget-for-jupyter', 17 | }; 18 | } 19 | } 20 | 21 | ServiceModel.serializers = _.extend(widgets.WidgetModel.serializers); 22 | 23 | export class ServiceView extends widgets.WidgetView { 24 | initialize(parameters) { 25 | super.initialize(parameters); 26 | } 27 | 28 | render() { 29 | return Promise.resolve(this.create_obj()).then(() => { 30 | this.model_events(); 31 | this.mapjs_events(); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /js/lib/static/fullscreen.css: -------------------------------------------------------------------------------- 1 | /* 2 | .mapjs-control-fullscreen{ 3 | width: 30px; 4 | height: 30px; 5 | }*/ 6 | 7 | a.mapjs-control-fullscreen-button{ 8 | display: block; 9 | width: 30px; 10 | height: 30px; 11 | line-height: 30px; 12 | 13 | } 14 | .mapjs-control-fullscreen a { 15 | 16 | background:#fff url(fullscreen.png) no-repeat 0 0; 17 | background-size:26px 52px; 18 | } 19 | .mapjs-control-fullscreen a { 20 | background-position: 2px 2px; 21 | } 22 | .mapjs-fullscreen-on .mapjs-control-fullscreen a { 23 | background-position:0 -26px; 24 | } 25 | .mapjs-touch.mapjs-fullscreen-on .mapjs-control-fullscreen a { 26 | background-position: 2px -24px; 27 | } 28 | 29 | /* Do not combine these two rules; IE will break. 30 | .mapjs-container:-webkit-full-screen { 31 | width:100%!important; 32 | height:100%!important; 33 | }*/ 34 | .mapjs-fullscreen-on { 35 | width:100%!important; 36 | height:100%!important; 37 | } 38 | 39 | .mapjs-pseudo-fullscreen { 40 | position:fixed!important; 41 | width:100%!important; 42 | height:100%!important; 43 | top:0!important; 44 | left:0!important; 45 | z-index:99999; 46 | } 47 | 48 | @media 49 | (-webkit-min-device-pixel-ratio:2), 50 | (min-resolution:192dpi) { 51 | .mapjs-control-fullscreen a { 52 | background-image:url(fullscreen@2x.png); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /js/lib/static/fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/js/lib/static/fullscreen.png -------------------------------------------------------------------------------- /js/lib/static/fullscreen@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/js/lib/static/fullscreen@2x.png -------------------------------------------------------------------------------- /js/lib/static/layout.css: -------------------------------------------------------------------------------- 1 | .leaflet-sbs-range { 2 | position: absolute; 3 | top: 50%; 4 | width: 100%; 5 | z-index: 999; 6 | } 7 | .leaflet-sbs-divider { 8 | position: absolute; 9 | top: 0; 10 | bottom: 0; 11 | left: 50%; 12 | margin-left: -2px; 13 | width: 4px; 14 | background-color: #fff; 15 | pointer-events: none; 16 | z-index: 999; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /js/lib/static/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/js/lib/static/loader.gif -------------------------------------------------------------------------------- /js/lib/static/map-view.css: -------------------------------------------------------------------------------- 1 | .jupyter-widgets.mapjs-widgets { 2 | height: 400px; 3 | overflow: hidden; 4 | flex: 1 1 auto; 5 | } 6 | 7 | .jp-LinkedOutputView .jupyter-widgets.mapjs-widgets { 8 | min-height: 360px; /* Min-height required for mirred output in jlab < 0.31.6 */ 9 | height: 100%; 10 | } 11 | 12 | /* Leaflet crispness override */ 13 | .crisp-image { 14 | /* Preserve crisp pixels with scaled up images */ 15 | image-rendering: optimizeSpeed; /* Legal fallback */ 16 | image-rendering: -moz-crisp-edges; /* Firefox */ 17 | image-rendering: -o-crisp-edges; /* Opera */ 18 | image-rendering: -webkit-optimize-contrast; /* Safari */ 19 | image-rendering: optimize-contrast; /* CSS3 Proposed */ 20 | image-rendering: crisp-edges; /* CSS4 Proposed */ 21 | image-rendering: pixelated; /* CSS4 Proposed */ 22 | -ms-interpolation-mode: nearest-neighbor; /* IE8+ */ 23 | } -------------------------------------------------------------------------------- /js/lib/static/range-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/js/lib/static/range-icon.png -------------------------------------------------------------------------------- /js/lib/static/range.css: -------------------------------------------------------------------------------- 1 | .leaflet-sbs-range { 2 | -webkit-appearance: none; 3 | display: inline-block!important; 4 | vertical-align: middle; 5 | height: 0; 6 | padding: 0; 7 | margin: 0; 8 | border: 0; 9 | background: rgba(0, 0, 0, 0.25); 10 | min-width: 100px; 11 | cursor: pointer; 12 | pointer-events: none; 13 | z-index: 999; 14 | } 15 | .leaflet-sbs-range::-ms-fill-upper { 16 | background: transparent; 17 | } 18 | .leaflet-sbs-range::-ms-fill-lower { 19 | background: rgba(255, 255, 255, 0.25); 20 | } 21 | /* Browser thingies */ 22 | 23 | .leaflet-sbs-range::-moz-range-track { 24 | opacity: 0; 25 | } 26 | .leaflet-sbs-range::-ms-track { 27 | opacity: 0; 28 | } 29 | .leaflet-sbs-range::-ms-tooltip { 30 | display: none; 31 | } 32 | /* For whatever reason, these need to be defined 33 | * on their own so dont group them */ 34 | 35 | .leaflet-sbs-range::-webkit-slider-thumb { 36 | -webkit-appearance: none; 37 | margin: 0; 38 | padding: 0; 39 | background: #fff; 40 | height: 40px; 41 | width: 40px; 42 | border-radius: 20px; 43 | cursor: ew-resize; 44 | pointer-events: auto; 45 | border: 1px solid #ddd; 46 | background-image: url(range-icon.png); 47 | background-position: 50% 50%; 48 | background-repeat: no-repeat; 49 | background-size: 40px 40px; 50 | } 51 | .leaflet-sbs-range::-ms-thumb { 52 | margin: 0; 53 | padding: 0; 54 | background: #fff; 55 | height: 40px; 56 | width: 40px; 57 | border-radius: 20px; 58 | cursor: ew-resize; 59 | pointer-events: auto; 60 | border: 1px solid #ddd; 61 | background-image: url(range-icon.png); 62 | background-position: 50% 50%; 63 | background-repeat: no-repeat; 64 | background-size: 40px 40px; 65 | } 66 | .leaflet-sbs-range::-moz-range-thumb { 67 | padding: 0; 68 | right: 0 ; 69 | background: #fff; 70 | height: 40px; 71 | width: 40px; 72 | border-radius: 20px; 73 | cursor: ew-resize; 74 | pointer-events: auto; 75 | border: 1px solid #ddd; 76 | background-image: url(range-icon.png); 77 | background-position: 50% 50%; 78 | background-repeat: no-repeat; 79 | background-size: 40px 40px; 80 | } 81 | .leaflet-sbs-range:disabled::-moz-range-thumb { 82 | cursor: default; 83 | } 84 | .leaflet-sbs-range:disabled::-ms-thumb { 85 | cursor: default; 86 | } 87 | .leaflet-sbs-range:disabled::-webkit-slider-thumb { 88 | cursor: default; 89 | } 90 | .leaflet-sbs-range:disabled { 91 | cursor: default; 92 | } 93 | .leaflet-sbs-range:focus { 94 | outline: none!important; 95 | } 96 | .leaflet-sbs-range::-moz-focus-outer { 97 | border: 0; 98 | } -------------------------------------------------------------------------------- /js/lib/static/search-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-map-widget-for-jupyter/0a10e46ca02e9eae1e7bcee356c3754a0efb1831/js/lib/static/search-icon.png -------------------------------------------------------------------------------- /js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@here/map-widget-for-jupyter", 3 | "version": "1.2.0", 4 | "description": "Use HERE Maps API for JavaScript in your Jupyter Notebook.", 5 | "author": { 6 | "name": "HERE Europe B.V.", 7 | "url": "https://here.com" 8 | }, 9 | "license": "MIT", 10 | "main": "lib/index.js", 11 | "repository": { 12 | "type": "git", 13 | "url": "ssh://git@github.com:heremaps/here-map-widget-for-jupyter.git", 14 | "directory": "js" 15 | }, 16 | "keywords": [ 17 | "jupyter", 18 | "widgets", 19 | "ipython", 20 | "ipywidgets", 21 | "jupyterlab-extension" 22 | ], 23 | "files": [ 24 | "lib/**/*.js", 25 | "dist/*.js", 26 | "lib/**/*.css", 27 | "dist/*.css", 28 | "lib/**/*.png", 29 | "dist/*.png", 30 | "lib/**/*.gif", 31 | "dist/*.gif", 32 | "dist/*.map", 33 | "LICENSE" 34 | ], 35 | "scripts": { 36 | "clean": "rimraf dist/ && rimraf ../here_map_widget/labextension/ && rimraf ../here_map_widget/nbextension", 37 | "prepublish": "webpack", 38 | "build": "webpack", 39 | "build:extensions": "webpack && jupyter labextension build .", 40 | "watch": "webpack --watch --mode=development", 41 | "test": "echo \"Error: no test specified\" && exit 1" 42 | }, 43 | "devDependencies": { 44 | "@jupyterlab/builder": "^3.0.0", 45 | "css-loader": "^3.4.2", 46 | "file-loader": "^5.0.2", 47 | "install": "^0.13.0", 48 | "rimraf": "^2.6.1", 49 | "style-loader": "^1.1.2", 50 | "webpack": "^5.11.1", 51 | "webpack-cli": "^3.3.12" 52 | }, 53 | "dependencies": { 54 | "@here/maps-api-for-javascript": "^1.60.0", 55 | "@jupyter-widgets/base": "^2 || ^3 || ^4", 56 | "@phosphor/messaging": "^1.3.0", 57 | "@phosphor/widgets": "^1.9.3", 58 | "@turf/centroid": "^6.0.2", 59 | "@turf/helpers": "^6.1.4", 60 | "buffer": "^6.0.3", 61 | "crypto-browserify": "^3.12.0", 62 | "events": "^3.3.0", 63 | "flat": "^5.0.2", 64 | "lodash": "^4.17.20", 65 | "run": "^1.4.0", 66 | "stream-browserify": "^3.0.0" 67 | }, 68 | "jupyterlab": { 69 | "extension": "lib/labplugin", 70 | "outputDir": "../here_map_widget/labextension", 71 | "webpackConfig": "../jlab/webpack.config.js", 72 | "sharedPackages": { 73 | "@jupyter-widgets/base": { 74 | "bundled": false, 75 | "singleton": true 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /map-widget-for-jupyter.json: -------------------------------------------------------------------------------- 1 | { 2 | "load_extensions": { 3 | "@here/map-widget-for-jupyter/extension": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["jupyter_packaging>=0.7.9", "jupyterlab>=3.0.0,==3.*", "setuptools>=40.8.0", "wheel"] 3 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ipywidgets>=7.6.0,<8 2 | branca>=0.3.1,<0.5 3 | xyzservices>=2021.8.0 -------------------------------------------------------------------------------- /requirements_dev.txt: -------------------------------------------------------------------------------- 1 | black[jupyter] 2 | isort 3 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | 4 | 5 | [metadata] 6 | name = here-map-widget-for-jupyter 7 | author = HERE Europe B.V. 8 | description = A widget that enables you to use HERE Maps API for JavaScript in Jupyter Notebook. 9 | long-description = file: README.md 10 | license = MIT 11 | platform = any 12 | keywords = 13 | ipython 14 | jupyter 15 | widgets 16 | here-map-widget-for-jupyter 17 | classifiers = 18 | Development Status :: 5 - Production/Stable 19 | Framework :: IPython 20 | Intended Audience :: Developers 21 | Intended Audience :: Science/Research 22 | Topic :: Software Development :: Libraries 23 | License :: OSI Approved :: MIT License 24 | Operating System :: OS Independent 25 | Programming Language :: Python :: 3 26 | Programming Language :: Python :: 3 :: Only 27 | Programming Language :: Python :: 3.7 28 | Programming Language :: Python :: 3.8 29 | Programming Language :: Python :: 3.9 30 | [options] 31 | python_requires >= 3.6 32 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019-2024 HERE Europe B.V. 2 | # SPDX-License-Identifier: MIT 3 | 4 | """Project setup file.""" 5 | 6 | import os 7 | 8 | from jupyter_packaging import ( 9 | combine_commands, 10 | create_cmdclass, 11 | ensure_targets, 12 | get_version, 13 | install_npm, 14 | skip_if_exists, 15 | ) 16 | from setuptools import find_packages, setup 17 | 18 | here = os.path.dirname(os.path.abspath(__file__)) 19 | 20 | name = "here_map_widget" 21 | 22 | version = get_version(os.path.join(name, "_version.py")) 23 | 24 | js_dir = os.path.join(here, "js") 25 | 26 | # Representative files that should exist after a successful build 27 | jstargets = [ 28 | os.path.join("here_map_widget/nbextension", "index.js"), 29 | os.path.join("here_map_widget/labextension", "package.json"), 30 | ] 31 | 32 | data_files_spec = [ 33 | ( 34 | "share/jupyter/nbextensions/@here/map-widget-for-jupyter", 35 | "here_map_widget/nbextension", 36 | "*.*", 37 | ), 38 | ( 39 | "share/jupyter/labextensions/@here/map-widget-for-jupyter", 40 | "here_map_widget/labextension", 41 | "**", 42 | ), 43 | ("etc/jupyter/nbconfig/notebook.d", ".", "map-widget-for-jupyter.json"), 44 | ] 45 | 46 | cmdclass = create_cmdclass("jsdeps", data_files_spec=data_files_spec) 47 | js_command = combine_commands( 48 | install_npm(js_dir, npm=["yarn"], build_cmd="build:extensions"), 49 | # install_npm(js_dir, npm=["npm"], build_cmd="build:extensions"), 50 | ensure_targets(jstargets), 51 | ) 52 | 53 | is_repo = os.path.exists(os.path.join(here, ".git")) 54 | if is_repo: 55 | cmdclass["jsdeps"] = js_command 56 | else: 57 | cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command) 58 | 59 | # Get the core dependencies and installs 60 | with open(os.path.join(here, "requirements.txt"), encoding="utf-8") as f: 61 | all_reqs = f.read().split("\n") 62 | 63 | with open(os.path.join(here, "README.md"), encoding="utf-8") as f: 64 | long_description = f.read() 65 | 66 | # get extra dependencies 67 | with open(os.path.join(here, "requirements_dev.txt"), encoding="utf-8") as f: 68 | dev_reqs = f.read().strip().split("\n") 69 | 70 | install_requires = [x.strip() for x in all_reqs if "git+" not in x] 71 | dependency_links = [x.strip().replace("git+", "") for x in all_reqs if x.startswith("git+")] 72 | 73 | 74 | setup_args = { 75 | "version": version, 76 | "include_package_data": True, 77 | "install_requires": install_requires, 78 | "dependency_links": dependency_links, 79 | "packages": find_packages(), 80 | "zip_safe": False, 81 | "cmdclass": cmdclass, 82 | "long_description": long_description, 83 | "long_description_content_type": "text/markdown", 84 | "extras_require": {"dev": dev_reqs}, 85 | } 86 | 87 | setup(**setup_args) 88 | --------------------------------------------------------------------------------