2

I'm using MS4W 3.0.6 (MapServer CGI 6.0.3), PostgreSQL 13 with geospatial extension (PostGIS) and pmapper 4.3.2. I can display maps perfectly in MapServer and pmapper with shapefiles, but when I try to display a PostgreSQL table I receive this message:

msDrawMap(): Image handling error. Failed to draw layer named 'pozos_azc_12'. msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: no existe la función st_force_2d(geometry) LINE 1: select encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex') ... ^ HINT: Ninguna función coincide en el nombre y tipos de argumentos. Puede ser necesario agregar conversión explícita de tipos.*

I have a index file in table, the geometry column is geom and the PK are gid and in the database are the geospatial extension, I aislate the problem in a simple MapServer to see if it works, but it doesn't, my mapfile is:

MAP 
    NAME "hola"
    SIZE 400 300
    #IMAGECOLOR 249 245 186
    STATUS ON
    IMAGETYPE png
    EXTENT 477242.999953 2151985.999950 484110.999994 2157396.999950
    UNITS meters
    WEB
        TEMPLATE "plantilla1.html"
        IMAGEPATH "/ms4w/tmp/ms_tmp/"
        IMAGEURL "/ms_tmp/"
    END 
    SYMBOLSET "symbols/symbols-pmapper.sym"
    FONTSET "fonts/msfontset.txt"
    SHAPEPATH "../data/"
    Symbol
      Name 'circle'
      Type ELLIPSE
      Filled TRUE
      Points
        1 1
      END
    END 
    LAYER
      NAME "pozos_azc_12"
      CONNECTIONTYPE postgis     
      CONNECTION "user=postgres password=Password dbname=database host=127.0.0.1 port=2022"
      DATA "geom FROM pozos_azc_12 USING UNIQUE gid USING SRID=4326"
      PROCESSING "CLOSE_CONNECTION=DEFER"
      PROCESSING "FORCE2D=YES"
      STATUS DEFAULT
      TYPE point      
      CLASS
        COLOR 0 255 0
        SYMBOL 'circle'
        SIZE 4
      END
    END
END

Maybe its a problem of compatibility with PG and MAPSERVER but if I update MapServer to the latest version, I understand pmapper doesn't work with MS4W 4.x

I don't know what I was doing wrong or how can I solve this issue.

8
  • Try to remove FORCE2D=YES, the error message refers to missing st_force_2d function.
    – Zoltan
    Oct 27, 2021 at 18:30
  • Thanks for your soon anwer, i will remove the FORCED2D but there is no change, i recive the same message:msDrawMap(): Image handling error. Failed to draw layer named 'pozos_azc_12'. msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: no existe la función st_force_2d(geometry) LINE 1: select encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex') ... ^ HINT: Ninguna función coincide en el nombre y tipos de argumentos. Puede ser necesario agregar conversión explícita de tipos. thanks and i try to search more about it, regards Oct 27, 2021 at 19:16
  • 1
    The current MapServer code is checking the PostGIS version github.com/MapServer/MapServer/blob/…. But if you must work with pmapper and use MapServer 6.x that is unmaintained then perhaps you must try to install an ancient PostGIS as well. But I really believe that pmapper is dead pmapper.net. If you want to know the current status ask from Mapgears who developed it mapgears.com/en.
    – user30184
    Oct 27, 2021 at 19:38
  • yes im afraid not use pmapper any more and use another app with the same pmapper tools and learn it faster, do you now some one?. thanks for your answer and support, i try to do something about it thanks so much Oct 27, 2021 at 20:17
  • 2
    I've had to create custom builds for these types of p.mapper issues in the past for organizations (I am the developer of MS4W), and that is always an option for you (contact my company: GatewayGeo). p.mapper was created by Armin Burger, and you are correct that it does not run with newer MS4W series. Since you are using MS4W you should take a look at GeoMoose, or Mapbender, both come with MS4W and are similar to p.mapper. (you can demo them on the MS4W dev server at ms4w.dev ). Hope that helps! And thanks for using MS4W. "open doors as well as Windows" -jeff
    – mapserving
    Oct 27, 2021 at 20:24

1 Answer 1

1

Look at the error message that tells that PostgreSQL/PostGIS does not have a ST_Force_2D("geom"). PostGIS does have another function with almost same name https://postgis.net/docs/ST_Force2D.html. The manual page has a note:

Changed: 2.1.0. Up to 2.0.x this was called ST_Force_2D.

It seems that your old MapServer version does not play together with your PostGIS version. You could have a try by commenting out the line that triggers the use of this function but if you have XYZ or XYM or XYZM geometries in the database they may cause some trouble. Anyway, try with this edit

# PROCESSING "FORCE2D=YES"
1
  • Thanks for your soon answer, i try to edit the "processing" line but it still the same error, even i try to import the SHP file with "generate simple geometries" option in PG shape import tool and the error persist, maybe i have to use new version of mapserver and forgot pmapper, thanks so much for your atention Oct 27, 2021 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.