howtos:how_to_download_features_using_the_arcgis_rest_api
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:how_to_download_features_using_the_arcgis_rest_api [2024-09-24 06:53 am] – hcho | howtos:how_to_download_features_using_the_arcgis_rest_api [2024-09-24 07:35 am] (current) – hcho | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== How to download features using the ArcGIS REST API ====== | ====== How to download features using the ArcGIS REST API ====== | ||
- | This script | + | This script |
- | <code bash> | + | |
- | ./ | + | |
- | </ | + | |
<file bash download_arcgis_rest_features.sh> | <file bash download_arcgis_rest_features.sh> | ||
#!/bin/sh | #!/bin/sh | ||
if [ $# -lt 2 ]; then | if [ $# -lt 2 ]; then | ||
- | echo " | + | echo " |
exit | exit | ||
fi | fi | ||
Line 17: | Line 13: | ||
rest_url=$1 | rest_url=$1 | ||
- | # filename prefix | + | # output |
- | prefix=$2 | + | output=$2 |
+ | |||
+ | # prefix | ||
+ | prefix=$(echo $output | sed ' | ||
# starting record offset | # starting record offset | ||
Line 72: | Line 71: | ||
while :; do | while :; do | ||
# generate a filename | # generate a filename | ||
- | fn=${prefix}_$offset.json | + | fn=${prefix}_$offset.geojson |
[ -f $fn ] || wget -O $fn " | [ -f $fn ] || wget -O $fn " | ||
# read wget error | # read wget error | ||
Line 90: | Line 89: | ||
offset=$(expr $offset + $count) | offset=$(expr $offset + $count) | ||
done | done | ||
+ | |||
+ | # merge geojson files | ||
+ | jq ' | ||
</ | </ | ||
+ | |||
+ | Here is an example: | ||
+ | <code bash> | ||
+ | ./ | ||
+ | </ |
howtos/how_to_download_features_using_the_arcgis_rest_api.1727182408.txt.gz · Last modified: by hcho