Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FACT Rail Stations and Lines
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FACT
FACT Data Services
FACT Rail Stations and Lines
Commits
f70de256
Commit
f70de256
authored
1 year ago
by
Riccardo Boero
Browse files
Options
Downloads
Patches
Plain Diff
Fixed selection of train stations in Europe and NA.
parent
87fa9662
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inputs/load_maps.sh
+49
-5
49 additions, 5 deletions
inputs/load_maps.sh
with
49 additions
and
5 deletions
inputs/load_maps.sh
+
49
−
5
View file @
f70de256
...
@@ -11,8 +11,30 @@ osmium tags-filter temp/europe-latest.osm.pbf w/railway=rail -o temp/line_europe
...
@@ -11,8 +11,30 @@ osmium tags-filter temp/europe-latest.osm.pbf w/railway=rail -o temp/line_europe
osmium
export
temp/line_europe.pbf
--geometry-types
=
linestring
-o
temp/line_europe.geojson
--overwrite
osmium
export
temp/line_europe.pbf
--geometry-types
=
linestring
-o
temp/line_europe.geojson
--overwrite
# export stations
# export stations
osmium tags-filter temp/europe-latest.osm.pbf n/railway
=
station
-R
-o
temp/station_europe.pbf
--overwrite
osmium tags-filter temp/europe-latest.osm.pbf n/railway
=
station
-R
-o
temp/station_europe.pbf
--overwrite
osmium tags-filter temp/station_europe.pbf n/railway:traffic_mode
-R
-o
temp/station_europe.pbf
--overwrite
osmium tags-filter temp/station_europe.pbf n/subway
=
yes
-R
-o
temp/subway_europe.pbf
--overwrite
osmium
export
temp/station_europe.pbf
-o
temp/station_europe.geojson
--overwrite
osmium
cat
temp/station_europe.pbf
-o
temp/station_europe.osm
osmium
cat
temp/subway_europe.pbf
-o
temp/subway_europe.osm
grep
'<node'
temp/subway_europe.osm |
awk
-F
' id="'
'{print $2}'
|
awk
-F
'"'
'{print $1}'
>
temp/exclude_europe_subway_ids.txt
awk
'
BEGIN {
while (getline < "temp/exclude_europe_subway_ids.txt") exclude[$1] = 1;
inNode = 0;
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; # Ensure the XML header is included
print "<osm version=\"0.6\" generator=\"osmium/1.8.0\">"; # Adjust osmium version as needed
}
/^ *<node / {
split($0, a, / id="|"/);
nodeId = a[2];
inNode = !(nodeId in exclude);
}
inNode { print }
/^ *<\/node>/ { inNode = 0; }
END {
print "</osm>";
}
'
temp/station_europe.osm
>
temp/station_europe-filtered.osm
osmium
cat
temp/station_europe-filtered.osm
-o
temp/station_europe-filtered.osm.pbf
osmium
export
temp/station_europe-filtered.osm.pbf
-o
temp/station_europe.geojson
--overwrite
# load in DB
# load in DB
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/station_europe.geojson
-nln
eu_stations
-update
-overwrite
-lco
engine
=
Aria
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/station_europe.geojson
-nln
eu_stations
-update
-overwrite
-lco
engine
=
Aria
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/line_europe.geojson
-nln
eu_lines
-update
-overwrite
-lco
engine
=
Aria
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/line_europe.geojson
-nln
eu_lines
-update
-overwrite
-lco
engine
=
Aria
...
@@ -26,10 +48,32 @@ osmium tags-filter temp/north-america-latest.osm.pbf w/railway=rail -o temp/line
...
@@ -26,10 +48,32 @@ osmium tags-filter temp/north-america-latest.osm.pbf w/railway=rail -o temp/line
osmium
export
temp/line_north-america.pbf
--geometry-types
=
linestring
-o
temp/line_north-america.geojson
--overwrite
osmium
export
temp/line_north-america.pbf
--geometry-types
=
linestring
-o
temp/line_north-america.geojson
--overwrite
# export stations
# export stations
osmium tags-filter temp/north-america-latest.osm.pbf n/railway
=
station
-R
-o
temp/station_north-america.pbf
--overwrite
osmium tags-filter temp/north-america-latest.osm.pbf n/railway
=
station
-R
-o
temp/station_north-america.pbf
--overwrite
osmium tags-filter temp/station_north-america.pbf n/railway:traffic_mode
-R
-o
temp/station_north-america.pbf
--overwrite
osmium tags-filter temp/station_north-america.pbf n/subway
=
yes
-R
-o
temp/subway_na.pbf
--overwrite
osmium
export
temp/station_north-america.pbf
-o
temp/station_north-america.geojson
--overwrite
osmium
cat
temp/station_north-america.pbf
-o
temp/station_north-america.osm
--overwrite
osmium
cat
temp/subway_na.pbf
-o
temp/subway_na.osm
--overwrite
grep
'<node'
temp/subway_na.osm |
awk
-F
' id="'
'{print $2}'
|
awk
-F
'"'
'{print $1}'
>
temp/exclude_na_subway_ids.txt
awk
'
BEGIN {
while (getline < "temp/exclude_na_subway_ids.txt") exclude[$1] = 1;
inNode = 0;
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; # Ensure the XML header is included
print "<osm version=\"0.6\" generator=\"osmium/1.8.0\">"; # Adjust osmium version as needed
}
/^ *<node / {
split($0, a, / id="|"/);
nodeId = a[2];
inNode = !(nodeId in exclude);
}
inNode { print }
/^ *<\/node>/ { inNode = 0; }
END {
print "</osm>";
}
'
temp/station_north-america.osm
>
temp/station_na-filtered.osm
osmium
cat
temp/station_na-filtered.osm
-o
temp/station_na-filtered.pbf
osmium
export
temp/station_na-filtered.pbf
-o
temp/station_north-america.geojson
--overwrite
# load in DB
# load in DB
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/station_north-america.geojson
-nln
na_stations
-update
-overwrite
-lco
engine
=
Aria
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/station_north-america.geojson
-nln
na_stations
-update
-overwrite
-lco
engine
=
Aria
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/line_north-america.geojson
-nln
na_lines
-update
-overwrite
-lco
engine
=
Aria
ogr2ogr
-f
MySQL MySQL:FACT_rail,host
=
plazablanca.nilu.no,user
=
root,password
=
impadminPSWD! ./temp/line_north-america.geojson
-nln
na_lines
-update
-overwrite
-lco
engine
=
Aria
#clean up
#clean up
#
rm -r temp
rm
-r
temp
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment