Skip to main content

Provides a wrapper to the RAMM API and additional tools for positional referencing

Project description

pyramm

Python wrapper for RAMM API.

Users must have their own login for the RAMM database.

Installation

pip install pyramm

Issues

Please submit an issue if you find a bug or have an idea for an improvement.

Initialise

You must first initialise the connection to the RAMM API as follows. Note that the database argument defaults to "SH New Zealand" if it is not provided.

from pyramm.api import Connection
conn = Connection(username, password, database="SH New Zealand")

Alternatively the username and password can be stored in file called .pyramm.ini. This file must be saved in the users home directory ("~" on linux) and contain the following:

[RAMM]
USERNAME = username
PASSWORD = password

You are then able to initialise the RAMM API connection without providing your login credentials each time.

from pyramm.api import Connection
conn = Connection()

Table and column names

A list of available tables can be accessed using:

table_names = conn.table_names()

A list of columns for a given table can be accessed using:

column_names = conn.column_names(table_name)

Table data

Some methods are attached to the Connection object to provide convenient access to selected RAMM tables. These helper methods implement some additional filtering (exposed as method arguments) and automatically set the DataFrame index to the correct table column(s).

Tables not listed in the sections below can be accessed using the general get_data() method:

df = conn.get_data(table_name)

General tables:

roadnames = conn.roadnames()
carrway = conn.carr_way(road_id=None)
c_surface = conn.c_surface(road_id=None)
top_surface = conn.top_surface()
surf_material = conn.surf_material()
surf_category = conn.surf_category()
minor_structure = conn.minor_structure()

HSD tables:

hsd_roughness = conn.hsd_roughness(road_id, latest=True, survey_year=None)
hsd_roughness_hdr = conn.hsd_roughness_hdr()
hsd_rutting = conn.hsd_rutting(road_id, latest=True, survey_year=None)
hsd_rutting_hdr = conn.hsd_rutting_hdr()
hsd_texture = conn.hsd_texture(road_id, latest=True, survey_year=None)
hsd_texture_hdr = conn.hsd_texture_hdr()

Centreline

The Centreline object is provided to:

  • assist with generating geometry for table entries (based on road_id, start_m and end_m values),

The base geometry used by the Centreline object is derived from the carr_way table.

Create a Centreline instance:

centreline = conn.centreline()

Append geometry to table:

For a table containing road_id, start_m and end_m columns, the geometry can be appended using the append_geometry() method:

df = centreline.append_geometry(df, geometry_type="wkt")

The geometry_type argument defaults to "wkt". This will provide a WKT LineString for each row.

Alternatively, geometry_type can be set to "coord" to append a northing and easting column to the DataFrame.

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

pyramm-1.10.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

pyramm-1.10-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file pyramm-1.10.tar.gz.

File metadata

  • Download URL: pyramm-1.10.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for pyramm-1.10.tar.gz
Algorithm Hash digest
SHA256 8fb65044c6a844033921001f58ea199a38be735541f5449b8679edd098b41e80
MD5 5e01b692a0d098cb9c30e3df9b32429f
BLAKE2b-256 9fb6c0be0b974fdd067f5f8ff3e87fc7248e65634b78a273db44dd4723cedd4b

See more details on using hashes here.

File details

Details for the file pyramm-1.10-py3-none-any.whl.

File metadata

  • Download URL: pyramm-1.10-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for pyramm-1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 c3d5706c71b7ef4b87180eb5e45e7393b6d52750341f6ff918b2013320bf4bd6
MD5 e6a7ec50460d79223136ace72c70a8a9
BLAKE2b-256 7215168384bc8fffc7314e93d7da27dd006958c6d2e2398134be0eb1972c6610

See more details on using hashes here.

Supported by

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