Skip to main content

Geohash Generator is a python module that provides function for converting geojson and shapefile to geohash.

Project description

Geohash Generator

Geohash Generator is a python module that provides function for converting geojson and shapefile to geohash.

Feature

  • Convert from Geojson to Geohash
  • Convert from Shapefile to Geohash
  • Convert from Geohash to Geojson
  • Do you have any idea for other feature?

Reqruiements

  • Python: 2.x, 3.x

Installation

pip install geohash-generator

Usage

Convert from Geojson to Geohash

from geohash_generator.geohash_generator import generate
import os

# Init Variable
this_script_dir = os.path.dirname(os.path.realpath(__file__))
source_path = os.path.join(
    this_script_dir,
    'example.geojson'
)
min_level_precision=2
max_level_precision=7
file_type="geojson"

# Convert Geojson to Geohash
convert_geojson_to_geohash = generate(
    source_path=source_path,
    min_level_precision=min_level_precision,
    max_level_precision=max_level_precision,
    file_type=file_type,
)

# Print result
print(f"convert_geojson_to_geohash: {convert_geojson_to_geohash}")

Convert from Shapefile to Geohash

from geohash_generator.geohash_generator import generate
import os

# Init Variable
this_script_dir = os.path.dirname(os.path.realpath(__file__))
source_path = os.path.join(
    this_script_dir,
    'example.shp'
)
min_level_precision=2
max_level_precision=7
file_type="shapefile"

# Convert Shapefile to Geohash
convert_shapefile_to_geohash = generate(
    source_path=source_path,
    min_level_precision=min_level_precision,
    max_level_precision=max_level_precision,
    file_type=file_type,
)

# Print result
print(f"convert_shapefile_to_geohash: {convert_shapefile_to_geohash}")

Convert from Geohash to Geojson

from geohash_generator.geohash_generator import geohash_to_geojson
import os

# Init Variable
this_script_dir = os.path.dirname(os.path.realpath(__file__))
source_path = os.path.join(
    this_script_dir,
    'geohash_example.txt'
)

# Convert Geohash to Geojson
convert_geohash_to_geojson = geohash_to_geojson(source_path=source_path)

# Print Result
print(f"convert_geohash_to_geojson: {convert_geohash_to_geojson}")

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

geohash-generator-0.1.0.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

geohash_generator-0.1.0-py3-none-any.whl (9.2 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