This repository lets you test flowmap.blue with relocation data from Statistics Netherlands.
Read this manual for all the steps that are needed to achieve this result by @rug_geo.
You can also find the necessary sql in flowmap.sql
- Go to Statistics Netherlands and choose Downloads -> Onbewerkte dataset (raw dataset).
- Choose "Regio van Vestigingen" (destinations) -> "Alle Gemeenten" (all municipalities).
- Choose "Regio van Vertrek" (departures) -> "Alle Gemeenten" (all municipalities).
- Choose "Periodes" -> 2017
- Download csv
Follow the steps from the flowmap.blue manual.
In this case we used PostgreSQL with Postgis. This migt work with sqlite or mysql too, apart from the coordinates transformation.
- Create relocation data table:
create table relocations(
id text,
from text,
to text,
period text,
count text
)
;
- Import the downloaded csv Use your preferred way of imporing data, in my case psql:
\copy relocations from Downloads/relocations.csv csv header delimiter ';';
- If you don't have the Dutch municipalities in your database, download them from Statistics Netherlands and import into your database. E.g. via Qgis DB Manager or ogr2ogr
- Export a list of municipalities and their centroids in lat/long (for labeling).
select
substring(gm_code,3) as id,
gm_naam as municipality_name,
st_y(st_transform(st_centroid(geom),4326)) y,
st_x(st_transform(st_centroid(geom),4326)) x
from
cbs_gemeente_2017
;
Copy the result into the locations tab in your google sheet
- Export the flows between municipalities
The municipal code is trimmed to end up with a numerical identifier. The count is trimmed to get rid of any spaces.
select
substring(from,3)::text from,
substring(to,3)::text to,
count::text
from
relocations
where
from is not null
and
to is not null
and
count is not null
and
trim(count) != '0'
;
Copy the result into the flows tab in your google sheet and check out your map!