Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

Co-authored-by: renovate[bot] <29139614+renovate[bot]>
4c495b1 1

Git stats


Failed to load latest commit information.
Latest commit message
Commit time

swiss-maps on npm

This is the documentation for the swiss-maps npm package and website v4. For the previous Makefile and instructions, please check the legacy branch.

Swiss Maps

This repository provides a mechanism to generate TopoJSON from publicly available swisstopo geodata.

The geodata is based on the generalized from the FSO.

The Makefile cleans the source data further, so the features are as consistent as possible across different years and the properties are consistently named.

For convenience, the generated files are published on npm

Getting Started

All Shapefiles and TopoJSON files are cleaned and pre-packaged in this package.

You can install it locally using npm:

npm i swiss-maps

You can read the files from the installed package directory, which is structured like this:

- node_modules/
  - swiss-maps/
    - 2010/
      - cantons.{dbf,prj,shp,shx}
      - country.{dbf,prj,shp,shx}
      - districts.{dbf,prj,shp,shx}
      - lakes.{dbf,prj,shp,shx}
      - municipalities.{dbf,prj,shp,shx}
      - ch-combined.json (TopoJSON)
    - 2011/
    - 2021/

The TopoJSON file combines all layers into one file. Separate TopoJSON files for single layers will be added in the future.

Use the TopoJson files in your web application

Load from

If you don't want to install anything and just want to load the file, you can fetch it from (or any other npm registry CDN).

import * as topojson from "topojson-client";

const res = await fetch(``);
const topo = await res.json();

const municipalities = topojson.feature(topo, topo.objects.municipalities);
// Render the municipalities ...

Bundled app (e.g. Next.js)

If you're using a bundler that can resolve locally installed npm packages, you can add the swiss-maps npm package to your project.

npm i swiss-maps
import * as topojson from "topojson-client";

const topo = await import(`swiss-maps/2021/ch-combined.json`);

const municipalities = topojson.feature(topo, topo.objects.municipalities);

// Render the municipalities ...


The code in this repository is licensed under BSD-3-Clause.

The geodata is published under a non-commercial license and needs to be attributed with the source "Bundesamt für Statistik (BFS), GEOSTAT".