Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

geocrypt

https://travis-ci.org/spatialcurrent/geocrypt.png Master Documentation Status

Description

A Python library for hashing common geospatial objects.

Installation

Install via PyPI with:

pip install geocrypt

Or install directly from GitHub with:

pip install git+git://github.com/spatialcurrent/geocrypt.git@master

Usage

Below are some simple use cases. See test.py for more use cases.

from geocrypt import geocrypt

digest_a = geocrypt.hash({"type": "lonlat", "value": [-77.042999267578125, 38.922558058625356]})
# digest_a == "cc0a149fd1387a34412ee47cb08ab12b"

digest_b = geocrypt.hash({"geometry": {"coordinates": [-77.042999267578125, 38.922558058625356], "type": "Point"}, "id": 1, "properties": {"addr:street": "18th Street Northwest"}, "type": "Feature"})
# digest_b == "cc0a149fd1387a34412ee47cb08ab12b"

# digest_a == digest_b

By default, the md5 hash algorithm is used, but other algorithms can be selected, too.

geocrypt.hash({"type": "lonlat", "value": [-77.042999267578125, 38.922558058625356]}, algorithm="sha512")

You can also round all coordinates to a given number of decimal places. 5 is a standard number to round to for online maps. By rounding to 5 decimal places, you mitigate floating point errors that might lead 2 different hashes for locations that are the same for all intents and purposes, such as [-77.042999267578125, 38.922558058625356] and [-77.042999299999, 38.922558099999].

geocrypt.hash({"type": "lonlat", "value": [-77.042999267578125, 38.922558058625356]}, decimals=5)

Testing

For unit tests, run the following command from the project root folder:

python -m unittest -v geocrypt.test

Contributing

Spatial Current, Inc. is currently accepting pull requests for this repository. We'd love to have your contributions! Please see Contributing.rst for how to get started.

License

This work is distributed under the MIT License. See LICENSE file.

About

Python library for hashing common geospatial objects.

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages