Vega Visualization Grammer and Geofon: Visualising Earthquakes
If you find any issues with the instructions then do not hesitate to create an issue hereChangelog
| Date | Description |
|---|---|
| 2025-11-29 | Initial version |
Demo
Find here all earthquakes reported by GFZ (Helmholtz Centre
for Geosciences) for today (limited to the 40 most recent ones) visualized using the Vega Visualization Grammar.
Description
This is a demonstration how to use the Vega Visualisation Grammar with a complex visualization and a data source
from the web (Earthquakes by GFZ).
We show the most 40 recent earthquakes in the world reported by GFZ when the user opens the web page.
Technical Aspects
This is a static web page and it is self-contained, ie it hosts all the scripts and stylesheets. We do NOT load
the Vega library from a Content Delivery Network (CDN) as this is not under our control and insecure (despite
being recommended on the Vega web page). See, for example, here.
We use Content Security
Policies to secure the page against cross-site scripting attacks. You will need to include vega-interpreter for this. However, in the
current version of the page we must still allow "unsafe-eval" for script-src, because vega-interpreter does not
seem to support all functions (see bug
report).
We used the Vega online editor to develop the
visualisation. You can find the JSON spec here. It is based on this Vega example. We load in the spec the 40 most recent earthquakes using the following
source: https://geofon.gfz.de/fdsnws/event/1/query?limit=40&format=text
You can find the full code of this web page here:
https://codeberg.org/jornfranke/demo-web-pages/src/branch/pages/vega-gfz-earthquakes/