Add surveyor mathematics easily to your projects.
Project description
Survey Toolbox
Coordinate mathematics and tools for surveyors and game-makers (currently) working in flat plane.
Simple mathematics library for working with coordinates.
Installation
Python:
pip install surveyor-toolbox
Usage example
# Declare some constants.
from surveytoolbox.config import EASTING, NORTHING, ELEVATION
# Import functions.
from surveytoolbox.PointStore import NewPointStore
from surveytoolbox.SurveyPoint import NewSurveyPoint
from surveytoolbox.bdc import bearing_distance_from_coordinates
from surveytoolbox.cbd import coordinates_from_bearing_distance
from surveytoolbox.fmt_dms import format_as_dms
# Start a point store so you can track your points.
pointStore = NewPointStore()
# Create some points and add to point store.
point_1 = NewSurveyPoint("JRR")
pointStore.set_new_point(point_1)
point_2 = NewSurveyPoint("JayArghArgh")
pointStore.set_new_point(point_2)
# Start playing
point_1.set_vertex(
{
EASTING: 100,
NORTHING: 100,
ELEVATION: 30
}
)
point_2.set_vertex(
{
EASTING: 200,
NORTHING: 100,
ELEVATION: 30
}
)
# Calculate and print the bearing and distance between two points.
target_loc = bearing_distance_from_coordinates(point_1.get_vertex(), point_2.get_vertex())
print(
f"Bearing: {format_as_dms(target_loc[0])}"
f"\nDistance (2d): {target_loc[1]}"
f"\nDistance (3d): {target_loc[2]}"
)
# Create a new point using the provided bearing and distance (it shoudl duplicate point 2)
point_3 = NewSurveyPoint("JRR2110141000")
pointStore.set_new_point(point_3)
point_3.set_vertex(
coordinates_from_bearing_distance(
point_1.get_vertex(),
target_loc[0],
target_loc[1]
)
)
current_points = pointStore.get_point_store()
for k, v in current_points.items():
print(
f"{current_points[k].get_point_name()}: {current_points[k].get_vertex()}"
)
Here's a bearing example
from surveytoolbox.config import EASTING, NORTHING, ELEVATION, BEARING
# Import functions
from surveytoolbox.SurveyPoint import NewSurveyPoint
from surveytoolbox.bdc import bearing_distance_from_coordinates
from surveytoolbox.fmt_dms import format_as_dms
point_1 = NewSurveyPoint("JRR")
point_2 = NewSurveyPoint("JayArghArgh")
point_1.set_vertex(
{
EASTING: 100,
NORTHING: 100,
ELEVATION: 30
}
)
point_2.set_vertex(
{
EASTING: 200,
NORTHING: 300,
ELEVATION: 30
}
)
# Calculate and print the bearing and distance between two points.
target_loc = bearing_distance_from_coordinates(point_1.get_vertex(), point_2.get_vertex())
print(
target_loc
)
print(format_as_dms(target_loc[BEARING]))
For more examples and usage, please refer to the Wiki.
Development setup
Describe how to install all development dependencies and how to run an automated test-suite of some kind. Potentially do this for multiple platforms.
make install
npm test
Release History
- 0.0.2
- Removed python-math... actually doesn't require it (DOH!)
- 0.0.2
- Fix python-math import in setup.
- 0.0.1
- Work in progress
Meta
Justin – @hopBuddyHop – jayarghargh @ gee mail
Distributed under the MIT license. See MIT LICENCE for more information.
https://github.com/JayArghArgh
Contributing
- Fork it (https://github.com/JayArghArgh/surveytoolbox/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
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
survey-toolbox-0.0.3.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for survey_toolbox-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb6287bc5d82c86fb27120e836b415f4423cf125c14ae54bd6e5a9a87589e23b |
|
MD5 | 019ec27624df7ac3b514e3fb9facd1c3 |
|
BLAKE2b-256 | 8ac1786c945d14c2c643ec050c624f263244b3ba518a58578235219f42047bba |