Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2021-08-09-Converting TopoJSON with unvt/nanban

2021-08-09-Converting TopoJSON with unvt/nanban

A simple practice of converting TopoJSON in Windows environment using Docker (unvt/nanban)

UBUKAWA Taro

August 09, 2021
Tweet

More Decks by UBUKAWA Taro

Other Decks in Technology

Transcript

  1. Converting TopoJSON from GeoJSON - Simple conversion practice using Docker(unvt/nanban)

    - Taro Ubukawa Senior Geospatial Expert, UN Geospatial Information Section 09 August 2021
  2. Contents 1. Prerequisite 2. Conversion(1): Start Docker 3. Conversion (2):

    Installing a tool “topojson” 4. Conversion (3): Convert GeoJSON to TopoJSONStart Docker
  3. 1. Prerequisite • Installation of Docker in windows. Windows 10

    64-bit:Pro, Enterprise, or Education For detail: https://docs.docker.com/docker-for-windows/install/ • I used Docker Desktop for Windows (Hyper-V backend and windows containers). For the user of Windows 10 Home, WSL 2 backend would be used. (but I have not confirmed if this works.) This practice is specially for windows users because Mac users may be able to use Terminal. Windows (powershell or cmd) cannot directly use some tool, so we use docker.
  4. 2. Conversion (1): Start Docker • Start command prompt (I

    used Windows Powershell), and move to the working directory. • Then, start Docker (unvt/nanban) > docker pull unvt/nanban > Docker run -it --rm -v ${PWD}:/data unvt/nanban By using “-v” option, please connect your local working directory to “/data” directory. Here, I do not explain the preparation of the Docker environment. Please see https://docs.docker.com/docker-for- windows/install/
  5. (FYI) About unvt/nanban • This is a developer friendly UNVT

    Dockerfile. Developed by Mr. Fujimura in July 2020. I think this tool helps windows users to easily use UNVT. • Features: • based on Ubuntu/Intel → This is the base of the various tools • Tippecanoe is contained. → It can be used for vector tile data conversion. • gdal is contained → It can be used for basic GIS data processing. • HOCON Parse is also available → It can be used for style editing. • The name nanban is from Tamil language. It means friend. You can find detailed information at https://github.com/unvt/nanban
  6. 3. Conversion (2): Installing a tool “topojson” • Move to

    the working directory (it is associated to “/data”). • Install a npm package for TopoJSON > cd /data > npm install –g topojson -server > … For detail: see https://github.com/topojson/topojson According to the npm package page (https://www.npmjs.com/package/topojson), this package has been deprecated.
  7. 4. Conversion (3): Convert GeoJSON to TopoJSON • Convert GeoJSON

    into TopoJSON using geo2topo > geo2topo –o output.json input.geojson > … Then, you will get the TopoJSON data.
  8. (FYI) Conversion with Online tools You may be able to

    find several online conversion tools. I have not tried them, but we could possibly use them as well. • MyGeodata Converter https://mygeodata.cloud/converter/shp-to-topojson • mapshaper https://mapshaper.org/ • etc…
  9. References • Install Docker Desktop on Windows: https://docs.docker.com/docker-for-windows/install/ • Topojson:

    https://github.com/topojson/topojson • UNVT nanban: https://github.com/unvt/nanban