Skip to content

Commit

Permalink
ASCII script
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanb committed Mar 26, 2022
1 parent c413fce commit c475cd5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions split.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ TMP="${1}"
function split() {
shp="$1"
enota="$2"
descriptionCollection="$3"
# descriptionSingle="$4"
descriptionCollection=$(echo "$3"| base64 --decode)
# descriptionSingle=$(echo "$4"| base64 --decode)

shpFile=$(find "${TMP}" -name "$shp.shp")
DIRNAME=$(dirname "$shpFile")
BASENAME=$(basename "$shpFile" .shp)
echo "Extracting ${enota} from ${shp}..."
echo "${descriptionCollection}: Extracting ${enota} from ${shp}..."
mkdir -p "data/${shp}"
SHAPE_ENCODING=CP1250 ogr2ogr -t_srs "EPSG:4326" -f "CSV" "data/${shp}/${BASENAME}_${enota}.csv" "${DIRNAME}" -sql "SELECT * FROM ${BASENAME} WHERE ENOTA='${enota}' ORDER BY ${BASENAME}_MID" -dialect sqlite -lco WRITE_BOM=YES -lco STRING_QUOTING=IF_NEEDED

SHAPE_ENCODING=CP1250 ogr2ogr -t_srs "EPSG:4326" -f "GeoJSON" "data/${shp}/${BASENAME}_${enota}.geojson" "${DIRNAME}" -sql "SELECT * FROM ${BASENAME} WHERE ENOTA='${enota}' ORDER BY ${BASENAME}_MID" -dialect sqlite -lco RFC7946=YES -lco WRITE_BBOX=YES -mapFieldType Date=String -nln "${BASENAME}_${enota}" -lco DESCRIPTION="${descriptionCollection}"
}

split VDV VE "Državnozborske volilne enote" "Državnozborska volilna enota"
split VDV VO "Državnozborski volilni okraji" "Državnozborski volilni okraj"
split VDV VD "Državnozborska volišča" "Državnozborsko volišče"
split VDV VE "RHLFvmF2bm96Ym9yc2tlIHZvbGlsbmUgZW5vdGU=" "RHLFvmF2bm96Ym9yc2thIHZvbGlsbmEgZW5vdGE="
split VDV VO "RHLFvmF2bm96Ym9yc2tpIHZvbGlsbmkgb2tyYWpp" "RHLFvmF2bm96Ym9yc2tpIHZvbGlsbmkgb2tyYWo="
split VDV VD "RHLFvmF2bm96Ym9yc2thIHZvbGnFocSNYQ==" "RHLFvmF2bm96Ym9yc2tvIHZvbGnFocSNZQ=="

split VLV LE "Lokalne volilne enote" "Lokalna volilna enota"
split VLV LV "Lokalna volišča" "Lokalno volišče"
split VLV LE "TG9rYWxuZSB2b2xpbG5lIGVub3Rl" "TG9rYWxuYSB2b2xpbG5hIGVub3Rh"
split VLV LV "TG9rYWxuYSB2b2xpxaHEjWE=" "TG9rYWxubyB2b2xpxaHEjWU="

split ODO CM "Mestne četrti" "Mestna četrt"
split ODO CK "Krajevne skupnosti" "Krajevna skupnost"
split ODO CV "Vaške četrti" "Vaška četrt"
split ODO CM "TWVzdG5lIMSNZXRydGk=" "TWVzdG5hIMSNZXRydA=="
split ODO CK "S3JhamV2bmUgc2t1cG5vc3Rp" "S3JhamV2bmEgc2t1cG5vc3Q="
split ODO CV "VmHFoWtlIMSNZXRydGk=" "VmHFoWthIMSNZXRydA=="

0 comments on commit c475cd5

Please sign in to comment.