|
12 | 12 | from .models.sources import OSM |
13 | 13 | from .models.view import View |
14 | 14 | from .styles import FlatStyle |
| 15 | +from .utils import default_crs_transformer |
15 | 16 |
|
16 | 17 |
|
17 | 18 | class Map(object): |
@@ -55,22 +56,27 @@ def add_layer_call(self, layer_id: str, method_name: str, *args: Any): |
55 | 56 | def add_view_call(self, method_name: str, *args: Any) -> None: |
56 | 57 | view_call = dict(method=method_name, args=args) |
57 | 58 | self.add_call("applyCallToView", view_call) |
58 | | - |
59 | 59 |
|
60 | 60 | def set_zoom(self, zoom_level: float | int) -> None: |
61 | 61 | """Set the zoom level ot the map view |
62 | | - |
| 62 | +
|
63 | 63 | Args: |
64 | 64 | zoom_level (float | int): The zoom level of the view |
65 | 65 | """ |
66 | 66 | self.add_view_call("setZoom", zoom_level) |
67 | 67 |
|
68 | | - def set_center(self, lonlat: tuple[float, float] = None, center: tuple[float, float] = None) -> None: |
69 | | - from .utils import default_crs_transformer |
70 | | - |
| 68 | + def set_center( |
| 69 | + self, lonlat: tuple[float, float] = None, center: tuple[float, float] = None |
| 70 | + ) -> None: |
| 71 | + """Set the center of the map view |
| 72 | + |
| 73 | + Args: |
| 74 | + lonlat (tuple[float, float]): center as (lon, lat) |
| 75 | + center (tuple[float, float]) center as (x, y) of view projection |
| 76 | + """ |
71 | 77 | center = center or default_crs_transformer().transform(*lonlat) |
72 | 78 | self.add_view_call("setCenter", center) |
73 | | - |
| 79 | + |
74 | 80 | def add_layer(self, layer: LayerT | LayerLike | dict) -> None: |
75 | 81 | """Add a layer to the map |
76 | 82 |
|
|
0 commit comments