<div dir="ltr"><div dir="ltr"><div>Thank you Jukka,</div><div>what you say could be the source of the problem,</div><div>but (I think) I have no direct control on how the library format the query string I reported:</div><div>it is bundled within the call to the method edu.umn.gis.mapscript.mapObj.draw()</div><div><br></div><div></div><div><b>Here is the code</b>:<br></div> mapObj myMap = new mapObj("myMapFile.map");<br> rectObj originalMapView = myMap.getExtent();<br> <br> rectObj maxView = new rectObj(-1, -1, -1, -1, myMap.getUnits().swigValue());<br> maxView.setMinx(originalMapView.getMinx());<br> maxView.setMaxx(originalMapView.getMaxx());<br> maxView.setMiny(originalMapView.getMiny());<br> maxView.setMaxy(originalMapView.getMaxy());<br><div><br></div><div><div> rectObj myView = new rectObj(-1, -1, -1, -1, 3);<br> myView.setMinx(<b>774076.75</b>);<br> myView.setMaxx(<b>1014076.75</b>);<br> myView.setMiny(<b>4875124.5</b>);<br> myView.setMaxy(<b>5115124.5</b>);</div> myMap.setExtent(myView);<br></div><div><br></div><div> myMap.setSize(600, 600);<br><br> pointObj mousePosition = new pointObj(300, 300, 0);<br> myMap.zoomPoint(1, mousePosition, 600, 600, myView, maxView);</div> myMap.draw();</div><div dir="ltr"><br></div><div><b>resulting in the error</b>:<br></div><div dir="ltr"><b>java.lang.UnknownError: msDrawMap():</b> Image handling error. Failed to draw layer named 'MyLayer'.;<b>msPostGISLayerWhichShapes(): Query error</b>. Error executing query. Check server logs<br>
edu.umn.gis.mapscript.mapscriptJNI.mapObj_draw(Native Method)<br>
edu.umn.gis.mapscript.mapObj.draw(mapObj.java:397)</div><div dir="ltr"><br></div><div><b>and in the ERROR file</b>:</div><div dir="ltr">[Wed Jan 26 17:14:19 2022].569532 msPostGISLayerWhichShapes(): Error (ERROR: parse error - invalid geometry<br>
HINT: "POLYGON((774076,75" <-- parse error at position 18 within geometry<br>
) executing query: select "my_column"::text,ST_AsBinary(("the_geom"),'NDR')
as geom,"gid"::text from (SELECT * FROM classi_comuni WHERE tipo_area =
2 ORDER BY tipo_area DESC) AS confini where "the_geom" &&
ST_GeomFromText('<b>POLYGON((774076,75 4875124,5,774076,75
5115124,5,1014076,75 5115124,5,1014076,75 4875124,5,774076,75 4875124,5))</b>',find_srid('','classi_comuni','the_geom'))</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div>Please any other idea on how I could solve it?</div><div><br></div><div>Thank you,</div><div>Francesco<br></div><div dir="ltr"><br>
</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mer 26 gen 2022 alle ore 20:12 Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank">jukka.rahkonen@maanmittauslaitos.fi</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="FI">
<div>
<p class="MsoNormal"><span>Hi,</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span lang="EN-US">I wonder if it could be related to which locale Java detects on your computer – Italian (or Finnish) computer -> comma as a separator. Maybe something that deals around the same thing
<a href="https://stackoverflow.com/questions/4713166/decimal-separator-in-numberformat" target="_blank">
https://stackoverflow.com/questions/4713166/decimal-separator-in-numberformat</a>.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> MapServer-users <<a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Francesco Martinelli<br>
<b>Lähetetty:</b> keskiviikko 26. tammikuuta 2022 19.00<br>
<b>Vastaanottaja:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Aihe:</b> [mapserver-users] msPostGISLayerWhichShapes() Error : java library set wrong query</p>
</div>
<p class="MsoNormal"> </p>
<div>
<div>
<p class="MsoNormal">Hi all,</p>
</div>
<p class="MsoNormal">I have a java program calling the method draw() of class edu.umn.gis.mapscript.mapObj</p>
<div>
<p class="MsoNormal">after I compiled mapserver 7.6.4 on Ubuntu 20.04</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">The result produce the following error:</p>
</div>
<div>
<p class="MsoNormal"><b>java.lang.UnknownError: msDrawMap():</b> Image handling error. Failed to draw layer named 'MyLayer'.;<b>msPostGISLayerWhichShapes(): Query error</b>. Error executing query. Check server logs<br>
edu.umn.gis.mapscript.mapscriptJNI.mapObj_draw(Native Method)<br>
edu.umn.gis.mapscript.mapObj.draw(mapObj.java:397)<br>
<br clear="all">
</p>
</div>
<div>
<p class="MsoNormal">In mapfile I set the parameters:</p>
</div>
<div>
<p class="MsoNormal"><b>CONFIG</b> "MS_ERRORFILE" "myfile"</p>
</div>
<div>
<p class="MsoNormal"><b>DEBUG</b> 6</p>
</div>
<div>
<p class="MsoNormal">...</p>
</div>
<div>
<p class="MsoNormal"><b>LAYER</b></p>
</div>
<div>
<p class="MsoNormal"> <b>CONNECTIONTYPE</b> postgis</p>
</div>
<div>
<div>
<p class="MsoNormal"> <b>DATA</b> "the_geom FROM (SELECT * FROM classi_comuni WHERE tipo_area = 2 ORDER BY tipo_area DESC) AS confini USING UNIQUE gid"</p>
</div>
<div>
<p class="MsoNormal"> <b>CLASSITEM</b> "my_column"</p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt">...</p>
</div>
</div>
<div>
<p class="MsoNormal">and in the error file I got the following message:</p>
</div>
<div>
<p class="MsoNormal">[Wed Jan 26 17:14:19 2022].558530 msDrawMap(): rendering using outputformat named png24 (AGG/PNG).<br>
[Wed Jan 26 17:14:19 2022].569532 msPostGISLayerWhichShapes(): Error (ERROR: parse error - invalid geometry<br>
HINT: "POLYGON((774076,75" <-- parse error at position 18 within geometry<br>
) executing query: select "my_column"::text,ST_AsBinary(("the_geom"),'NDR') as geom,"gid"::text from (SELECT * FROM classi_comuni WHERE tipo_area = 2 ORDER BY tipo_area DESC) AS confini where "the_geom" && ST_GeomFromText('<b>POLYGON((774076,75 4875124,5,774076,75
5115124,5,1014076,75 5115124,5,1014076,75 4875124,5,774076,75 4875124,5))</b>',find_srid('','classi_comuni','the_geom'))<br>
[Wed Jan 26 17:14:19 2022].569545 msPostGISLayerWhichShapes(): Query error. Error executing query. Check server logs<br>
[Wed Jan 26 17:14:19 2022].569605 msDrawMap(): Image handling error. Failed to draw layer named 'MyLayer'.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">I checked the error is caused by decimal separators being commas instead of dots.</p>
</div>
<div>
<p class="MsoNormal">As far as I understand the correct query would be (in <b><span style="color:black;background:red none repeat scroll 0% 0%">red</span></b> the changes):</p>
</div>
<div>
<p class="MsoNormal">select "my_column"::text,ST_AsBinary(("the_geom"),'NDR') as geom,"gid"::text from (SELECT * FROM classi_comuni WHERE tipo_area = 2 ORDER BY tipo_area DESC) AS confini where "the_geom" && ST_GeomFromText('<b>POLYGON((774076<span style="color:black;background:red none repeat scroll 0% 0%">.</span>75
4875124<span style="color:black;background:red none repeat scroll 0% 0%">.</span>5,774076<span style="color:black;background:red none repeat scroll 0% 0%">.</span>75 5115124<span style="color:black;background:red none repeat scroll 0% 0%">.</span>5,1014076<span style="color:black;background:red none repeat scroll 0% 0%">.</span>75 5115124<span style="color:black;background:red none repeat scroll 0% 0%">.</span>5,1014076<span style="color:black;background:red none repeat scroll 0% 0%">.</span>75
4875124.5,774076<span style="color:black;background:red none repeat scroll 0% 0%">.</span>75 4875124<span style="color:black;background:red none repeat scroll 0% 0%">.</span>5</b>))',find_srid('','classi_comuni','the_geom'))</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">I think I should set something during the compilation of java mapserver library.</p>
</div>
<div>
<p class="MsoNormal">Please can someone drive me on how to solve it?</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">Thank you,</p>
</div>
<div>
<p class="MsoNormal">Francesco</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
</blockquote></div></div>