-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from eodaGmbH/release/v0.1.2
Release/v0.1.2
- Loading branch information
Showing
71 changed files
with
1,712 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import geopandas as gpd | ||
import pandas as pd | ||
from maplibre import ( | ||
Layer, | ||
LayerType, | ||
Map, | ||
MapContext, | ||
MapOptions, | ||
output_maplibregl, | ||
render_maplibregl, | ||
) | ||
from maplibre.basemaps import Carto | ||
from maplibre.controls import ScaleControl | ||
from maplibre.sources import GeoJSONSource | ||
from maplibre.utils import geopandas_to_geojson | ||
from shiny import App, reactive, ui | ||
|
||
MALE_COLOR = "rgb(0, 128, 255)" | ||
FEMALE_COLOR = "rgb(255, 0, 128)" | ||
LAYER_ID = "every-person-in-manhattan-circles" | ||
CIRCLE_RADIUS = 2 | ||
|
||
point_data = pd.read_json( | ||
"https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/scatterplot/manhattan.json" | ||
) | ||
|
||
point_data.columns = ["lng", "lat", "sex"] | ||
|
||
point_data = gpd.GeoDataFrame( | ||
point_data["sex"], geometry=gpd.points_from_xy(point_data.lng, point_data.lat) | ||
) | ||
|
||
every_person_in_manhattan_source = GeoJSONSource(data=geopandas_to_geojson(point_data)) | ||
|
||
|
||
every_person_in_manhattan_circles = Layer( | ||
type=LayerType.CIRCLE, | ||
id=LAYER_ID, | ||
source=every_person_in_manhattan_source, | ||
paint={ | ||
"circle-color": ["match", ["get", "sex"], 1, MALE_COLOR, FEMALE_COLOR], | ||
"circle-radius": CIRCLE_RADIUS, | ||
}, | ||
) | ||
|
||
map_options = MapOptions( | ||
style=Carto.POSITRON, | ||
bounds=point_data.total_bounds, | ||
fit_bounds_options={"padding": 20}, | ||
) | ||
|
||
app_ui = ui.page_fluid( | ||
ui.panel_title("Every Person in Manhattan"), | ||
output_maplibregl("maplibre", height=600), | ||
ui.input_slider("radius", "Radius", value=CIRCLE_RADIUS, min=1, max=5), | ||
) | ||
|
||
|
||
def server(input, output, session): | ||
@render_maplibregl | ||
def maplibre(): | ||
m = Map(map_options) | ||
m.add_control(ScaleControl(), position="bottom-left") | ||
m.add_layer(every_person_in_manhattan_circles) | ||
return m | ||
|
||
@reactive.Effect | ||
@reactive.event(input.radius, ignore_init=True) | ||
async def radius(): | ||
async with MapContext("maplibre") as m: | ||
m.set_paint_property(LAYER_ID, "circle-radius", input.radius()) | ||
|
||
|
||
app = App(app_ui, server) | ||
|
||
if __name__ == "__main__": | ||
app.run() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "feature/examples" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
IMAGE_NAME: hike-animation | ||
VERSION: latest | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the Docker image | ||
run: | | ||
cd docs/examples/hike | ||
docker build . --file Dockerfile --tag $IMAGE_NAME | ||
- name: Log in to registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/$GITHUB_REPOSITORY/$IMAGE_NAME | ||
# repository name must be lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
IMAGE_NAME: airports | ||
VERSION: latest | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the Docker image | ||
run: | | ||
cd docs/examples/airports | ||
docker build . --file Dockerfile --tag $IMAGE_NAME | ||
- name: Log in to registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/$GITHUB_REPOSITORY/$IMAGE_NAME | ||
# repository name must be lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Python package | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# You can test your matrix by printing the current Python version | ||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
- name: Install Poetry and pytest | ||
run: pip install poetry pytest | ||
- name: Install package | ||
run: poetry install | ||
- name: Test package | ||
run: | | ||
poetry run pytest | ||
poetry run pytest --doctest-modules maplibre --ignore maplibre/ipywidget.py | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changelog for MapLibre for Python | ||
|
||
## maplibre v0.1.2 | ||
|
||
* Add `Map.set_data` | ||
* Add `Map.set_visibility` | ||
* Do not import `ipywidget.MapWidget` in `__init__` and skip tests for `MapWidget`, because it causes a `core dumped` error, see [anywidget issue](https://github.com/manzt/anywidget/issues/374) | ||
* Remove `requests` dependency | ||
* Remove dead code | ||
* Add more examples | ||
|
||
## maplibre v0.1.1 | ||
|
||
* Initial PyPI release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.