Create an animated sequence from www.map.geo.admin.ch with Python. Create a list of camera positions for a Circle, Round or Path. Produce a screenshots for every camera position. Collect them together to a video file.
The following software is required for successful process execution of the script:
Install the following Python libraries:
pip install requests
pip install selenium
pip install moviepy
- CreateCameras (choose one mode)
- Circle
- Path
- Round
- CreateScreenshots
- CreateVideo
- Using center coordinate and radius
- Calculating camera positions in WGS84, elevations, headings and pitches
- Save calculations in a dump file
- Using path in list format or KML file
- Smoothing path geometry
- Calculating camera positions in WGS84, elevations, headings and pitches
- Save calculations in a dump file
- Using center coordinate
- Calculating camera positions in WGS84, elevations, headings and pitches
- Save calculations in a dump file
- Defining base URL from www.map.geo.admin.ch
- Link and start chromedriver
- Generate and save image for every camera position
- Sort images
- Create list of images and collect them to a video
- Save the MP4 video file
The following main parameters should be adapted to the specific project.
Coordinates in EPSG:2056
center = [2600000, 1200000] # Bern
path2D = [[2600334, 1199351],[2600276, 1199419]] # Marzilibahn
KML file with one LineString
in EPSG:4326 in example from map.geo.admin.ch
kml = 'line.kml'
Constant elevation in meter above sea level.
elevation = 700
Pitch (inclination) in degree , 0 is horizontal.
pitch = -20
Radius in meter for the camera positions.
radius = 2000
Steps (amount) of camera positions or amount of screenshots.
steps = 4
Seconds of sleeping before taking a screenshot.
sleep = 60
Place the scripts in the same folder in example.
C:\temp
The automatically generated folder has the following path.
C:\temp\Images
Then this should be the path for the chromedriver.
C:\temp\chromedriver.exe
Open with VLC player
- Michael Zwick | twitter
#Python script for video production with @swisstopo, @swiss_geoportal, https://t.co/R48qMxBHAT, https://t.co/eSrZVQh4kX data available on https://t.co/PZsXliGa1M including example video from #säntis #schwägalp #alpstein pic.twitter.com/Dn6POec42k
— Michael Zwick (@zwickmichael) 21. Januar 2019
New version of https://t.co/vvuk5J6dIH available on https://t.co/PZsXliGa1M. Create a video from @swisstopo data on @swiss_geoportal with #python. Use new modes circle, path and round. #Bern #Gurten pic.twitter.com/lt1236epYm
— Michael Zwick (@zwickmichael) 24. Februar 2019
- Inspired by David Oesch GitHub
- Map viewer of the Federal spatial data infrastructure (FSDI) map.geo.admin.ch
- Data from the Federal Office of Topography swisstopo