[mapserver-users] mapserver - postgis/postgresql connection problem

kassandraxx eleonora at creativalab.com
Wed Jan 14 07:37:35 PST 2015


thanks so much for your advice, unfortunately, are still inexperienced. :(
my project and my files are based on wgs84 utm 33N
I checked all extend with ogrinfo and I corrected
then I tried as you suggested to use shp2img on my map file and this is the
error that comes back:


shp2img -m pmapper_demo.map -o test.png
msDrawMap(): Image handling error. Failed to draw layer named 'Ager
Firmanus'. <br>
msPostGISLayerWhichShapes(): Query error. Error (ERROR:  function
geomfromtext(u                              nknown, integer) does not exist
LINE 1: ...geom,"gid" from "ager_firmanus" where the_geom && GeomFromTe...
                                                             ^
HINT:  No function matches the given name and argument types. You might need
to                               add explicit type casts.
) executing query: select
encode(ST_AsBinary(ST_Force_2D("the_geom"),'NDR'),'hex                             
') as geom,"gid" from "ager_firmanus" where the_geom &&
GeomFromText('POLYGON((2                              52691.191155437
4727437.25648659,252691.191155437 4871219.56915799,425287.594538                             
208 4871219.56915799,425287.594538208 4727437.25648659,252691.191155437
4727437.                              25648659))',32633) <br>

this is my whole file map


MAP
EXTENT  266351.432505 4727437.256493 411627.353192 4871219.569158
IMAGECOLOR     255 255 255
UNITS meters
SIZE 600 500
SHAPEPATH "/var/www/data"
SYMBOLSET "../common/symbols/symbols-pmapper.sym"   
FONTSET "../common/fonts/msfontset.txt" 
RESOLUTION 96
IMAGETYPE png
PROJECTION
    'proj=utm'
    'zone=33'
    'datum=WGS84'
    'units=m'
    'no_defs'
END 

# Start of web interface definition

WEB
  TEMPLATE "map.html"
  IMAGEPATH "/var/www/tmp/"
  IMAGEURL "/tmp/"
END  # Web


# Start of Reference map definition

REFERENCE
  EXTENT 266351.432505 4727437.256493 411627.353192 4871219.569158
  IMAGE "../../images/reference.png"
  SIZE 229 149
  COLOR -1 -1 -1
  OUTLINECOLOR 255 0 0
END  # Reference

 # Start of legend

LEGEND
    KEYSIZE 20 20
    IMAGECOLOR     255 255 255
    LABEL
      TYPE TRUETYPE
      FONT "georgia"
      SIZE 11
      COLOR 200 50 0
    END
    STATUS ON
END


SCALEBAR
    IMAGECOLOR 255 255 255
    LABEL
      COLOR 0 0 0
      SIZE small
    END
    STYLE 1
    SIZE 350 10
    COLOR 0 0 125
    UNITS KILOMETERS
    INTERVALS 4
    TRANSPARENT FALSE
    STATUS ON
END # Scalebar object ends

 # Start of querymap

QUERYMAP
    SIZE 200 150
    STATUS ON
    STYLE SELECTED 
    COLOR 255 0 0
  END



#================== START OF LAYER SECTION =====================#

LAYER # States polygon layer begins here
    NAME        "Marche"
	TEMPLATE void
  EXTENT 266351.432505 4727437.256493 411627.353192 4871219.569158
    DATA         "marche"
    STATUS       OFF
    TYPE         POLYGON
    METADATA 
    "ows_title"      "marche"
  END  # Metadata 
	CLASS
      NAME       "marche"
      STYLE
        COLOR 200 254 199
      END
    END
  END # States polygon layer ends here



LAYER
    NAME "Comuni"
    TYPE POLYGON
    DUMP true
    TEMPLATE void
  EXTENT 354559.923623 4741968.996931 380152.627473 4767524.906967
    DATA "comuni_ricerca"
    METADATA
      'ows_title' 'comuni_ricerca'
    END
    STATUS OFF
    PROJECTION
    'proj=utm'
    'zone=33'
    'datum=WGS84'
    'units=m'
    'no_defs'
    END
    CLASSITEM 'NOME_COM'
    CLASS
      NAME "Amandola" 
      EXPRESSION "Amandola" 
       STYLE
         WIDTH 1 
         OUTLINECOLOR 0 0 0
         COLOR 90 218 71
       END
    END
    CLASS
      NAME "Comunanza" 
      EXPRESSION "Comunanza" 
       STYLE
         WIDTH 1 
         OUTLINECOLOR 0 0 0
         COLOR 204 163 11
       END
    END
    CLASS
      NAME "Montefalcone Appennino" 
      EXPRESSION "Montefalcone Appennino" 
       STYLE
         WIDTH 1 
         OUTLINECOLOR 0 0 0
         COLOR 59 114 249
       END
    END
    CLASS
      NAME "Montefortino" 
      EXPRESSION "Montefortino" 
       STYLE
         WIDTH 1 
         OUTLINECOLOR 0 0 0
         COLOR 211 131 138
       END
    END
    CLASS
      NAME "Montemonaco" 
      EXPRESSION "Montemonaco" 
       STYLE
         WIDTH 1 
         OUTLINECOLOR 0 0 0
         COLOR 77 182 62
       END
    END
    CLASS
      NAME "Santa Vittoria in Matenano" 
      EXPRESSION "Santa Vittoria in Matenano" 
       STYLE
         WIDTH 1 
         OUTLINECOLOR 0 0 0
         COLOR 88 128 122
       END
    END
    CLASS
      NAME "Smerillo" 
      EXPRESSION "Smerillo" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 53 149 170
       END
    END
  END

LAYER
    NAME "Cittadine"
    TYPE POINT
    DUMP true
    TEMPLATE void
  EXTENT 365500.628492 4757245.000969 370593.603261 4759482.322111
    DATA "citta"
    METADATA
      'ows_title' 'citta'
    END
    STATUS OFF
    PROJECTION
    'proj=utm'
    'zone=33'
    'datum=WGS84'
    'units=m'
    'no_defs'
    END
    CLASS
       NAME 'citta' 
       STYLE
         SYMBOL "circle" 
         SIZE 7.0 
         OUTLINECOLOR 0 0 0
         COLOR 214 205 104
       END
    END
  END
  
  LAYER
    NAME "Idrografia"
    TYPE LINE
    DUMP true
    TEMPLATE void
	EXTENT 355646.233379 4743380.868410 380147.958386 4767436.959607
    DATA "idrografia_clip"
    METADATA
      'ows_title' 'idrografia_clip'
    END
    STATUS OFF
    PROJECTION
    'proj=utm'
    'zone=33'
    'datum=WGS84'
    'units=m'
    'no_defs'
    END
    CLASS
       NAME 'idrografia_clip' 
       STYLE
         WIDTH 1 
         COLOR 146 190 255
       END
    END
  END

 LAYER
    NAME "Curve di livello"
    TYPE LINE
    DUMP true
    TEMPLATE void
	EXTENT 354562.132679 4741970.274523 380150.652637 4767491.845169
    DATA "isoipse_clip"
    METADATA
      'ows_title' 'isoipse_clip'
    END
    STATUS OFF
    PROJECTION
    'proj=utm'
    'zone=33'
    'datum=WGS84'
    'units=m'
    'no_defs'
    END
    CLASS
       NAME 'isoipse_clip' 
       STYLE
         WIDTH 1 
         COLOR 237 237 237
       END
    END
  END

LAYER
    NAME "Strade"
    TYPE LINE
    DUMP true
    TEMPLATE void
	EXTENT 354639.299023 4742245.805300 379951.835356 4767409.867252
    DATA "viabilita_clip"
    METADATA
      'ows_title' 'viabilita_clip'
    END
    STATUS OFF
    PROJECTION
    'proj=utm'
    'zone=33'
    'datum=WGS84'
    'units=m'
    'no_defs'
    END
    CLASS
       NAME 'viabilita_clip' 
       STYLE
         WIDTH 0.10 
         COLOR 0 0 0
       END
    END
  END

LAYER # States polygon layer begins here
    NAME        "Edifici"
    DATA         "edifici"
	DUMP true
    TEMPLATE void
	EXTENT 357707.023218 4756331.869061 377721.396435 4767017.463077
    STATUS       OFF
    TYPE         POLYGON
    METADATA 
    "ows_title"      "edifici"
  END  # Metadata 
	CLASS
      NAME       "edifici"
      STYLE
        COLOR 156 156 156
      END
    END
  END # States polygon layer ends here

 LAYER
    NAME 'Ager Firmanus'
    TYPE LINE
    DUMP true
    TEMPLATE void
  EXTENT 373783.754747 4759872.638913 405743.922708 4794307.658343
    CONNECTIONTYPE postgis
    CONNECTION "dbname='db_name' host=archeogis.myftp.org port=5432
user='xxx' password='xxx' sslmode=disable"
    DATA 'the_geom FROM "ager_firmanus" USING UNIQUE gid USING srid=32633'
    METADATA
      'ows_title' 'ager_firmanus'
    END
    STATUS ON
    PROJECTION
    'proj=utm'
    'zone=33'
    'datum=WGS84'
    'units=m'
    'no_defs'
    END
    CLASS
       NAME 'ager_firmanus' 
       STYLE
         WIDTH 10 
         COLOR 77 158 104
       END
    END
  END
  
END  #Map





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/mapserver-postgis-postgresql-connection-problem-tp5181475p5181502.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list