Skip to main content

Support for stationing used in civil plans

Project description

civstation

Overview

Provides a Station object, which represents a Station of the kind found in civil plans of roads and other linear features, where 5+10 for example represents a point 510 feet (or meters or any units) from an arbitrary starting point.

Station objects

Import the Station class:

from civstation import Station

Create a station object:

sta = Station("4+56.78")

Stations can also be made from a number, which will convert it to a Station.

>>>sta = Station(456.78)
>>>print (sta)
4+56.78

Stations can also be made from a Station, for ease of implementation.

Stations default to displaying two decimal places with trailing zeros. This can be changed by setting decimal_places to the desired number.

>>>sta = Station(456.78, decimal_places = 4)
>>>print(sta)
4+56.7800

Offset Objects

Offset objects work similarly to Stations, but represent a deviation to the left or right from the line that the Station refers to.

Right (RT) is positive and Left (LT) is negative.

>>> offset1=Offset("86.47LT")
>>> offset2=Offset("-86.47")
>>> offset1
86.47LT
>>> offset2
86.47LT

Point Objects

Point objects represent a point on a 2D plane, where the x and y coordinates are a Station and an Offset.

Operations

Stations and Offsets can be added, subtracted, and compared.

Two Points can be subtracted, returning a straight-line distance between them.

Adding a station and a number (float, int, etc.) returns a Station.

Subtracting a number from a station returns a Station.

Subtracting a a Station from a Station returns a float. This is because stations represent a position along a line. Subtracting two stations produces a distance not a position, best represented as a float, not a Station. However, this behavior can be overridden by setting return_float_on_sub = False, to work completely in Stations.

There doesn't appear to be a good reason to multiply or divide Stations, so it is not supported. If this is necessary, convert them to floats or another suitable type.

Definition of Station object

The following code shows the args taken by a Station object.

class Station:
    def __init__(self, sta, decimal_places = 2, return_float_on_sub = True) -> None:

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

civstation-0.2.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

civstation-0.2.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file civstation-0.2.1.tar.gz.

File metadata

  • Download URL: civstation-0.2.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for civstation-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a2791ba0523fc3bdabc0ca215a9295c48222b634d0ce65863be4be68ff84be3c
MD5 a573d2c184ea01be9a7ec9e66ee1c8a9
BLAKE2b-256 bc861d6b258058ea81fc80766e71ac48afcb7fc06014e772097a06c124ad9576

See more details on using hashes here.

File details

Details for the file civstation-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: civstation-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for civstation-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0aaa98099f74b15728a859ff1ef3d951f709307adeebf85cd8ddc4083c193b71
MD5 563667b692f2f7b38d59a1232da137d6
BLAKE2b-256 b55671d9a1ef5e82bae31880d69829a60388a56b2a5ba01c198d57baa25afc9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page