Skip to main content

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:

Metadata

Release files for civstation 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for civstation 0.2.2
File Size Uploaded
civstation-0.2.2.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for civstation 0.2.2
File Interpreter ABI Platform
civstation-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / civstation-0.2.2.tar.gz

Download URL civstation-0.2.2.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b702e66ddabbcc43591a611583eac3ddab4ab544a095939aa7e4e010ff25c5c8
BLAKE2b-256 checksum
How to use checksums
0fec0692a850ddb8681f1d4fe4a28892bbc1f3a6c902e096f3230ecd3ed1e575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / civstation-0.2.2-py3-none-any.whl

Download URL civstation-0.2.2-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
805325cf8607da51b4edcaf4863bffed81843627722888900503a54e93c9af55
BLAKE2b-256 checksum
How to use checksums
cd52c6dbb18e2fbf779f4c7fd8f1e74ca1213444304914107d71c1474bd85df6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page