GithubHelp home page GithubHelp logo

dkaoster / taiwan-atlas Goto Github PK

View Code? Open in Web Editor NEW
135.0 4.0 8.0 23.25 MB

Pre-built TopoJSON from the Ministry of the Interior.

Home Page: https://observablehq.com/@dkaoster/taiwan-map

License: MIT License

JavaScript 62.00% Shell 38.00%
taiwan topojson atlas

taiwan-atlas's Introduction

Taiwan Atlas TopoJSON

Similar to the topojson/us-atlas project, this repository provides a topojson redistribution of the shapefiles provided by Taiwan's Ministry of the Interior. See the demo for usage example.

All of these files are provided at a scale of 1:10 thousand.

File Reference

# villages-10t.json · Download

A TopoJSON file containing the geometry collections villages, towns, counties, and nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Ministry of the Interior’s 村里界圖(TWD97經緯度). The town boundaries are computed by merging villages, the county boundaries by merging towns, and the nation boundary is computed by merging counties, ensuring a consistent topology.

# villages-mercator-10t.json · Download

A TopoJSON file containing the geometry collections villages, towns, counties, and nation. The geometry is quantized, simplified, and projected with the mercatorTw projection. This topology is derived from the Ministry of the Interior’s 村里界圖(TWD97經緯度). The town boundaries are computed by merging villages, the county boundaries by merging towns, and the nation boundary is computed by merging counties, ensuring a consistent topology. This file also contains a compBorders object for optionally drawing the borders of the composed areas.

# towns-10t.json · Download

A TopoJSON file containing the geometry collections towns, counties, and nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Ministry of the Interior’s 鄉鎮市區界線(TWD97經緯度). The county boundaries are computed by merging towns and the nation boundaries by merging counties, ensuring a consistent topology.

# towns-mercator-10t.json · Download

A TopoJSON file containing the geometry collections towns, counties, and nation. The geometry is quantized, simplified, and projected with the mercatorTw projection. This topology is derived from the Ministry of the Interior’s 鄉鎮市區界線(TWD97經緯度). The county boundaries are computed by merging towns and the nation boundaries by merging counties, ensuring a consistent topology. This file also contains a compBorders object for optionally drawing the borders of the composed areas.

# districts-10t.json · Download

A TopoJSON file containing the geometry collections districts specifying legislative districts, counties, and nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Ministry of the Interior’s 鄉鎮市區界線(TWD97經緯度) and combined via the districts specified in this json file. The county boundaries are computed by merging districts and the nation boundaries by merging counties, ensuring a consistent topology.

# districts-mercator-10t.json · Download

A TopoJSON file containing the geometry collections districts specifying legislative districts, counties, and nation. The geometry is quantized, simplified, and projected with the mercatorTw projection. This topology is derived from the Ministry of the Interior’s 鄉鎮市區界線(TWD97經緯度) and combined via the districts specified in this json file. The county boundaries are computed by merging districts and the nation boundaries by merging counties, ensuring a consistent topology. This file also contains a compBorders object for optionally drawing the borders of the composed areas.

# counties-10t.json · Download

A TopoJSON file containing the geometry collections counties, and nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Ministry of the Interior’s 直轄市、縣市界線(TWD97經緯度). The nation boundaries are computed by merging counties, ensuring a consistent topology.

# counties-mercator-10t.json · Download

A TopoJSON file containing the geometry collections counties and nation. The geometry is quantized, simplified, and projected with the mercatorTw projection. This topology is derived from the Ministry of the Interior’s 直轄市、縣市界線(TWD97經緯度). The nation boundaries are computed by merging counties, ensuring a consistent topology. This file also contains a compBorders object for optionally drawing the borders of the composed areas.

# nation-10t.json · Download

A TopoJSON file containing the geometry collections nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Ministry of the Interior’s 直轄市、縣市界線(TWD97經緯度).

# nation-mercator-10t.json · Download

