NetBox plugin for physical cable plant infrastructure documentation with GIS capabilities
Project description
netbox-pathways
Under active development -- alpha. netbox-pathways is pre-1.0 and changing fast. Models, migrations, REST/GeoJSON endpoints, and configuration keys may break between releases without deprecation cycles. Pin an exact version in production, expect to read the CHANGELOG before every upgrade, and back up your database before running migrations. Issue reports and PRs are very welcome.
A NetBox plugin for documenting physical cable plant infrastructure with PostGIS integration. Track conduits, aerial spans, structures, and cable routing with geographic data, comparable to SmallWorld or ArcGIS with ArcFM for outside/inside plant documentation.
Features
- Structures -- poles, manholes, cabinets, equipment rooms, and more with PostGIS geometry (point or polygon).
- Pathways -- conduits, aerial spans, direct buried, innerducts, cable trays with PostGIS line geometry.
- Conduit Banks and Junctions -- model conduit bank configurations and mid-span Y-tees.
- Cable Routing -- track which NetBox cables traverse which pathways, in sequence.
- Pull Sheets -- printable cable routing documents for field crews.
- GeoJSON API -- standard GeoJSON endpoints for QGIS and other GIS clients.
- QGIS Integration -- style files, project generator, and documentation.
- Geometry Editing -- draw and edit geometries directly in NetBox forms via Leaflet map widgets.
- Interactive Map -- built-in Leaflet map for quick visualization.
- Indoor / Outdoor -- pathways can terminate at structures (outdoor) or NetBox locations (indoor).
Compatibility
| Plugin version | NetBox version | Python | PostgreSQL |
|---|---|---|---|
| 0.1.x | 4.5.3+ | 3.12-3.14 | 16+ with PostGIS 3.4 |
Installation
NetBox runs on plain PostgreSQL by default. This plugin requires PostGIS, so installing it on an existing NetBox deployment means changing your database setup. The short version is below; see PostGIS Setup in the docs for the full walkthrough (system libraries, container images, migrating an existing database).
1. PostGIS prerequisites
Install the GIS system libraries on every NetBox host (web workers and rq), and PostGIS on the database server:
# Debian / Ubuntu (NetBox host)
sudo apt-get install -y gdal-bin libgdal-dev libgeos-dev libproj-dev binutils
# Database server: PostgreSQL 16+ with the PostGIS 3.4 package, then:
psql -d netbox -c "CREATE EXTENSION IF NOT EXISTS postgis;"
2. Switch NetBox to the PostGIS database backend
In configuration.py, the default DATABASES engine is plain PostgreSQL. Change ENGINE to the PostGIS backend (the standard django.db.backends.postgresql engine appears to work but fails the first time a geometry column is created):
DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.postgis", # was django.db.backends.postgresql
"NAME": "netbox",
"USER": "netbox",
"PASSWORD": "...",
"HOST": "localhost",
"PORT": "",
"CONN_MAX_AGE": 300,
},
}
3. Install the plugin and configure it
pip install netbox-pathways
PLUGINS = ["netbox_pathways"]
PLUGINS_CONFIG = {
"netbox_pathways": {
"srid": 3348, # REQUIRED -- your EPSG code (see SRID warning below)
"map_center_lat": 45.5, # default map center latitude (optional)
"map_center_lon": -73.5,# default map center longitude (optional)
"map_zoom": 10, # default map zoom level (optional)
},
}
4. Migrate, collect static, restart
cd /opt/netbox/netbox
python manage.py migrate
python manage.py collectstatic --no-input
sudo systemctl restart netbox netbox-rq
If migrate fails with errors mentioning postgis, gdal, or geos, the database backend is still on plain PostgreSQL or the GIS system libraries are missing on the NetBox host. The PostGIS Setup page covers diagnosis and recovery.
Configuration
SRID is immutable after installation
The srid setting defines the coordinate reference system used for all geometry columns in the database. It is baked into the database schema at migration time.
Changing the SRID after data has been loaded WILL CORRUPT YOUR SPATIAL DATA. PostgreSQL / PostGIS does NOT automatically re-project existing coordinates when the column SRID changes. Geometries will have wrong coordinates in the new CRS with no way to recover them automatically.
Choose your SRID carefully before first deployment. Common choices:
| EPSG | Name | Notes |
|---|---|---|
4326 |
WGS84 (GPS coordinates, degrees) | Global, but distorts distances and areas. |
3857 |
Web Mercator (meters) | Used by Google Maps, OSM tiles. |
3348 |
NAD83(CSRS) / Statistics Canada Lambert (m) | Good for Canada. |
2154 |
RGF93 / Lambert-93 (meters) | Good for France. |
32632 |
WGS84 / UTM zone 32N (meters) | Good for central Europe. |
If you need to change SRID after deployment, you must manually re-project all geometry data using PostGIS ST_Transform() and update the column SRID definitions. This is an advanced DBA operation; back up everything first.
QGIS quick start
Generate a QGIS project with all layers pre-configured:
python manage.py generate_qgis_project \
--url https://your-netbox \
--token your-api-token
Open the generated .qgs file in QGIS. Style files (.qml) ship under static/netbox_pathways/qgis/ and can be loaded via Layer Properties > Style > Load Style.
REST and GeoJSON API
All resources are exposed under /api/plugins/pathways/. GeoJSON variants live under /api/plugins/pathways/geo/ for direct QGIS / OGR consumption. See API Examples for full endpoint coverage.
GraphQL
Every Pathways model is exposed on NetBox's /graphql/ endpoint (single and _list queries: structure, structure_list, pathway, pathway_list, conduit, conduit_list, etc.). Geometry fields are intentionally omitted -- query the GeoJSON REST endpoints for spatial data.
Documentation
Full documentation: jsenecal.github.io/netbox-pathways
- Installation
- PostGIS Setup
- SRID Selection
- Configuration
- Concepts
- QGIS Integration
- Architecture
- GeoJSON API reference
Contributing
PRs welcome. Use conventional-commits PR titles (feat:, fix:, chore:, docs:, ...) -- release-drafter assembles release notes from them. Run make setup after cloning to install dev dependencies and the pre-commit hooks (including the AI-attribution-rejecting commit-msg hook).
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netbox_pathways-0.2.0.tar.gz.
File metadata
- Download URL: netbox_pathways-0.2.0.tar.gz
- Upload date:
- Size: 377.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c91f14cce620fc5ba14d27b78eab2ee518f379859cfb7117051cf952838e203b
|
|
| MD5 |
ac38f6d83998d927f6aadaa74b5d39df
|
|
| BLAKE2b-256 |
12ced4854cade681372c5e905c6b4d92a74576a6b18334b1ffe2397ca8672ad3
|
Provenance
The following attestation bundles were made for netbox_pathways-0.2.0.tar.gz:
Publisher:
publish.yml on jsenecal/netbox-pathways
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbox_pathways-0.2.0.tar.gz -
Subject digest:
c91f14cce620fc5ba14d27b78eab2ee518f379859cfb7117051cf952838e203b - Sigstore transparency entry: 1454962393
- Sigstore integration time:
-
Permalink:
jsenecal/netbox-pathways@1ca8adea107ae8083889d7f4052e13d98b67bf5b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/jsenecal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1ca8adea107ae8083889d7f4052e13d98b67bf5b -
Trigger Event:
release
-
Statement type:
File details
Details for the file netbox_pathways-0.2.0-py3-none-any.whl.
File metadata
- Download URL: netbox_pathways-0.2.0-py3-none-any.whl
- Upload date:
- Size: 397.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aca638659f6b67f67abcd03fb507a9352f81b9ac34d37fae1147d4a9da463ebf
|
|
| MD5 |
e03995494b7d7903a13b04411bcc9380
|
|
| BLAKE2b-256 |
0a1c878182282f61a1b7a659e54c0bfa48591336930dde92cbb01ffc3e442c38
|
Provenance
The following attestation bundles were made for netbox_pathways-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on jsenecal/netbox-pathways
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbox_pathways-0.2.0-py3-none-any.whl -
Subject digest:
aca638659f6b67f67abcd03fb507a9352f81b9ac34d37fae1147d4a9da463ebf - Sigstore transparency entry: 1454962478
- Sigstore integration time:
-
Permalink:
jsenecal/netbox-pathways@1ca8adea107ae8083889d7f4052e13d98b67bf5b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/jsenecal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1ca8adea107ae8083889d7f4052e13d98b67bf5b -
Trigger Event:
release
-
Statement type: