GTFS Shape Editor Django-App
Webapp which uses Vue, OpenLayers/OpenStreetMap, sweetalert2 and Bootstrap. Editor shows a map where you can draw and route shapes, place stops and edit the properties in the tables just below.
Install
pip install shapeeditor
Add the app 'shapeeditor' in your Django project settings file
INSTALLED_APPS = [
...
'shapeeditor',
...
]
Shapeeditor needs authentication to push data in database, define the LOGIN_URL variable to know where redirect visitor when they are not logged.
LOGIN_URL='/admin/login/'
# First point map extent area [longitude, latitude]
# +++++++++
# + +
# + Map +
# + +
# ---> @++++++++
# Second point map extent area [longitude, latitude]
# ++++++++@ <---
# + +
# + Map +
# + +
# +++++++++
SHAPEEDITOR_MAP_EXTENT_AREA = [
[-84.43669241118701, 9.726525930153954],
[-83.72894500499169, 9.99625455768836]]
# Center by default on load [longitude, latitude]
SHAPEEDITOR_MAP_CENTER = [-84.1027104, 9.865107]
# Router service for shape generation request (This one is a free demo)
SHAPEEDITOR_ROUTING_MACHINE_URL = "http://router.project-osrm.org/route/v1/driving/"
Include Shapeeditor urls in urls.py, then we can open the editor from the site, draw the shape and download as a shapes.txt or import it to the database.
urlpatterns = [
path('shapeeditor/', include('shapeeditor.urls')),
]
Just to be sure database is ok run the next commands.
./manage.py makemigrations
./manage.py migrate
Usage
Map interface allows the user to draw a shape, cut links and delete links and nodes, to create a shape you need to define two endpoints then put waypoints between the begin and end, more waypoints means better aproximation.
Most of the features are already implemented in JS but there is not a GUI equivalent to call for methods yet.
Shapes are made with nodes, nodes have a type, it could be endpoint for start or end of shapes, stops, these can be part of the shape too, fork are the nodes where are more than two links, waypoint are the common nodes. To create a Shape first draw paths clicking on map with the interaction add_node, when you already have a connection between two endpoints through multiple nodes and links add a Shape in the section below, once added the shape pick the waypoints with select_node + Shift, when you pick a waypoint and it is in a shape segment, the whole segment is selected, pick only waypoints their segments are in the shape.
Pick waypoints from the start node to the final node, keep the waypoints in order to avoid backward motion, when you pick a waypoint the section>accordion for the shape we are adding the waypoints will show the waypoints list, when the the waypoints are enough click on save button to write the shape, then push it to database.
Hide and show elements on map
Add and delete nodes
Remove and split links
Uninstall
Just delete all the mentions in settings.py and remove the package from your Python libs
pip uninstall shapeeditor
How to contribute
PR are welcome.
Here some screenshots:
Sponsor
bc1qaw6urpy8t38fq3psp3p0xst4chq0yu4gamtu3v
Metadata
Release files for shapeeditor 0.1.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shapeeditor-0.1.14.tar.gz | 980.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shapeeditor-0.1.14-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 2.0 MB
Release files / shapeeditor-0.1.14.tar.gz
| Download URL | shapeeditor-0.1.14.tar.gz |
|---|---|
| Size | 980.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8360e2c4c69ff121b8126e2771589cb493e45bbee55c63657c7928b71310339
|
|
BLAKE2b-256 checksum How to use checksums |
d3517f96aa6e24b17ff955bf52ddcc3bfd935927390a7465fefd327e4242cc9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.4
|
Release files / shapeeditor-0.1.14-py2.py3-none-any.whl
| Download URL | shapeeditor-0.1.14-py2.py3-none-any.whl |
|---|---|
| Size | 991.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d9e853a968b64376f6e6c72721c5162d5efbc4af746ec0f472fa78fdccb75687
|
|
BLAKE2b-256 checksum How to use checksums |
5af85235ccfe8ffc5bd73a148a559c1cf3ce066c1d698dc387185de19152f633
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.4
|