diff --git a/docs/changelog.md b/docs/changelog.md index bf1ecb2ffc..dfa3d8bfe0 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,81 @@ # Changelog +## v0.27.1 - Oct 17, 2023 + +**What's Changed** + +- Add global buildings example by @giswqs in [#569](https://github.com/opengeos/leafmap/pull/569) +- Add ipyleaflet support for PMTiles by @giswqs in [#575](https://github.com/opengeos/leafmap/pull/575) +- fix numpy.ndarray.interp error #577 by @kongdd in [#578](https://github.com/opengeos/leafmap/pull/578) + +**New Contributors** + +- @kongdd made their first contribution in [#578](https://github.com/opengeos/leafmap/pull/578) + +**Full Changelog**: [v0.27.0...v0.27.1](https://github.com/opengeos/leafmap/compare/v0.27.0...v0.27.1) + +## v0.27.0 - Sep 25, 2023 + +**What's Changed** + +- Add start_server function for pmtiles by @giswqs in [#563](https://github.com/opengeos/leafmap/pull/563) +- Add support for PMTiles by @giswqs in [#566](https://github.com/opengeos/leafmap/pull/566) +- Improve PMTiles functions by @giswqs in [#567](https://github.com/opengeos/leafmap/pull/567) + +**Full Changelog**: [v0.26.0...v0.27.0](https://github.com/opengeos/leafmap/compare/v0.26.0...v0.27.0) + +## v0.26.0 - Sep 20, 2023 + +**What's Changed** + +- Add support for PMTiles by @giswqs in [#560](https://github.com/opengeos/leafmap/pull/560) +- Add example for visualizing overture pmtiles by @giswqs in [#561](https://github.com/opengeos/leafmap/pull/561) + +**Full Changelog**: [v0.25.3...v0.26.0](https://github.com/opengeos/leafmap/compare/v0.25.3...v0.26.0) + +## v0.25.3 - Sep 19, 2023 + +**What's Changed** + +- Add widget template by @giswqs in [#557](https://github.com/opengeos/leafmap/pull/557) +- Update EE dataset link by @giswqs in [#558](https://github.com/opengeos/leafmap/pull/558) + +**Full Changelog**: [v0.25.2...v0.25.3](https://github.com/opengeos/leafmap/compare/v0.25.2...v0.25.3) + +## v0.25.2 - Sep 16, 2023 + +**What's Changed** + +- Update Google Buildings notebook by @giswqs in [#551](https://github.com/opengeos/leafmap/pull/551) +- Add function for convert building csv to vector by @giswqs in [#552](https://github.com/opengeos/leafmap/pull/552) +- Add add_ee_layer function by @giswqs in [#553](https://github.com/opengeos/leafmap/pull/553) + +**Full Changelog**: [v0.25.1...v0.25.2](https://github.com/opengeos/leafmap/compare/v0.25.1...v0.25.2) + +## v0.25.1 - Sep 14, 2023 + +**What's Changed** + +- Add support for downloading google buildings by @giswqs in [#550](https://github.com/opengeos/leafmap/pull/550) + +**Full Changelog**: [v0.25.0...v0.25.1](https://github.com/opengeos/leafmap/compare/v0.25.0...v0.25.1) + +## v0.25.0 - Sep 14, 2023 + +**What's Changed** + +- Add support for downloading MS building footprints by @giswqs in [#549](https://github.com/opengeos/leafmap/pull/549) + +**Full Changelog**: [v0.24.4...v0.25.0](https://github.com/opengeos/leafmap/compare/v0.24.4...v0.25.0) + +## v0.24.4 - Sep 12, 2023 + +**What's Changed** + +- Fix basemap issue by @giswqs in [#545](https://github.com/opengeos/leafmap/pull/545) + +**Full Changelog**: [v0.24.3...v0.24.4](https://github.com/opengeos/leafmap/compare/v0.24.3...v0.24.4) + ## v0.24.3 - Sep 12, 2023 **What's Changed** @@ -30,19 +106,19 @@ ## v0.24.0 - Sep 4, 2023 -## What's Changed +**What's Changed** - Fix netcdf_to_tif to correctly shift longitude with custom variable name by @jovanovski in #529 - Add array_to_image function by @giswqs in #530 - Add images_to_tiles function by @giswqs in #531 -## New Contributors +**New Contributors** - @jovanovski made their first contribution in #529 ## v0.23.4 - Aug 31, 2023 -## What's Changed +**What's Changed** - Update docs by @giswqs in #513 - Update logo by @giswqs in #517 diff --git a/leafmap/__init__.py b/leafmap/__init__.py index 6157a699b9..a9504faf6e 100644 --- a/leafmap/__init__.py +++ b/leafmap/__init__.py @@ -2,7 +2,7 @@ __author__ = """Qiusheng Wu""" __email__ = "giswqs@gmail.com" -__version__ = "0.27.0" +__version__ = "0.27.1" import os diff --git a/leafmap/common.py b/leafmap/common.py index a42f01bd7c..a404389fab 100644 --- a/leafmap/common.py +++ b/leafmap/common.py @@ -3696,7 +3696,7 @@ def numpy_to_image( if np_array.dtype == np.float64 or np_array.dtype == np.float32: # Convert the array to uint8 # np_array = (np_array * 255).astype(np.uint8) - np_array.interp(np_array, (np_array.min(), np_array.max()), (0, 255)).astype( + np.interp(np_array, (np_array.min(), np_array.max()), (0, 255)).astype( np.uint8 ) else: diff --git a/leafmap/leafmap.py b/leafmap/leafmap.py index 0a526ff871..7a64345953 100644 --- a/leafmap/leafmap.py +++ b/leafmap/leafmap.py @@ -592,6 +592,56 @@ def add_vector_tile( add_vector_tile_layer = add_vector_tile + def add_pmtiles( + self, + url, + style={}, + name="PMTiles", + show=True, + zoom_to_layer=True, + **kwargs, + ): + """ + Adds a PMTiles layer to the map. This function is not officially supported yet by ipyleaflet yet. + Install it with the following command: + pip install git+https://github.com/giswqs/ipyleaflet.git@pmtiles + + Args: + url (str): The URL of the PMTiles file. + style (str, optional): The CSS style to apply to the layer. Defaults to None. + See https://docs.mapbox.com/style-spec/reference/layers/ for more info. + name (str, optional): The name of the layer. Defaults to None. + show (bool, optional): Whether the layer should be shown initially. Defaults to True. + zoom_to_layer (bool, optional): Whether to zoom to the layer extent. Defaults to True. + **kwargs: Additional keyword arguments to pass to the PMTilesLayer constructor. + + Returns: + None + """ + + try: + if "sources" in kwargs: + del kwargs["sources"] + + if "version" in kwargs: + del kwargs["version"] + + layer = ipyleaflet.PMTilesLayer( + url=url, + style=style, + name=name, + visible=show, + **kwargs, + ) + self.add(layer) + + if zoom_to_layer: + metadata = pmtiles_metadata(url) + bounds = metadata["bounds"] + self.zoom_to_bounds(bounds) + except Exception as e: + print(e) + def add_osm_from_geocode( self, query, diff --git a/setup.cfg b/setup.cfg index f04be9455f..ce0dd6ab63 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.27.0 +current_version = 0.27.1 commit = True tag = True diff --git a/setup.py b/setup.py index bc3db3a891..b1de7dc193 100644 --- a/setup.py +++ b/setup.py @@ -90,6 +90,6 @@ test_suite="tests", tests_require=test_requirements, url="https://github.com/opengeos/leafmap", - version="0.27.0", + version="0.27.1", zip_safe=False, )