|
1 | 1 | import os |
2 | 2 |
|
3 | 3 | from maplibre import Map, MapOptions |
4 | | -from maplibre.basemaps import BasemapStyle, MapTiler |
| 4 | +from maplibre.__future__.controls import GeocodingControl |
| 5 | +from maplibre.basemaps import Basemap, MapTiler |
5 | 6 |
|
6 | 7 | # from maplibre.sky import Sky |
7 | 8 | # from maplibre.light import Light |
8 | | -from maplibre.config import options |
| 9 | +from maplibre.config import config |
9 | 10 | from maplibre.controls import ( |
10 | 11 | ControlPosition, |
11 | 12 | MapTilerGeocodingControl, |
12 | 13 | GlobeControl, |
13 | 14 | NavigationControl, |
14 | 15 | ) |
15 | 16 |
|
16 | | -print(options.maptiler_api_key_env_var) |
| 17 | +print(config.maptiler_api_key_env_var) |
17 | 18 | # os.environ[options.maptiler_api_key_env_var] = "your-api-key" |
18 | | -print(options.maptiler_api_key) |
| 19 | +print(config.maptiler_api_key) |
19 | 20 |
|
20 | 21 | # sky = Sky(atmosphere_blend=["interpolate", ["linear"], ["zoom"], 0, 1, 5, 1, 7, 0]) |
21 | 22 | # light = Light(anchor="map", position=[1.5, 90, 80], intensity=0.5) |
22 | 23 |
|
23 | 24 |
|
24 | | -style = BasemapStyle.maptiler_url(MapTiler.SATELLITE) |
| 25 | +style = Basemap.maptiler_url(MapTiler.SATELLITE) |
25 | 26 | # print(style) |
26 | 27 |
|
27 | 28 | map_options = MapOptions(style=style) |
|
31 | 32 | controls=[ |
32 | 33 | NavigationControl(), |
33 | 34 | GlobeControl(), |
34 | | - MapTilerGeocodingControl(position=ControlPosition.TOP_LEFT), |
| 35 | + MapTilerGeocodingControl( |
| 36 | + collapsed=True, |
| 37 | + show_place_type="always", |
| 38 | + country="de", |
| 39 | + position=ControlPosition.TOP_LEFT |
| 40 | + ), |
| 41 | + # GeocodingControl(collapsed=True, position=ControlPosition.TOP_LEFT) |
35 | 42 | ], |
36 | 43 | ) |
37 | 44 | # m.set_light(light) |
| 45 | +print(m._geocoder_type) |
38 | 46 | m.save(preview=True) |
0 commit comments