Last active
February 4, 2023 02:52
-
-
Save typebrook/3cdc4cf351669a8400aca06229f891a6 to your computer and use it in GitHub Desktop.
Extract fields from county raw data #gis #gov #taiwan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kaohsiung.csv: | |
curl -Lo $@ https://data.kcg.gov.tw/dataset/7b142b2b-4d92-4a22-ac63-339c95bb0dfc/resource/d6e12411-8655-40ff-a2b2-ea3791c7c586/download/firehydrantonground.csv | |
taipei.csv: | |
curl -L https://data.taipei/api/getDatasetInfo/downloadResource\?id\=c106a00b-5a21-4393-b213-475a0ece9f2b\&rid\=b9f8154d-c627-48a8-b3ef-512ed9cde9e7 \ | |
| iconv -f BIG-5 -t UTF-8 >$@ | |
taoyuan_97.csv: | |
curl -Lo raw.json https://data.tycg.gov.tw/opendata/datalist/datasetMeta/download\?id\=3fd4a492-bcae-45be-8184-aa6fad506701\&rid\=ea487112-ef5b-481a-b49a-26f52dc04b93 | |
echo 'FID,類別碼,識別碼,高程,x,y' >$@ | |
jq '.[] | .properties.geometry=.geometry.coordinates | .properties|"\(.FID),\(.["類別碼"]),\(.["識別碼"]),\(.geometry[2]),\(.geometry[0]),\(.geometry[1])"' raw.json -r >>$@ | |
taoyuan.csv: taoyuan_97.csv | |
ogr2ogr $@ $< \ | |
-oo X_POSSIBLE_NAMES=x \ | |
-oo Y_POSSIBLE_NAMES=y \ | |
-lco GEOMETRY=AS_XY \ | |
-oo KEEP_GEOM_COLUMNS=NO \ | |
-s_srs "EPSG:3826" \ | |
-t_srs "EPSG:4326" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment