lucified/finland-municipalities-topojson

Name: finland-municipalities-topojson

Owner: Lucify

Description: Finland's municipalities in TopoJSON format

Created: 2017-09-15 13:36:29.0

Updated: 2018-02-05 07:50:11.0

Pushed: 2017-09-15 14:07:33.0

Homepage:

Size: 49

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Finland's municipalities in TopoJSON format

This repository contains Finland's municipalities in TopoJSON format. The geometry was somewhat simplified in order to decrease the resulting file size. The contents are up to date as of September 2017.

The municipalities are inside an object called kuntarajat. Each municipality has a properties object with code (string id) and name fields.

Included is also a GeoJSON of the municipalities' centroids.

Usage

Convert the TopoJSON to GeoJSON using topojson:

rt { feature } from 'topojson';

t municipalitiesTopoJSON = require('./finland-municipalities-topojson.json');

t geoJSON = feature(
nicipalitiesTopoJSON,
nicipalitiesTopoJSON.objects.kuntarajat,

Source

The file was generated by simplifying https://github.com/tomimick/mapcolorizer/blob/master/data-finland/data/kuntarajat.geojson using http://mapshaper.org/. Since the source data contained old municipalities that no longer exist, these were combined with the correct neighbouring municipalities with the following command:

merge kuntarajat=kuntarajat -k '["476", "174"].indexOf(d.properties.code) > -1 ? "297" : "532" === d.properties.code ? "398" : "283" === d.properties.code ? "098" : "164" === d.properties.code ? "301" : "413" === d.properties.code ? "609" : "442" === d.properties.code ? "051" : "319" === d.properties.code ? "783" : "838" === d.properties.code ? "423" : d.properties.code' < finland-municipalities-topojson.json > finland-municipalities-topojson-new.json

Once merged, the properties object (with code and name) needed to be added to the combined shapes manually.

The centroids were generated with:

rt { geoCentroid } from 'd3-geo';
rt { feature } from 'topojson';

t municipalitiesTopoJSON = require('./finland-municipalities-topojson.json');

t geojson = feature(
nicipalitiesTopoJSON,
nicipalitiesTopoJSON.objects.kuntarajat,


.stringify({
pe: 'FeatureCollection',
atures: geojson.features.map(f => ({
type: 'Feature',
id: f.properties.code,
geometry: {
  type: 'Point',
  coordinates: geoCentroid(f),
},
),


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.