From Shapefile to TopoJSON
a transformation process from the Shapefile format to the TopoJSON format, both of which are file formats used in geographic information systems (GIS).
Shapefile
Download the latest SHP file of administrative divisions
Shapefiles are a popular file format used in geographic information systems (GIS) for storing the geometric location and attribute information of spatial features.
Shapefiles store the geometry of spatial features using vector coordinates. This geometry can represent various types of features like points, lines, and polygons (areas).
[ESRI Shapefile Technical Description]
Shapefile to GeoJSON
- GeoJSON
GeoJSON is a format for encoding a variety of geographic data structures.{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }, "properties": { "name": "Dinagat Islands" } }
์์ฑํ ์ด๋ธ ํ์ธํ๊ธฐ (QGIS)
๋ ์ด์ด ํจ๋์์ [sig] layer์ ๋ง์ฐ์ค ์ค๋ฅธ์ชฝ ํด๋ฆญ > โ์์ฑ ํ ์ด๋ธ ์ด๊ธฐ(A)โ ํด๋ฆญ- ๋ค๋ฅธ ํ์ผ๊ณผ ๊ฒฐํฉํ์ง ์์ ๋
- [ํ์ผ๋ช ].shp ํ์ผ ์ถ๊ฐ(๋ ์ด์ด ํจ๋์ ํ์ผ ๋๋๊ทธ)
- ๋ ์ด์ด ํจ๋์์ [sig] layer์ ๋ง์ฐ์ค ์ค๋ฅธ์ชฝ ํด๋ฆญ > โExportโ > โ๊ฐ์ฒด๋ฅผ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ์ ์ฅโ > ์๋์ ๋ด์ฉ ์์ฑ ๋ค โํ์ธโ ๋ฒํผ ํด๋ฆญ
ํฌ๋งท: GeoJSON / ํ์ผ ์ด๋ฆ: ํ์ผ ์์นโฉ[filename].geojson / ์ขํ๊ณ: ํ๋ก์ ํธ ์ขํ๊ณ: EPSG:4326 - WGS 84 / ์ธ์ฝ๋ฉ: UTF-8 - geoJSON ํ์ผ์ด ์์ฑ๋จ.
- ์์ฑํ
์ด๋ธ์ ์ถ๊ฐ ์ ๋ณด๋ฅผ csv์์ ๊ฐ์ ธ์ ์กฐ์ธํ๊ธฐ
- [ํ์ผ๋ช ].shp ํ์ผ ์ถ๊ฐ(๋ ์ด์ด ํจ๋์ ํ์ผ ๋๋๊ทธ)
- csv ํ์ผ ๋ถ๋ฌ์ค๊ธฐ
๋ ์ด์ด > ๋ฐ์ดํฐ ์๋ณธ ๊ด๋ฆฌ์ ํด๋ฆญ
๊ตฌ๋ถ์๋ก ๋ถ๋ฆฌ๋ ํ ์คํธ ํด๋ฆญ > ํ์ผ ์ ํ > ์ธ์ฝ๋ฉ ํ์ธ(UTF-8) > ๋ํ์์(์์ฑ๋ง ์๋ ํ ์ด๋ธ) ํด๋ฆญ > ์ถ๊ฐ ํด๋ฆญ
๋ ์ด์ด์ ์ถ๊ฐ๋ ๊ฒ์ ๋ณผ ์ ์์ - ์์ฑ ๊ฒฐํฉํ๊ธฐ
๋ ์ด์ด์์ฑ> ๊ฒฐํฉ > + ๋ฒํผ ํด๋ฆญ
๋ฒกํฐ ๊ฒฐํฉ ์ถ๊ฐํ๊ธฐ
๊ฒฐํฉ ๋ ์ด์ด: csv ํ์ผ๋ช / ๋์ ํ๋๋ฅผ ๊ธฐ์ค์ผ๋ก ๋๋จธ์ง ์ ๋ณด ์ถ๊ฐ ์ ์ฉ > ํ์ธ ์์ฑ ํ ์ด๋ธ ํ์ธ - ๋ ์ด์ด ํจ๋์์ sig layer์ ๋ง์ฐ์ค ์ค๋ฅธ์ชฝ ํด๋ฆญ > Export > ๊ฐ์ฒด๋ฅผ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ์ ์ฅ
- geoJSON ํ์ผ์ด ์์ฑ๋จ
GeoJSON to TopoJSON
- TopoJSON topojson specification
TopoJSON is an extension of GeoJSON that encodes topology. Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs{ "type": "Topology", "objects": { "dinagatIslands": { "type": "GeometryCollection", "geometries": [ { "type": "Point", "properties": { "name": "Dinagat Islands" }, "coordinates": [125.6, 10.1] } ] } } }
- geoJSON ํ์ผ ๋๋๊ทธ ์ธ
- โdetect line intersectionsโ ์ฒดํฌ > import ํด๋ฆญ
- simplify ํด๋ฆญ > Settings ์กฐ์ (์์์๋ก ๊ฒฝ๊ณ๊ฐ ๋จ์ํด์ง) > โVisvalingam/weighted areaโ ์ ํ > apply
- Export ํด๋ฆญ > TopoJSON ํด๋ฆญ > Export ํด๋ฆญ
- topoJSON ํ์ผ์ด ์์ฑ๋จ