Skip to content

Commit

Permalink
.prj, .cpg ファイルへのパスを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
naogify committed Jun 24, 2024
1 parent 9e23b81 commit 7e2d4d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/shape2mbtiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ createdMbtilesArchives=0
undefined_crs_setting=${SHAPEFILE_UNDEFINED_CRS_SETTING:-"EPSG:2446"}
for shp in $(find "$input" -name '*.shp'); do
input_shp_name=$(basename "$shp" .shp)
input_shp_dir=$(dirname "$shp")
out_geojson="${outdir}/${input_shp_name}.tmp_ndgeojson"
s_srs_args=""
if [[ ! -f "${input}/${input_shp_name}.prj" ]]; then
if [[ ! -f "${input_shp_dir}/${input_shp_name}.prj" ]]; then
# TODO: 自治体によってデフォルトのEPSGが異なるので、自治体コードからマッピングすると優しいかも。
s_srs_args="-s_srs ${undefined_crs_setting} "
fi
encoding_args=""
if [[ ! -f "${input}/${input_shp_name}.cpg" ]]; then
if [[ ! -f "${input_shp_dir}/${input_shp_name}.cpg" ]]; then
encoding_args="-oo ENCODING=CP932 "
fi
ogr2ogr $s_srs_args -t_srs EPSG:4326 -f GeoJSONSeq "${out_geojson}" $encoding_args "${shp}"
Expand Down

0 comments on commit 7e2d4d2

Please sign in to comment.