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

from_file(network_file[, run_consistency])

full_rebuild()

Rebuilds all network components that can be rebuilt automatically.

get_intersection(node)

Network intersection class

get_location(location_id)

Location object

has_edit_table(path_to_file)

new(network_file[, jumpstart])

open(network_file[, run_consistency])

Opens project for editing/querying

upgrade()

Updates the network to the latest version available

Attributes

active

Active transport network creation class

checker

Network checker class

diagnostics

Network checker class

geo_consistency

Geo-consistency analysis class

geotools

ie

Network Import-Export class

osm

populate

Network checker class

tables

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

full_rebuild()#

Rebuilds all network components that can be rebuilt automatically. Designed to be used when building the network from scratch or making changes to the network in bulk. This method runs the following methods in order:

  • Rebuilds the location_links table

  • Rebuilds the location_parking table

  • Rebuilds intersections, where signalized intersections are sourced from OSM and all stop signs are added

  • Rebuilds the active networks

  • Run full geo-consistency

  • Deletes all records from the editing table

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 tables: DataTableAccess#
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)#