Build a GPX file from a `StopPoint` list
Dijkstra
Dijkstra is a little tool to create a GPX file from a list of StopPoint
.
Usage
To run the project, launch this Gradle command inside the project folder :
gradlew clean run --args='$FILE_PATH'
With $FILE_PATH
which is a CSV file which contains stop points.
Extract StopPoints
To extract a list of stop points, launch the SQL request :
SELECT ns.name,
ns.position,
nso.order
FROM public.network_stoppoints ns,
public.network_stop_orders nso
WHERE ns.id = nso.network_stoppoint_id
AND nso.network_route_id = X
ORDER BY nso.order ASC
With X
which is the ID of a route.
Then export the result to CSV format.
Example
For the following example, we use the route 201.05 of TREMA network.
Result of the SQL request :
name;position;order
MÂCON - COLLEGE ST EXUPERY;(4.8068799823523,46.298111840151);1
MÂCON - ROCCA / COLLEGE PASTEUR;(4.829435,46.311871);2
MÂCON - LYCEE LAMARTINE;(4.8282787296921,46.314048562199);3
MÂCON - ESPLANADE DUMAINE;(4.8157186154276,46.314030960202);4
MÂCON - BD DES 9 CLES / COLLEGE BREART;(4.8203302547336,46.308408714831);5
CHARNAY LES MACON - LA MASSONE;(4.7863215,46.312575);6
PRISSE - LA LOUVRE - LA BEUGOGNE;(4.77863889,46.31593889);7
PRISSE - LES CRAYS;(4.76969722,46.32076389);8
CHEVAGNY LES CHEVRIERES - MONTAGNY;(4.76881111,46.32459722);9
CHEVAGNY LES CHEVRIERES - LE BOURG;(4.771125,46.33150833);10
LA ROCHE VINEUSE - LE GROS MONT;(4.77809024,46.3515422);11
LA ROCHE VINEUSE - NANCELLE;(4.7641289,46.352052);12
LA ROCHE VINEUSE - LES ALLOGNIERS;(4.75633611,46.35009722);13
LA ROCHE VINEUSE - SOMMERE LE HAUT;(4.74848611,46.34593611);14
LA ROCHE VINEUSE - SOMMERE LE BAS;(4.74390833,46.34445278);15
PRISSE - LES BOUTEAUX MONTCEAUX;(4.74472778,46.33926111);16
PRISSE - COLLONGE LAVOIR;(4.74862222,46.33230833);17
PRISSE - COLONGE RD17;(4.748639,46.33024);18
The program transforms this result in a GPX file :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<gpx version="1.0">
<metadata>
<name>TREMA - 201.05</name>
</metadata>
<trk>
<trkseg>
<trkpt lat="46.298111840151" lon="4.8068799823523"/>
<trkpt lat="46.311871" lon="4.829435"/>
<trkpt lat="46.314048562199" lon="4.8282787296921"/>
<trkpt lat="46.314030960202" lon="4.8157186154276"/>
<trkpt lat="46.308408714831" lon="4.8203302547336"/>
<trkpt lat="46.312575" lon="4.7863215"/>
<trkpt lat="46.31593889" lon="4.77863889"/>
<trkpt lat="46.32076389" lon="4.76969722"/>
<trkpt lat="46.32459722" lon="4.76881111"/>
<trkpt lat="46.33150833" lon="4.771125"/>
<trkpt lat="46.3515422" lon="4.77809024"/>
<trkpt lat="46.352052" lon="4.7641289"/>
<trkpt lat="46.35009722" lon="4.75633611"/>
<trkpt lat="46.34593611" lon="4.74848611"/>
<trkpt lat="46.34445278" lon="4.74390833"/>
<trkpt lat="46.33926111" lon="4.74472778"/>
<trkpt lat="46.33230833" lon="4.74862222"/>
<trkpt lat="46.33024" lon="4.748639"/>
</trkseg>
</trk>
<wpt lat="46.298111840151" lon="4.8068799823523">
<name>MÂCON - COLLEGE ST EXUPERY</name>
</wpt>
<wpt lat="46.311871" lon="4.829435">
<name>MÂCON - ROCCA / COLLEGE PASTEUR</name>
</wpt>
<wpt lat="46.314048562199" lon="4.8282787296921">
<name>MÂCON - LYCEE LAMARTINE</name>
</wpt>
<wpt lat="46.314030960202" lon="4.8157186154276">
<name>MÂCON - ESPLANADE DUMAINE</name>
</wpt>
<wpt lat="46.308408714831" lon="4.8203302547336">
<name>MÂCON - BD DES 9 CLES / COLLEGE BREART</name>
</wpt>
<wpt lat="46.312575" lon="4.7863215">
<name>CHARNAY LES MACON - LA MASSONE</name>
</wpt>
<wpt lat="46.31593889" lon="4.77863889">
<name>PRISSE - LA LOUVRE - LA BEUGOGNE</name>
</wpt>
<wpt lat="46.32076389" lon="4.76969722">
<name>PRISSE - LES CRAYS</name>
</wpt>
<wpt lat="46.32459722" lon="4.76881111">
<name>CHEVAGNY LES CHEVRIERES - MONTAGNY</name>
</wpt>
<wpt lat="46.33150833" lon="4.771125">
<name>CHEVAGNY LES CHEVRIERES - LE BOURG</name>
</wpt>
<wpt lat="46.3515422" lon="4.77809024">
<name>LA ROCHE VINEUSE - LE GROS MONT</name>
</wpt>
<wpt lat="46.352052" lon="4.7641289">
<name>LA ROCHE VINEUSE - NANCELLE</name>
</wpt>
<wpt lat="46.35009722" lon="4.75633611">
<name>LA ROCHE VINEUSE - LES ALLOGNIERS</name>
</wpt>
<wpt lat="46.34593611" lon="4.74848611">
<name>LA ROCHE VINEUSE - SOMMERE LE HAUT</name>
</wpt>
<wpt lat="46.34445278" lon="4.74390833">
<name>LA ROCHE VINEUSE - SOMMERE LE BAS</name>
</wpt>
<wpt lat="46.33926111" lon="4.74472778">
<name>PRISSE - LES BOUTEAUX MONTCEAUX</name>
</wpt>
<wpt lat="46.33230833" lon="4.74862222">
<name>PRISSE - COLLONGE LAVOIR</name>
</wpt>
<wpt lat="46.33024" lon="4.748639">
<name>PRISSE - COLONGE RD17</name>
</wpt>
</gpx>
Now, you can do an import in Lokito…