Skip to content

Commit

Permalink
Merge pull request #56 from eodaGmbH/feature/no-nav-control-by-default
Browse files Browse the repository at this point in the history
Feature/no nav control by default
  • Loading branch information
crazycapivara authored Jun 17, 2024
2 parents df51315 + 8129644 commit 78c7a58
Show file tree
Hide file tree
Showing 23 changed files with 109 additions and 215 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for MapLibre for Python

## maplibre v0.2.1

* Do not add navigation control by default (#31)

## maplibre v0.2.0

* Support Deck.GL layers (#28)
Expand Down
9 changes: 8 additions & 1 deletion docs/examples/airports/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
render_maplibregl,
)
from maplibre.basemaps import Carto
from maplibre.controls import Marker, MarkerOptions, Popup, PopupOptions
from maplibre.controls import (
Marker,
MarkerOptions,
NavigationControl,
Popup,
PopupOptions,
)
from maplibre.sources import GeoJSONSource
from maplibre.utils import GeometryType, df_to_geojson
from shiny import App, ui
Expand Down Expand Up @@ -69,6 +75,7 @@ def get_color(airport_type: str) -> str:

def create_map() -> Map:
m = Map(map_options)
m.add_control(NavigationControl())
m.add_layer(airport_circles)
for _, r in airports_data.iterrows():
marker = Marker(
Expand Down
158 changes: 13 additions & 145 deletions docs/examples/custom_basemap/app.html

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions docs/examples/custom_basemap/app.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
import webbrowser

from maplibre import Layer, LayerType, Map, MapOptions
from maplibre.basemaps import construct_basemap_style
from maplibre.controls import NavigationControl
from maplibre.sources import GeoJSONSource

file_name = "/tmp/pymaplibregl_temp.html"
file_name = "docs/examples/custom_basemap/app.html"

bg_layer = Layer(
type=LayerType.BACKGROUND,
Expand Down Expand Up @@ -45,6 +45,7 @@

def create_map():
m = Map(map_options)
m.add_control(NavigationControl())
m.add_layer(
Layer(
type=LayerType.CIRCLE,
Expand All @@ -61,9 +62,6 @@ def create_map():

if __name__ == "__main__":
m = create_map()
if len(sys.argv) == 2:
file_name = sys.argv[1]

with open(file_name, "w") as f:
f.write(m.to_html())

Expand Down
8 changes: 4 additions & 4 deletions docs/examples/deckgl_layer/app.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/examples/deckgl_layer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from maplibre import Map, MapOptions, render_maplibregl
from maplibre.basemaps import Carto
from maplibre.controls import NavigationControl
from maplibre.ui import use_deckgl

# from shiny import reactive
Expand All @@ -18,7 +19,7 @@
pitch=40,
)
)

m.add_control(NavigationControl())

deck_grid_layer = {
"@@type": "GridLayer",
Expand Down
1 change: 0 additions & 1 deletion docs/examples/deckgl_layer/column_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from maplibre import Map, MapOptions, render_maplibregl
from maplibre.basemaps import Carto
from maplibre.ui import use_deckgl

# from shiny import reactive
from shiny.express import input, render, ui

Expand Down
2 changes: 2 additions & 0 deletions docs/examples/deckgl_multiple_layers/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests as req
from maplibre import Map, MapOptions, render_maplibregl
from maplibre.basemaps import Carto
from maplibre.controls import NavigationControl
from maplibre.ui import use_deckgl
from shiny.express import input, render, ui

Expand All @@ -19,6 +20,7 @@
pitch=30,
)
)
m.add_control(NavigationControl())

deck_geojson_layer = {
"@@type": "GeoJsonLayer",
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/earthquake_clusters/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
render_maplibregl,
)
from maplibre.basemaps import Carto
from maplibre.controls import NavigationControl
from maplibre.sources import GeoJSONSource
from shiny import App, reactive, ui

Expand Down Expand Up @@ -74,6 +75,7 @@

def create_map() -> Map:
m = Map(map_options)
m.add_control(NavigationControl())
m.add_source(EARTHQUAKE_SOURCE, earthquakes_source)
m.add_layer(earthquake_clusters)
m.add_layer(earthquake_circles)
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/every_person_in_manhattan/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
render_maplibregl,
)
from maplibre.basemaps import Carto
from maplibre.controls import ScaleControl
from maplibre.controls import NavigationControl, ScaleControl
from maplibre.sources import GeoJSONSource
from maplibre.utils import df_to_geojson
from shiny import App, reactive, ui
Expand Down Expand Up @@ -57,6 +57,7 @@

def create_map() -> Map:
m = Map(map_options)
m.add_control(NavigationControl())
m.add_control(ScaleControl(), position="bottom-left")
m.add_layer(every_person_in_manhattan_circles)
return m
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/geopandas/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import webbrowser

from maplibre import Layer, LayerType, Map, MapOptions
from maplibre.controls import NavigationControl
from maplibre.sources import GeoJSONSource
from maplibre.utils import geopandas_to_geojson

Expand All @@ -28,6 +29,7 @@

def create_map():
m = Map(map_options)
m.add_control(NavigationControl())
m.add_layer(wilderness_layer)
m.add_tooltip(LAYER_ID, "NAME")
return m
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/layer_order/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests as req
from maplibre import Layer, LayerType, Map, MapOptions, render_maplibregl
from maplibre.basemaps import Carto, construct_carto_basemap_url
from maplibre.controls import NavigationControl
from maplibre.sources import GeoJSONSource
from shiny.express import input, render, ui

Expand All @@ -25,6 +26,7 @@
hash=True,
)
)
m.add_control(NavigationControl())
m.add_layer(
Layer(
id="urban-areas-fill",
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/road_safety/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
output_maplibregl,
render_maplibregl,
)
from maplibre.controls import NavigationControl
from maplibre.sources import GeoJSONSource
from maplibre.utils import df_to_geojson
from shiny import App, reactive, ui
Expand Down Expand Up @@ -72,6 +73,7 @@ def create_h3_grid(res=RESOLUTION) -> dict:

def create_map() -> Map:
m = Map(map_options)
m.add_control(NavigationControl())
m.add_layer(h3_layer)
m.add_tooltip("road-safety", "count")
return m
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/vancouver_blocks/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
render_maplibregl,
)
from maplibre.basemaps import Carto
from maplibre.controls import ScaleControl
from maplibre.controls import NavigationControl, ScaleControl
from maplibre.sources import GeoJSONSource
from shiny import App, reactive, ui

Expand Down Expand Up @@ -64,6 +64,7 @@

def create_map() -> Map:
m = Map(map_options)
m.add_control(NavigationControl())
m.add_control(ScaleControl(), position="bottom-left")
m.add_source(SOURCE_ID, vancouver_blocks_source)
m.add_layer(vancouver_blocks_lines)
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/where_is_the_iss/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
output_maplibregl,
render_maplibregl,
)
from maplibre.controls import NavigationControl
from maplibre.sources import GeoJSONSource
from shiny import App, reactive, ui

Expand Down Expand Up @@ -51,6 +52,7 @@ def server(input, output, session):
@render_maplibregl
def mapylibre():
m = Map(MapOptions(center=lng_lat, zoom=3))
m.add_control(NavigationControl())
m.set_paint_property("water", "fill-color", "darkblue")
m.add_source(
SOURCE_ID_ISS_LAST_POSITIONS, GeoJSONSource(data=feature_collection)
Expand Down
Loading

0 comments on commit 78c7a58

Please sign in to comment.