A TopoJSON file containing the geometry collections nation. The geometry is quantized, simplified, and projected with the mercatorTw projection. This topology is derived from the Ministry of the Interior’s 直轄市、縣市界線(TWD97經緯度). This file also contains a compBorders object for optionally drawing the borders of the composed areas.

# tw.objects.nation

The nation object has two fields:

  • nation.properties.ID - "TW"
  • nation.properties.NAME - "Taiwan"

# tw.objects.counties

The county object has the following fields:

  • county.properties.COUNTYNAME - The name of the county in Chinese
  • county.properties.COUNTYENG - The name of the county in English
  • county.properties.COUNTYID - The character specifying id
  • county.properties.COUNTYCODE - The five digit county code

# tw.objects.towns

The town object has the following fields in addition to the county fields:

  • town.properties.TOWNNAME - The name of the county in Chinese
  • town.properties.TOWNENG - The name of the county in English
  • town.properties.TOWNID - The character specifying id
  • town.properties.TOWNCODE - The eight digit county code

# tw.objects.districts

The district object has the following fields in addition to the county fields:

  • district.properties.DISTRICTCODE - The eight digit county code dash (-) the district number

# tw.objects.villages

The village object has the following fields in addition to the town and county fields:

  • village.properties.VILLNAME - The name of the village in Chinese
  • village.properties.VILLENG - The name of the village in English
  • village.properties.VILLID - The village specifying id
  • village.properties.VILLCODE - The 11 digit county code

The compBorders object has the following fields:

  • compBorders.properties.BORDERLEVEL - The administrative level that this border encompasses.
  • compBorders.properties.NAME - The name in Chinese of the administrative area that this border encompasses.
  • compBorders.properties.ID - The id of the administrative area that this border encompasses.
  • compBorders.properties.CODE - The name of the administrative area that this border encompasses.
  • compBorders.properties.ENG - The name in English of the administrative area that this border encompasses.

MercatorTw Projection

mercatorTw.js uses a Taiwan-centric composite projection of four d3.geoMercator projections: One for the main island, and one for each of Penghu, Kinmen, Lienchiang, and Wuqiu respectively.

mercatorTw.getCompositionBorders() returns a svg path string of the borders, given the current scale and translation.

This package exports the mercatorTw projection and can be used in your own projects.

import mercatorTw from 'taiwan-atlas';

License

MIT

taiwan-atlas's People

Contributors

dependabot[bot] avatar dkaoster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

taiwan-atlas's Issues

Add Legislative Districts

Because Taiwan's legislative districts do not directly correspond with either its towns or villages, add an extra layer for legislative districts.

Can not render correct map

@dkaoster
Thanks in advance for your awesome work.

But I got an issue to render your preprojected towns-mercator-10t.json file

I use following code in react to render a president election map

const rawProject: GeoRawProjection = function (x, y) {
  return [x, -y];
};

function myProjection() {
  return geoProjection(rawProject).precision(0).scale(2).translate([0, 0]);
}

const pathGenerator = d3.geoPath().projection(myProjection);

useEffect(() => {
  const g1 = d3.select(countiesRef.current);
  g1.selectAll("path")
    .data(counties.features)
    .join("path")
    .attr("fill", (feature) => countyColor(feature.properties.countyName))
    .attr("stroke", grey[200])
    .attr("stroke-width", 1)
    .attr("d", (feature) => pathGenerator(feature));
}, [myProjection, pathGenerator]);

and I got this broken map
網頁擷取_6-11-2023_231120_localhost

Could you help me to fix this?

English Locality Names

Turns out, the shp files only contain the english names of the localities for the layer that shp file is for. In other words, the village shp file only has the english names for villages, not towns and counties. Therefore, there needs to be a properties processing step to get all the locality names right and also to help with #9.

Use 台 instead of 臺

The data that comes in from the ministry of the interior uses 臺, but should default it to 台.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.