Urban footprinter
A reusable convolution-based approach to detect urban extents from raster datasets.
| LULC | Convolution result | Computed urban extent |
|---|---|---|
The approach is built upon the methods used in the Atlas of Urban Expansion. The main idea is that a pixel is considered part of the urban extent depending on the proportion of built-up pixels that surround it. See the notebook overview or this blog post for a more detailed description of the procedure.
Citation: Bosch M. 2020. "Urban footprinter: a convolution-based approach to detect urban extents from raster data". Available from https://github.com/martibosch/urban-footprinter. Accessed: DD Month YYYY.
An example BibTeX entry is:
@misc{bosch2020urban,
title={Urban footprinter: a convolution-based approach to detect urban extents from raster data},
author={Bosch, Mart\'{i}},
year={2020},
doi={10.5281/zenodo.3699310},
howpublished={Available from \url{https://github.com/martibosch/urban-footprinter}. Accessed: DD Month YYYY},
}
Installation and usage
To install use pip:
$ pip install urban-footprinter
Then use it as:
import urban_footprinter as ufp
# Or use `ufp.urban_footprint_mask_shp` to obtain the urban extent as a
# shapely geometry
urban_mask = ufp.urban_footprint_mask(
"path/to/raster.tif", kernel_radius, urban_threshold, urban_classes=urban_classes
)
where
help(ufp.urban_footprint_mask)
Help on function urban_footprint_mask in module urban_footprinter:
urban_footprint_mask(raster, kernel_radius, urban_threshold, urban_classes=None, num_patches=1,
buffer_dist=None, res=None)
Computes a boolean mask of the urban footprint of a given raster.
Parameters
----------
raster : ndarray or str, file object or pathlib.Path object
Land use/land cover (LULC) raster. If passing a ndarray (instead of the
path to a geotiff), the resolution (in meters) must be passed to the
`res` keyword argument.
kernel_radius : numeric
The radius (in meters) of the circular kernel used in the convolution.
urban_threshold : float from 0 to 1
Proportion of neighboring (within the kernel) urban pixels after which
a given pixel is considered urban.
urban_classes : int or list-like, optional
Code or codes of the LULC classes that must be considered urban. Not
needed if `raster` is already a boolean array of urban/non-urban LULC
classes.
num_patches : int, default 1
The number of urban patches that should be featured in the returned
urban/non-urban mask. If `None` or a value lower than one is provided,
the returned urban/non-urban mask will features all the urban patches.
buffer_dist : numeric, optional
Distance to be buffered around the urban/non-urban mask. If no value is
provided, no buffer is applied.
res : numeric, optional
Resolution of the `raster` (assumes square pixels). Ignored if `raster`
is a path to a geotiff.
Returns
-------
urban_mask : ndarray
Metadata
Release files for urban-footprinter 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| urban_footprinter-0.4.0.tar.gz | 19.8 kB | Without provenance | Details for urban_footprinter-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| urban_footprinter-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for urban_footprinter-0.4.0-py3-none-any.whl |
Total release size: 39.0 kB
Release files / urban_footprinter-0.4.0.tar.gz
| Download URL | urban_footprinter-0.4.0.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfa2fa092e148e119b952ccae0a1f6fd7514d6957dcbf40bb63e4a2f4bd550d9
|
|
BLAKE2b-256 checksum How to use checksums |
5f1b48d726f56b08f53d4746eed200c42120602c89563dbb93b3cf8e9bc07efc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / urban_footprinter-0.4.0-py3-none-any.whl
| Download URL | urban_footprinter-0.4.0-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1a32b6df7f183ee976bb5f6cb2b379685e97ab8bc84d4935647943f4d61788e
|
|
BLAKE2b-256 checksum How to use checksums |
0c8b501ae07b584b08d492993b81026da391fe44c64fed1832c6863832b2984c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for urban-footprinter 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.