Python library for the generation of contestualized random coordinates
Project description
PyCristoforo
v1.1.0
The new python library for the generation of contestualized random coordinates. PyCristoforo takes in input a country name and it generates random coordinates, inside that country (not including the sea/ocean sections).
Python version supported: 3.6, 3.7
Latest updates
Date | Description |
---|---|
30/06/2019 | PyCristoforo 1.0.0 published on PyPi)* |
08/07/2019 | PyCristoforo 1.0.0.post4 published on PyPi)* |
09/07/2019 | PyCristoforo 1.1.0 published on PyPi)* |
*Some unittests and documentation sections still missing.
Table of contents
- Description
- Requirements
- Install
- Usage
- Build
- Running tests
- ChangeLog
- License
- What next
- Authors
- Notes
Description
Work in progress
Requirements
- numpy v1.16.4
- Shapely v1.6.4.post2
Details here
Resources
- World countries geoJSON (link)
Install
PyCristoforo is very easy to install and use (please be sure to have installed dependencies (section 'Requirements')
pip3 install pycristoforo
Usage
- Now you can import it in your script:
import pycristoforo as pyc
- You can now load the geojson of the country you'd like to generate geocoordinates in:
country = pyc.get_shape("Italy")
The supported input for get_shape
method are not only the extended country names: you can either use ISO_A3
code.
Here you can find the supported input (country_name, ISO_A3).
Method is case insensitive:
country = pyc.get_shape("ITALY")
behaves the same as:
country = pyc.get_shape("italy")
country
var contains now the shape of the country passed in input (usually a shapely Poligon
or MultiPoligon
):
MULTIPOLYGON (((12.127777 47.00166300000012, 12.13611 46.966942, 12.16027600000012 46.92805, 12.18138900000014 46.909721, 12.189722 46.90610500000014, 12.232222 46.888885, 12.301666 46.84111, 12.378611 46.72666, 12.38888700000012 46.715553, ... , 12.047777 36.753052, 12.03833200000014 36.747215, 12.027777 36.74222, 12.01583 36.738327)))
- Now that country shape has been loaded, it's time to get
n
random geocoordinates. Suppose to generate 100 geocoordinates:
points = pyc.geoloc_generation(country, 100, "Italy")
points
is a list of Points:
00 = {dict} {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [13.963703154465053, 42.591335534115316]}, 'properties': {'point': 1, 'country': 'Italy'}}
01 = {dict} {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [11.659857182901725, 43.95787059805974]}, 'properties': {'point': 2, 'country': 'Italy'}}
02 = {dict} {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [7.992769814920238, 45.89632889069682]}, 'properties': {'point': 3, 'country': 'Italy'}}
...
99 = {dict} {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [6.112769314920238, 45.45632889569111]}, 'properties': {'point': 100, 'country': 'Italy'}}
You can now iterate through the list and make good use of them.
- Print what you just generated:
geoloc_print(points, ',')
- A utility method is the
get_envelope
one:
env = pyc.get_envelope(country)
Build
python3 setup.py sdist bdist_wheel
Running tests
Work in progress
ChangeLog
Current version: 1.1.0
License
This project is licensed under the MIT License - see the LICENSE file for details
What Next
- v2.0.0 : random coordinates generation method will be enhanced
- v2.1.0: regions support
- v2.3.0: counties support
- v2.4.0: cities support
Authors
- Alessandro Negrini - Initial work - Github profile
See also the list of contributors who participated in this project.
Notes
This project has been set up using PyScaffold 3.1. For details and usage information on PyScaffold see https://pyscaffold.org/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PyCristoforo-1.1.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74a2c7593ac57438ad264303ad2c4c58420eb9d6d2d3cdb345b70a2d024fc990 |
|
MD5 | a7d814b43b1280ecbeddf6508b9d6e5e |
|
BLAKE2b-256 | 990fc08eac68e36137737ba16e9b7540c829be02349f3950dc4abbc94fd8f7a6 |