<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:$B^b%4%7%C%/(B;
panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
{font-family:"$B#M#S(B $B#P%4%7%C%/(B";
panose-1:2 11 6 0 7 2 5 8 2 4;}
@font-face
{font-family:"\@$B^b%4%7%C%/(B";
panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
{font-family:"\@$B#M#S(B $B#P%4%7%C%/(B";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0mm;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:$B^b%4%7%C%/(B;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#467886;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"$B=q<0$J$7(B \($BJ8;z(B\)";
margin:0mm;
font-size:11.0pt;
font-family:$B^b%4%7%C%/(B;}
span.17
{mso-style-type:personal-compose;
font-family:$B^b%4%7%C%/(B;
color:windowtext;}
span.a
{mso-style-name:"$B=q<0$J$7(B \($BJ8;z(B\)";
mso-style-priority:99;
mso-style-link:$B=q<0$J$7(B;
font-family:$B^b%4%7%C%/(B;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.5pt;
mso-ligatures:none;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:99.25pt 30.0mm 30.0mm 30.0mm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026">
<v:textbox inset="5.85pt,.7pt,5.85pt,.7pt" />
</o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="JA" link="#467886" vlink="#96607D" style="word-wrap:break-word;text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoPlainText"><span lang="EN-US">I am implementing batch processing to convert Shape files, publicly available as open data,<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">into Geojson format within a container environment.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I installed gdal-bin on top of ubuntu:22.04 base image.
<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">The Dockerfile I implemented is as follows:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">```<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">FROM ubuntu:22.04<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">ENV DEBIAN_FRONTEND=noninteractive<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">RUN apt update<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">RUN apt -y install apt-transport-https jq unzip openjdk-17-jdk-headless curl<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"># Install gdal-bin<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"># Reference: <a href="https://mothergeo-py.readthedocs.io/en/latest/development/how-to/gdal-ubuntu-pkg.html#how-to-install-gdal-ogr-packages-on-ubuntu">
https://mothergeo-py.readthedocs.io/en/latest/development/how-to/gdal-ubuntu-pkg.html#how-to-install-gdal-ogr-packages-on-ubuntu</a><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">RUN apt -y install software-properties-common<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">RUN add-apt-repository -y ppa:ubuntugis/ppa<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">RUN apt update<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">RUN apt -y install gdal-bin<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">COPY ./convert.sh /convert.sh<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">CMD ["bash","convert.sh"]<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">```<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">When executing the ogr2ogr command within convert.sh, the following error occurs:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">```<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Shape: DBF Codepage = SJIS for /d1.shp<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Shape: Treating as encoding 'MS932'.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">GDAL: GDALOpen(/d1.shp, this=0x55f1edd77f30) succeeds as ESRI Shapefile.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">GDAL: QuietDelete(/d1_raw.geojson) invoking Delete()<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">GDAL: GDALDriver::Create(GeoJSON,/d1_raw.geojson,0,0,0,Unknown,(nil))<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">GDALVectorTranslate: 5315 features written in layer 'd1'<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Shape: 5315 features read on layer 'd1'.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">GDAL: GDALClose(/d1.shp, this=0x55f1edd77f30)<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">GDAL: GDALClose(/d1_raw.geojson, this=0x55f1edd75fd0)<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">GDAL: In GDALDestroy - unloading GDAL shared library.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Segmentation fault (core dumped)<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">```<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I checked if convert.sh execution is possible on the VM (host OS running Docker).<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">The error seems to occur only when executed within the container.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">How should I resolve this?<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText">$B"((B<span lang="EN-US">Environment<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Host OS: ubuntu 22.04<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Docker Deamon: 25.0.3<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">gdal-bin: 3.6.4<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>