polaris.network.network.Network#

class polaris.network.network.Network#

Bases: object

Polaris Network Class

# We can open the network just to figure out its projection
from polaris.network.network import Network
n = Network()
n.open(source)

# We get the projection used in this project
srid = n.srid

# Or we can also get the checker for this network
checker = n.checker

# In case we ran some query while with the database open, we can commit it
n.commit()

# We can create a new network file from scratch as well
new_net = Network()

new_net.srid = srid # We use the SRID from the known network, for example

# if we don't have Spatialite on our system path environment variables, we can
# add it manually before attempting to create a new database
new_net.add_spatialite('path/to/spatialite/folder')

# If the second parameter is True, an SQLite file pre-populated with Spatialite extensions is used
new_net.new('path/to/new/file', True)


# To close the connection is simply
n.close()
__init__()#

Instantiates the network

Methods

__init__()

Instantiates the network

clear_editing_records()

"Removes previously addressed records from the editing table

clear_log()

Clears log file

close([clear_issues])

Closes database connection

create(network_file, srid[, jumpstart])

Creates new empty network file Args: network_file (str): Full path to the network file to be opened. jumpstart (bool): Copies base sql already loaded with spatialite extension. It saves a few seconds of runtime.

from_file(network_file[, run_consistency])

get_intersection(node)

Network intersection class

get_location(location_id)

Location object

has_edit_table(path_to_file)

log_to_terminal()

Adds the terminal as a logging output

new(network_file[, jumpstart])

open(network_file[, run_consistency])

Opens project for editing/querying

set_debug([level])

Sets logging to debug mode throughout the package.

upgrade()

Updates the network to the latest version available

Attributes

active

Active transport network creation class

checker

Network checker class

consistency

Network checker class

data_tables

diagnostics

Network checker class

geo_consistency

Geo-consistency analysis class

geotools

ie

Network Import-Export class

osm

populate

Network checker class

tools

Tools for general manipulation of the network

transit

Transit manipulation class

__init__()#

Instantiates the network

static from_file(network_file: PathLike, run_consistency=False)#
static create(network_file: PathLike, srid: int, jumpstart: bool = False) None#

Creates new empty network file Args:

network_file (str): Full path to the network file to be opened. jumpstart (bool): Copies base sql already loaded with spatialite extension. It saves a few seconds of runtime.

new(network_file: str, jumpstart=False) None#
open(network_file: PathLike, run_consistency=False)#

Opens project for editing/querying

Args:

network_file (str): Full path to the network file to be opened.

upgrade() None#

Updates the network to the latest version available

close(clear_issues=False)#

Closes database connection

set_debug(level=10)#

Sets logging to debug mode throughout the package.

As a result of this method_call, logging will become extremely verbose. Use only when necessary

Args:

level (int): Logging level to be used (DEBUG:10, INFO:20, WARN:30, ERROR:40 CRITICAL:50)

log_to_terminal()#

Adds the terminal as a logging output

property tools: Tools#

Tools for general manipulation of the network

property transit: Transit#

Transit manipulation class

property active#

Active transport network creation class

property checker#

Network checker class

property populate#

Network checker class

property diagnostics#

Network checker class

property geo_consistency#

Geo-consistency analysis class

property osm: OSM#
property geotools#
property data_tables: DataTableCache#
property consistency#

Network checker class

property ie: ImportExport#

Network Import-Export class

get_location(location_id: int) Location#

Location object

get_intersection(node: int) Intersection#

Network intersection class

clear_editing_records()#

“Removes previously addressed records from the editing table

clear_log()#

Clears log file

static has_edit_table(path_to_file)#