{"id":28176455,"url":"https://github.com/martibosch/multilandpy","last_synced_at":"2025-10-08T00:41:19.678Z","repository":{"id":285288253,"uuid":"957620916","full_name":"martibosch/multilandpy","owner":"martibosch","description":"Multi-scale landscape features in Python","archived":false,"fork":false,"pushed_at":"2025-05-05T20:53:55.000Z","size":4202,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-05T21:49:36.394Z","etag":null,"topics":["built-environment","digital-elevation-model","multi-scale-analysis","terrain-analysis","tree-canopy","urban-ecology","urban-green-space"],"latest_commit_sha":null,"homepage":"https://multilandpy.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martibosch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-30T19:59:35.000Z","updated_at":"2025-05-02T08:42:29.000Z","dependencies_parsed_at":"2025-03-30T21:19:27.074Z","dependency_job_id":"8145ac6a-65fb-492e-9c39-90fadba2375c","html_url":"https://github.com/martibosch/multilandpy","commit_stats":null,"previous_names":["martibosch/multiurbanpy","martibosch/multilandpy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fmultilandpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fmultilandpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fmultilandpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fmultilandpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martibosch","download_url":"https://codeload.github.com/martibosch/multilandpy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442798,"owners_count":22071884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["built-environment","digital-elevation-model","multi-scale-analysis","terrain-analysis","tree-canopy","urban-ecology","urban-green-space"],"created_at":"2025-05-16T00:18:46.748Z","updated_at":"2025-10-08T00:41:19.655Z","avatar_url":"https://github.com/martibosch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI version fury.io](https://badge.fury.io/py/multilandpy.svg)](https://pypi.python.org/pypi/multilandpy/)\n[![Documentation Status](https://readthedocs.org/projects/multilandpy/badge/?version=latest)](https://multilandpy.readthedocs.io/en/latest/?badge=latest)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/martibosch/multilandpy/main.svg)](https://results.pre-commit.ci/latest/github/martibosch/multilandpy/main)\n[![codecov](https://codecov.io/gh/martibosch/multilandpy/branch/main/graph/badge.svg?token=hKoSSRn58a)](https://codecov.io/gh/martibosch/multilandpy)\n[![GitHub license](https://img.shields.io/github/license/martibosch/multilandpy.svg)](https://github.com/martibosch/multilandpy/blob/main/LICENSE)\n\n# multilandpy\n\nComputing multi-scale landscape features for vector and raster layers (terrain/topographic indices, vegetation, building areas and volumes...) in Python.\n\n\u003e *multilandpy* is an analogy to the [multilandr](https://github.com/phuais/multilandR) package [1] to compute multi-scale landscape metrics in R. However, instead of lansdcape metrics\u003csup\u003e[1](#pylandstats)\u003c/sup\u003e, multilandpy computes generic mutli-scale landscape features for vector and raster layers, such as topographic features, tree canopy cover as well as building areas and volumes.\n\nExample application to compute the proportion of tree canopy around (with multiple buffer radii) weather stations in Zurich, Switzerland:\n\n![stations-tree-canopy](https://github.com/martibosch/multilandpy/raw/main/figures/stations-tree-canopy.png)\n\n*(C) OpenStreetMap contributors, tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France*\n\n## Overview\n\nStart by instantiating a `MultiScaleFeatureComputer` for [a given region of interest](https://github.com/martibosch/pyregeon). Then, given a list of site locations, you can compute urban features at multiple scales, i.e., based on the landscape surrounding each site for multiple buffer radii:\n\n```python\nimport swisstopopy\n\nimport multilandpy\n\n# parameters\nregion = \"EPFL\"\ncrs = \"epsg:2056\"\nbuffer_dists = [10, 25, 50, 100]\ngrid_res = 200\n\n# instantiate the multi-scale feature computer\nmsfc = multilandpy.MultiScaleFeatureComputer(region=region, crs=crs)\n\n# generate a regular grid of points/sites within the region\nsite_gser = msfc.generate_regular_grid_gser(grid_res, geometry_type=\"point\")\n\n# get a tree canopy raster from swisstopo data\ndst_filepath = \"tree-canopy.tif\"\nswisstopopy.get_tree_canopy_raster(region, dst_filepath)\ntree_val = 1  # pixel value representing a tree in the canopy raster\n\n# generate a DEM raster from swisstopo data\ndem_filepath = \"dem.tif\"\nswisstopopy.get_dem_raster(region, dem_filepath)\n\n# compute multi-scale features\n\n# building areas from OpenStreetMap buildings (via osmnx)\nfeatures_df = pd.concat(\n    [\n        msfc.compute_building_features(site_gser, buffer_dists),\n        msfc.compute_tree_features(\n            tree_canopy_filepath, site_gser, buffer_dists, tree_val\n        ),\n        msfc.compute_topo_features_df(\n            dem_filepath,\n            site_gser,\n            buffer_dists,\n        ),\n    ],\n    axis=\"columns\",\n)\nfeatures_df.head()\n```\n\n| grid_cell_id | buffer_dist | building_area | tree_canopy |    slope | northness |       tpi |\n| -----------: | ----------: | ------------: | ----------: | -------: | --------: | --------: |\n|            0 |          10 |    313.654849 |    0.000000 | 0.020963 |  0.180932 | -0.006561 |\n|              |          25 |   3920.685613 |    0.014260 | 0.052408 |  0.023872 |  0.036682 |\n|              |          50 |  31365.484905 |    0.047746 | 0.070575 | -0.006432 | -0.075104 |\n|              |         100 | 250923.879244 |    0.043386 | 0.073637 |  0.006363 | -0.716217 |\n|            1 |          10 |    627.309698 |    0.000000 | 0.095521 |  0.228504 |  0.080963 |\n\nSee the [overview notebook](https://multilandpy.readthedocs.io/en/latest/overview.html) and the [API documentation](https://multilandpy.readthedocs.io/en/latest/api.html) for more details on the features of multilandpy.\n\n## Installation\n\nLike many other geospatial Python packages, multilandpy requires many base C libraries that cannot be installed with pip. Accordingly, the best way to install multilandpy is to use conda/mamba, i.e., in a given conda environment, run:\n\n```bash\n# or mamba install -c conda-forge geopandas\nconda install -c conda-forge geopandas\n```\n\nWithin the same conda environment, you can then install multilandpy using pip:\n\n```bash\npip install https://github.com/martibosch/multilandpy/archive/main.zip\n```\n\n## Acknowledgements\n\n- This package was created with the [martibosch/cookiecutter-geopy-package](https://github.com/martibosch/cookiecutter-geopy-package) project template.\n\n## Footnotes\n\n\u003ca name=\"pylandstats\"\u003e1\u003c/a\u003e. You can use the [`MultiScaleAnalysis`](https://github.com/martibosch/pylandstats-notebooks/blob/main/notebooks/06-multiscale-analysis.ipynb) class of [pylandstats](https://github.com/martibosch/pylandstats) [2] to compute multi-scale landscape metrics in Python.\n\n## References\n\n1. Huais, P. Y. (2024). Multilandr: An r package for multi-scale landscape analysis. Landscape Ecology, 39(8), 140.\n1. Bosch, M. (2019). PyLandStats: An open-source Pythonic library to compute landscape metrics. PloS one, 14(12), e0225734.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartibosch%2Fmultilandpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartibosch%2Fmultilandpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartibosch%2Fmultilandpy/lists"}