Ciao Luca,What happens when you pass the full query through ogrinfo with the "-sql" switch:
ogrinfo -ro PG:"user=xxxx password=xxxx host=127.0.0.1 port=5432dbname=xxxx" -sql "select "short_name"::text,ST_AsBinary(("geom"),'NDR') as geom,"research_groups_id"::text from (select research_groups_id,
short_name, geom from main.research_groups where
ST_Contains(ST_GeomFromText('POLYGON((-15.2587587587588
35,-15.2587587587588 70,37.2587587587588 70,37.2587587587588
35,-15.2587587587588 35))',4326), geom)) as subquery"
-jeff
On 2022-04-08 9:49 a.m., Luca Delucchi wrote:
On Fri, 8 Apr 2022 at 13:43, Jeff McKenna <[email protected]> wrote:Ciao Luca,Ciao,I am wondering also if you tried to access the PostGIS data through ogrinfo yet (to confirm there is no data issue). Note that I'd recommend GDAL 3.4.2, PROJ 8.2.1 with MapServer-main. ogrinfo -ro PG:"user=xxxx password=xxxx host=127.0.0.1 port=5432 dbname=xxxx" table -summaryyes this worksThen, follow along the debugging document ( https://www.mapserver.org/optimization/debugging.html ) and add the following inside your MAP object in mapfile: CONFIG "CPL_DEBUG" "ON" CONFIG "CPL_TIMESTAMP" "ON" CONFIG "PROJ_DEBUG" "ON" Then re-retry map2img with -all_debug 5, and look for the full SELECT query made to your database, and run that same query inside psql commandline.using map2img as suggested by Even I got this Reading symbols from map2img... (gdb) run Starting program: /home/lucadelu/installati/bin/map2img -m eurodeer_new.map -o eurodeer.png -all_debug 5 -conf mapserver.conf [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffebf54700 (LWP 801419)] [New Thread 0x7fffeb753700 (LWP 801420)] msDrawMap(): Image handling error. Failed to draw layer named 'Reserch groups'. <br> msPostGISLayerWhichShapes(): Query error. Failed to build query SQL. <br> msPostGISBuildSQL(): General error message. Failed to build SQL 'where'. <br> msSearchDiskTree(): Search returned no results. Unable to open spatial index for /home/lucadelu/github/euromammals/print_maps/././data/ne_10m_admin_0_sovereignty.qix. In most cases you can safely ignore this message, otherwise check file names and permissions. <br> [Fri Apr 8 14:38:55 2022].491539: GDAL: In GDALDestroy - unloading GDAL shared library. [Thread 0x7fffebf54700 (LWP 801419) exited] [Thread 0x7fffec613bc0 (LWP 801411) exited] [Inferior 1 (process 801411) exited with code 01] However using shp2img with a running map file I was able to get the full postgis query and run it on a database returning the error "Floating point exception" without any problem. select "short_name"::text,ST_AsBinary(("geom"),'NDR') as geom,"research_groups_id"::text from (select research_groups_id, short_name, geom from main.research_groups where ST_Contains(ST_GeomFromText('POLYGON((-15.2587587587588 35,-15.2587587587588 70,37.2587587587588 70,37.2587587587588 35,-15.2587587587588 35))',4326), geom)) as subquery-jeff
-- Jeff McKenna GatewayGeo: Developers of MS4W, MapServer Consulting and Training co-founder of FOSS4G http://gatewaygeo.com/ _______________________________________________ MapServer-users mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/mapserver-users
