Generates random coordinates and much more
Project description
randcoor BETA
A basic Python library to generate random geographical coordinates with additional features
Installation
This module can quickly be installed with pip
pip install randcoor
Usage
Geographical coordinates are represented by a tuple with two decimal values (Example: (-73.1657655614035, 32.52677878350798))
Functions that can generate random coordinates:
randCoor(): Generates random coordinatesrandCoorByDist(position, distanceMax, distanceMin=0): Generates random coordinates by distancerandCoorByRule(rule, limit=None, showError=False): Generates random coordinates by checking if they follow the function rulerandCoorByArea(minCoor, maxCoor): Generates random coordinates that are between the coordinates of two points
Other functions:
calcDist(*coordinates): Calculates the distance between pointsroundCoor(coor, ndigits=0): Round the two coordinates of a positiondecimalToDMS(coor): Converts decimal notation to DMS notationDMSToDecimal(coor): Converts DMS notation to decimal notation
If you need more information about these functions, you can use the help function
Examples
from randcoor import *
coor = randCoor()
print(coor)
# (0.5682138386708715, 7.332646594327713)
print(roundCoor(coor))
# (1.0, 7.0)
print(decimalToDMS(coor))
# ((0, 34, 5), (7, 19, 57))
randCoorByDist((0,0), 10, 5)
# (0.0795066131324715, -0.02793806206797174)
randCoorByArea((20,20),(50,50))
# (32.66256834620321, 44.82375046671473)
randCoorByArea((20,50),(50,20))
# (24.12540072542634, 169.03115180655362)
L = [randCoorByRule(lambda x, y: x>y) for x in range(3)]
print(L)
# [(71.83324744299622, -27.090322185441806), (-31.870493778872586, -167.80562795747355), (17.87985263208857, -162.7185532945298)]
calcDist(L)
# 20565.48275832477
Changelog
0.3.0
decimalToDMS()andDMSToDecimal()added- The help function on randcoor itself works properly now
0.2.0
randCoorByArea()added- Small changes for the case when longitude = -180
0.1.1
- Small error in
randCoor()fixed roundCoor()added
0.1.0
- First release
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file randcoor-0.3.0.tar.gz.
File metadata
- Download URL: randcoor-0.3.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e28b525695fe05379edc38d68d5d4c0700a8889508834ff61d91f46f1906d773
|
|
| MD5 |
b5232def36bf346d1bbecb0858780f3c
|
|
| BLAKE2b-256 |
2135a678d21b2e4adf307ded284f336e1f0bbb96a58948f40c6c201d86551ed1
|
File details
Details for the file randcoor-0.3.0-py3-none-any.whl.
File metadata
- Download URL: randcoor-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ab6974017583b6dbc98fa0bfdb06c8428d9393f12a76ba3da48fd7dd8aa40f7
|
|
| MD5 |
843d05c2e4a46d7396591434295912f3
|
|
| BLAKE2b-256 |
822deae89b1af2b94cb06cd46077b7faa48a02a3b2edb04935a31ffd49dec4bb
|