Skip to main content

A Python toolkit for geospatial hotspot detection, Avisualization, and analysis using urban data

Project description

GeoHD

python GitHub release pypi license

Getting Started | Issues | Contribute | Citation | Authors

What is GeoHD?

GeoHD is a Python toolkit for geospatial hotspot detection, visualization, and analysis using urban data. Density-based hotspot detection is an important theory and method in urban research, which realizes the extraction of local research hotspots by combining density analysis and raster algebra. It has been widely used in different fields such as transportation, culture, climate, ecology and so on:

The main functions of GeoHD are fast visualization and hotspot detection based on geospatial point data, and it realizes fixed-bandwidth hotspot detection with adjustable parameters and adaptive-bandwidth hotspot detection. In addition, GeoHD provides spatial point pattern distribution analysis such as Ripley G-function calculation and fast comparison image drawing.

Getting Started

Documentation

We recommend starting your GeoHD journey with the documentation.

Install with pip

The package is available in PyPi and requires Python 3.11 or higher. It can be installed using:

$ pip install GeoHD

Usage

A case-testing approach:

$ cd test
$ python -m test_automation

You can also run test.ipynb in jupyter notebook

Visualization of hotspots on real maps:

visualize_shapefile('data.shp', output_image_path='custom_image.png')

Analytic Plane Point Patterns: Ripley G, Ripley F, Ripley J, Ripley K, Ripley L, etc. through the plotting function.

plot_g_function('data.shp')

The study area was divided into a quadrilateral (hexagonal) grid and fast visualization was achieved based on the density of point data within the divided area.

create_cell_zones(area_file, crash_file)
create_hex_grid_zones(area_file, crash_file)
create_cell_heatmap(area_file, crash_file)
create_hexagonal_heatmap(area_file, crash_file)

Realization of kernel density analysis with fixed bandwidth:

density_raster = process_shapefile(input_file_path)
plot_density_raster(density_raster,output_data_path, *gpd.read_file(input_file_path).total_bounds)

Kernel density analysis for realizing adaptive bandwidth:

adaptiveKDE(shp_file,output_data_path)

Hotspot Identification:

hotspots = extract_hotspots(density_data_path)
visualize_hotspots(np.load(density_data_path), hotspots)

Issues

If you encounter any bugs or problems with GeoHD, please create a post using our package issue tracker. Please provide a clear and concise description of the problem, with images or code-snippets where appropriate. We will do our best to address these problems as fast and efficiently as possible.

Contribute

The authors of the GeoHD package welcome external contributions to the source code. This process will be easiest if users adhere to the contribution policy:

  • Open an issue on the package issue tracker clearly describing your intentions on code modifications or additions
  • Ensure your modifications or additions adhere to the existing standard of the GeoHD package, specifically detailed documentation for new methods (see existing methods for example documentation)
  • Test your modifications to ensure that the core functionality of the package has not been altered by running the unit tests
  • Once the issue has been discussed with a package author, you may open a pull request containing your modifications

Citation

Yan, Y., 2024. GeoHD: A Python Toolkit for Geospatial Hotspot Detection, Visualization, and Analysis. SSRN Electron. J. https://doi.org/10.2139/ssrn.4799686

Yan, Y., Quan, W., Wang, H., 2024. A data‐driven adaptive geospatial hotspot detection approach in smart cities. Trans. GIS tgis.13137. https://doi.org/10.1111/tgis.13137

Authors

  • Yuchen Yan

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

geohd-0.2.7.tar.gz (34.3 kB view hashes)

Uploaded Source

Built Distribution

GeoHD-0.2.7-py3-none-any.whl (34.4 kB view hashes)

Uploaded Python 3

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