Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add open option FORCE_SRS_DETECTION in case of gml files and if… #13

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ The default command prints the script usage.
Example calls
-------------

Build docker image after changes using command:

```
docker build -t wetransform/conversion-gdal:latest .
```

Convert remote file, result is stored in internal container volume:

```
Expand All @@ -25,3 +31,9 @@ docker run -it --user=$(id -u):$(id -g) -v $(pwd):/data wetransform/conversion-g
```

Similarly, files from mounted volumes can be converted as well, by providing a file path resolvable in the container instead of a remote (http/https) location.

Example to mount a volume and run docker image:

```
docker run -it -v <local_path_to_folder_to_be_mounted>:/data wetransform/conversion-gdal:latest ./ogr-convert.sh --source /data/<example.gml> --target-dir /data/target --target-name test.shp -f "ESRI Shapefile"
```
11 changes: 11 additions & 0 deletions scripts/ogr-convert.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,17 @@ if [ -n "$source_srs" ]; then
# no target srs, but if s_srs is provided, t_srs must be as well
target_srs=$source_srs
fi
else
# Extract driverShortName
driverShortName=$(ogrinfo -json $source_loc | jq -r '.driverShortName')
echo "Driver Short Name: $driverShortName"
# Check if driverShortName is GML and source_srs is not set
if [ "$driverShortName" == "GML" ]; then
echo "GML driver detected and no source SRS provided, setting FORCE_SRS_DETECTION=YES"
convert_cmd="$convert_cmd -oo FORCE_SRS_DETECTION=YES"
fi
fi

if [ -n "$target_srs" ]; then
# target srs is provided
# add as parameter
Expand Down Expand Up @@ -123,5 +133,6 @@ fi

# run
echo "Executing conversion..."
echo "Command: $convert_cmd"
eval $convert_cmd
rc=$?; if [ $rc -ne 0 ]; then echo "ERROR: Conversion failed"; exit $rc; else echo "Conversion successful"; fi
Loading