Skip to main content

A complete package to work with polygons and geohashes. Optimisation of Geohash levels to cover and area with % error controlled by user. Also allows to convert geohases to polygons.

Project description

polygeohasher

polygeohasher is a python package to implement polygon to geohash and vice versa with optimisation of geohash levels as per the user requirement, with error rate being controlled by the user.

Installation

Use the package manager pip to install polygeohasher.

pip install polygeohasher

#install all dependencies
pip3 install -r requirements.txt

Usage

from polygeohasher import polygeohasher
import geopandas as gpd

gdf = gpd.read_file("your geospatial file format") # read your geometry file here

primary_df = polygeohasher.create_geohash_list(gdf, geohash_level,inner=False) # returns a dataframe with list of geohashes for each geometry

secondary_df = polygeohasher.geohash_optimizer(primary_df, largest_gh_size, smallest_gh_size, gh_input_level) # returns optimized list of geohash

polygeohasher.optimization_summary(primary_df, secondary_df) #creates a summary of first and second output

'''
--------------------------------------------------
            OPTIMIZATION SUMMARY
--------------------------------------------------
Total Counts of Initial Geohashes :  2597
Total Counts of Final Geohashes   :  837
Percent of optimization           :  67.77 %
--------------------------------------------------
'''

geo_df = polygeohasher.geohashes_to_geometry(secondary_df,"geohash_column_name") # return geometry for a DataFrame with a column - `opitimized_geohash_list` (output from above)

geo_df.to_file("your write path.format",driver = "GeoJSON") #write file in your favorite spatial file format

Some visualisations

study_area

Study are consist of division of City of Bengaluru in India.

primary_output

Primary Output of geohashes without any optimisation.

secondary_output

Final Output of geohashes with optimization of number of geohashes at different levels to cover an area.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Apache License, Version 2.0

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

polygeohasher-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

polygeohasher-1.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file polygeohasher-1.0.0.tar.gz.

File metadata

  • Download URL: polygeohasher-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.2.0

File hashes

Hashes for polygeohasher-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6e673e1ef5938dad5c2583bc2ceb8cb9e297dba3b3f097c45cf2f298d7057ef1
MD5 87de54fd3a23187862776c66b53fa7ab
BLAKE2b-256 9df9844c26910e7ccaf1f2d8a43e4c90e4099da2428a4f9c5fbcb7f07b8afb12

See more details on using hashes here.

File details

Details for the file polygeohasher-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: polygeohasher-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.2.0

File hashes

Hashes for polygeohasher-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73c6c95bf636c1c26583fd54abd3f64836ae6eabcc3493700a5d9611dc6d2830
MD5 08d17b06b4389afa0dbe17a59f8df40d
BLAKE2b-256 708f5dcd6855e1943be98ad00288949f329c791c690b8904e748acc548eb0482

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