Skip to content

Commit

Permalink
Support setting manual projection for shapefiles without .prj files
Browse files Browse the repository at this point in the history
  • Loading branch information
keichan34 committed Mar 3, 2024
1 parent c0cc860 commit 08aa621
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ inputs:
required: true
default: 'smartcitystandaloneinfra-smartcitystandaloneinfra-w7czadiwetse'

shapefile_undefined_crs_setting:
description: '.prj ファイルが存在しないときに使うCRS'
required: true
default: 'EPSG:2446'

runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -29,3 +34,4 @@ runs:
TILESET_NAME: ${{ inputs.NAME }}
MUNICIPALITY_CODE: ${{ inputs.MUNICIPALITY_CODE }}
DEPLOY_S3_BUCKET: ${{ inputs.DEPLOY_S3_BUCKET }}
SHAPEFILE_UNDEFINED_CRS_SETTING: ${{ inputs.shapefile_undefined_crs_setting }}
6 changes: 3 additions & 3 deletions bin/shape2mbtiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ fi

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)
out_geojson="${outdir}/${input_shp_name}.tmp_ndgeojson"
s_srs_args=""
if [[ ! -f "${input}/${input_shp_name}.prj" ]]; then
# TODO: 自治体によってデフォルトのEPSGが異なるので、正しいマッピングを作成する必要がある。
# 現在、直角座標系 EPSG:2446 (第4系) が固定でデフォルトとして指定されています。
s_srs_args="-s_srs EPSG:2446 "
# TODO: 自治体によってデフォルトのEPSGが異なるので、自治体コードからマッピングすると優しいかも。
s_srs_args="-s_srs ${undefined_crs_setting} "
fi
encoding_args=""
if [[ ! -f "${input}/${input_shp_name}.cpg" ]]; then
Expand Down

0 comments on commit 08aa621

Please sign in to comment.