Skip to content

Commit

Permalink
Merge branch 'master' into actinia_notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
neteler authored Oct 20, 2023
2 parents 290a291 + 8ce728d commit 865d4d7
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 7 deletions.
82 changes: 79 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -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**
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion leafmap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Qiusheng Wu"""
__email__ = "[email protected]"
__version__ = "0.27.0"
__version__ = "0.27.1"

import os

Expand Down
2 changes: 1 addition & 1 deletion leafmap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
50 changes: 50 additions & 0 deletions leafmap/leafmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.27.0
current_version = 0.27.1
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

0 comments on commit 865d4d7

Please sign in to comment.