Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930#!/bin/sh# Regenerates data.fgb from the SJV WFS endpoint.# Run annually (data is per arslager/year) or whenever a new year's data is published.# Requires ogr2ogr (GDAL): apt-get install gdal-bin## Suggested cron (1 Feb each year, after SJV typically publishes new data):# 0 6 1 2 * /path/to/scripts/refresh-data.sh
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"OUT="$SCRIPT_DIR/../data"
WFS_URL="WFS:http://epub.sjv.se/inspire/inspire/ows"
echo "Fetching from WFS and writing FlatGeobuf..."
ogr2ogr \ -f FlatGeobuf "$OUT" \ "$WFS_URL" \ -t_srs EPSG:4326 \ -select "ppn,uppdat" \ -where "djurslag='FÅR' AND arslager=2025" \ -nln farms \ -skipfailures \ -q \ produktionsplatser
echo "Done: $OUT"