[mapserver-dev] msPostGISLayerWhichShapes() Error : java library set wrong query

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Thu Jan 27 04:09:36 PST 2022


I am not a programmer but I would still imagine that if netBeans knows how to read the locale that your computer is using there might also be a method to set the locale. Is this of any help https://stackoverflow.com/questions/9190404/change-locale-in-netbeans-platform-application?

Sorry if I am disoriented.

-Jukka Rahkonen-

Lähettäjä: Francesco Martinelli <francesco.martinelli at ingv.it>
Lähetetty: torstai 27. tammikuuta 2022 13.39
Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi>
Kopio: MapServer Dev List <mapserver-dev at lists.osgeo.org>
Aihe: Re: [mapserver-dev] msPostGISLayerWhichShapes() Error : java library set wrong query

Hi Jukka,
I use the library within a web application not a desktop application.
At the moment I am developing with NetBeans: I don't find any place where to specify the numeric separator.

However, the faulty code in mapObj.java:397 is
long cPtr = mapscriptJNI.mapObj_draw(swigCPtr, this);
and mapscriptJNI is generated by SWIG, which is a C/C++ wrapper, so the JAVA_OPT is unlikely to be used.


Il giorno gio 27 gen 2022 alle ore 12:13 Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>> ha scritto:

Have you considered to change the locale with your own code as first aid?  I do not know how to do that but some desktop application seems to do that with Java options

rem --- uncomment and change your language/country here to overwrite OS locale setting ---
set JAVA_OPTS=%JAVA_OPTS% -Duser.language=en -Duser.country=EN

-Jukka Rahkonen-

Lähettäjä: MapServer-dev <mapserver-dev-bounces at lists.osgeo.org<mailto:mapserver-dev-bounces at lists.osgeo.org>> Puolesta Francesco Martinelli
Lähetetty: torstai 27. tammikuuta 2022 12.07
Vastaanottaja: MapServer Dev List <mapserver-dev at lists.osgeo.org<mailto:mapserver-dev at lists.osgeo.org>>
Aihe: [mapserver-dev] msPostGISLayerWhichShapes() Error : java library set wrong query

Dear developers,
I have an issue with the java library on the call to mapObj.draw(), of mapserver 7.6.4, compiled and running on Ubuntu 20.04
Apparently it is "sensible" to the locale which is:
$ localectl
   System Locale: LANG=it_IT.UTF-8
       VC Keymap: n/a
      X11 Layout: it
       X11 Model: pc105
$ locale -c decimal_point

I already asked the mapserver-users list, but without success.

Here is the code:
    mapObj myMap = new mapObj("myMapFile.map");
    rectObj originalMapView = myMap.getExtent();

    rectObj maxView = new rectObj(-1, -1, -1, -1, myMap.getUnits().swigValue());

    rectObj myView = new rectObj(-1, -1, -1, -1, 3);

    myMap.setSize(600, 600);

    pointObj mousePosition = new pointObj(300, 300, 0);
    myMap.zoomPoint(1, mousePosition, 600, 600, myView, maxView);

resulting in the error:
java.lang.UnknownError: msDrawMap(): Image handling error. Failed to draw layer named 'MyLayer'.;msPostGISLayerWhichShapes(): Query error. Error executing query. Check server logs
edu.umn.gis.mapscript.mapscriptJNI.mapObj_draw(Native Method)

and in the ERROR file:
[Wed Jan 26 17:14:19 2022].569532 msPostGISLayerWhichShapes(): Error (ERROR:  parse error - invalid geometry
HINT:  "POLYGON((774076,75" <-- parse error at position 18 within geometry
) 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('POLYGON((774076,75 4875124,5,774076,75 5115124,5,1014076,75 5115124,5,1014076,75 4875124,5,774076,75 4875124,5))',find_srid('','classi_comuni','the_geom'))

As far as I understand the correct query should be (in red the changes):
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('POLYGON((774076.75 4875124.5,774076.75 5115124.5,1014076.75 5115124.5,1014076.75 4875124.5,774076.75 4875124.5))',find_srid('','classi_comuni','the_geom'))

I think the following parameters in mapfile could be of interest to you:
    CONFIG "MS_ERRORFILE" "myfile"
    DEBUG 6
        CONNECTIONTYPE postgis
        DATA "the_geom FROM (SELECT * FROM classi_comuni WHERE tipo_area = 2 ORDER BY tipo_area DESC) AS confini USING UNIQUE gid"
        CLASSITEM "my_column"

Please could you help?

Thank you,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20220127/91558ae0/attachment-0001.html>

More information about the MapServer-dev mailing list