Skip to content

Instantly share code, notes, and snippets.

@typebrook
Last active May 21, 2025 08:51
Show Gist options
  • Save typebrook/8a2315f46cf9190a395a3a53ed0dd71c to your computer and use it in GitHub Desktop.
Save typebrook/8a2315f46cf9190a395a3a53ed0dd71c to your computer and use it in GitHub Desktop.
get dataset from MoEnv
.ONESHELL:
# dataset from moenv: https://data.gov.tw/dataset/8817
pollution.csv:
curl -o $@ 'https://data.moenv.gov.tw/api/v2/gisepa_p_24?api_key=9e565f9a-84dd-4e79-9097-d403cae1ea75&limit=1000&sort=ImportDate%20desc&format=CSV'
# 神祕的來源: https://newcdx.moenv.gov.tw/api/files/WR_P_244/41679057-4366-4493-9c39-32f89c8281af
disposal.tmp.zip:
curl -o $@ https://newcdx.moenv.gov.tw/api/files/WR_P_244/41679057-4366-4493-9c39-32f89c8281af
disposal.tmp.geojson: disposal.tmp.zip
unzip disposal.zip
shp=$$(unzip -l disposal.zip | awk '{print $$4}' | grep 'shp$$')
ogr2ogr $@ $${shp}
disposal:
code=${code}; code=$${code:-B}
echo >res
#for code in A B C D E F G H J K L M N P Q T U V X Y W Z I O; do
#echo
set -x
curl -vv -sX 'POST' \
'https://api.land.moi.gov.tw/cp/api/WasteDisposal/QueryByCity' \
-H 'Authorization Basic '$$(echo 19ae25ce-3e2d-4ab0-92e5-501dab8de4da: | base64) \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--data '[ { "CITY": "'$${code}'" } ]'
# tee -a res
# set +x
# echo
# sleep 5
#done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment