Skip to main content

Package for geospatial kernel density estimation (KDE).

Project description

pypi version pypi downloads publish test security: bandit

GeoKDE

Package for geospatial kernel density estimation (KDE).

Written in Python 3.10.11 (though compatible with 3.10.11+), GeoKDE depends on the following:

  • geopandas
  • numpy (itself a dependency of geopandas)

Examples

Perform KDE on a GeoJSON of point geometries and write the result to a GeoTIFF raster file with rasterio:

gdf = geopandas.read_file("vector_points.geojson")
kde_array, array_bounds = geokde.kde(gdf, 1, 0.1)
transform = rasterio.transform.from_bounds(
    *array_bounds,
    kde_array.shape[1],
    kde_array.shape[0],
)

with rasterio.open(
    fp="raster.tif",
    mode="w",
    driver="GTiff",
    width=kde_array.shape[1],
    height=kde_array.shape[0],
    count=1,
    crs=gdf.crs,
    transform=transform,
    dtype=kde_array.dtype,
    nodata=0.0,
) as dst:
    dst.write(kde_array, 1)

Roadmap

  • Add more kernels.
  • Finish tests - coverage is >=95% for _utils.py and geokde.py as is.
  • Implement other methods of distance measurement, e.g. haversine, Manhattan.
  • Investigate alternatives to iterating over points.
  • Enable use of single radius and weight values without filling array of the same length as the points GeoDataFrame/GeoSeries. Results in marginal speed up but the current approach may become an issue with very large point datasets.
  • Integrate mypy in pre-commit, possibly also linter and formatter though flake8 and black used locally.

Contributions

Feel free to raise any issues, especially bugs and feature requests!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geokde-0.1.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

geokde-0.1.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file geokde-0.1.2.tar.gz.

File metadata

  • Download URL: geokde-0.1.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1022-azure

File hashes

Hashes for geokde-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4684099d2e1994504c6947b09a3f8174034b2a14ad01b3f73ddd3dc8f8daea1e
MD5 ce4f9b3242e3f1c66c40f81bf3a5c87d
BLAKE2b-256 b4fe7566ac2da4bfd9dca4111649aa68c395a4eabd033a218416c9e1fb2ce504

See more details on using hashes here.

File details

Details for the file geokde-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: geokde-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1022-azure

File hashes

Hashes for geokde-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8e0981c7871c217c71db48bbe0dcd3d16c01e6258e79104fa75f3b1fb535ca4
MD5 301fe16aed9ea9f442b718b30a453cb7
BLAKE2b-256 986add57092f13d1a80813bca96f5251c920a60c99e4898e1304033fed76a5e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page