[mapserver-users] Mapserver + PostGIS ==> Blank Screen

cheryl buckley cheryl.bckl at gmail.com
Mon Feb 20 05:00:19 PST 2012


Hi fellows,

thank you for your assistance with the Mapserver issue I've had. I compiled
the mapserver 6.1-dev from the SVN respository and it worked! :)

Kind regards
Cheryl



#######
Hi,

I'm trying to get Mapserver connected with PostGIS. PostGIS is holding
a shape2pgsql contourline import in the table "atest" while a test has
the following columns (shape2pgsql default):

--------------------------------------
| Actions | gid | id | height | geom |
--------------------------------------

Quantum GIS picks the conection up perfectly to atest but with
Mapserver I just get a blank screen - or the color of IMAGECOLOR [. .
.] definition in *.map definitions.

Somehow it seems like I got the connection between Mapserver and
PostGIS running - at least the debug.log doesn't complain. But still
I'm not seeing any of my contour lines as I'm used to by Quantum GIS
;(

Could someone give me a hint of what I'm missing out or where my mistake is?
I got the feeling that it is either has something to do with the DATA
property or the projection properties …

The Link with which I call the mapserv binary is:

http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map
But then it complains:
msDrawMap(): Image handling error. Unable to initialize image.
msPrepareImage(): General error message. Image dimensions not
specified. msCalculateScale(): General error message. Invalid image
width or height.

So I changed it to the following:
http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map&mapsize=600+800
which results in fortunately no errors but therefore in a blank screen
with a clean debug.log ...

Even this one wont change anything:
http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map&mapsize=600+800&layer=Contour

I attached some screenshots for clearity . . .
. . . my test-2.map definition is attached below:

P.S.: TEMPLATE "./Maps/test.map" does exist and is read and writeable
to the user which runs the webserver (Apache => User: www)
CONFIG "PROJ_LIB" "/usr/local/share/proj/" should also be valid:

FreeBSD [~]# ls /usr/local/share/proj
FL                      WO                      hawaii
null                    stlrnc
GL27                    alaska                  nad.lst
nzgd2kgrid0005.gsb      stpaul
IGNF                    conus                   nad27
other.extra             world
MD                      epsg                    nad83
proj_def.dat
TN                      esri                    ntf_r93.gsb             prvi
WI                      esri.extra              ntv1_can.dat
stgeorge



# =================================== test-2.map
=================================== #


MAP

   CONFIG "PROJ_LIB" "/usr/local/share/proj/"
   CONFIG "MS_ERRORFILE" "./debug.log"
   DEBUG 5

   IMAGECOLOR 100 100 100

   NAME      "Contour"
   EXTENT    -90 -180 90 180
   STATUS    ON

   PROJECTION
       "init=epsg:4326"
   END

   WEB
       METADATA
           WMS_NAME                         "Contour"
           WMS_TITLE                        "SRTM - ContourLines"
           WMS_ABSTRACT                     "My First Web Map Server"
           WMS_SERVER_VERSION               "1.1.1"
           WMS_SRS                          "EPSG:4326"
           WMS_ONLINERESOURCE
"http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map"
           WMS_ATTRIBUTION_TITLE            "Some Attribute Title"
           WMS_ATTRIBUTION_ONLINERESOURCE   "http://www.myHomepage.com/"
           WMS_KEYWORDLIST
"DEM,SRTM,Contourlines,Contour,Lines,Digital,Area,Model"
           WMS_FEATURE_INFO_MIME_TYPE       "text/html"
           WMS_CONTACTELECTRONICMAILADDRESS "User at Domain.tld"
           WMS_CONTACTPERSON                "Some Reference Person"
           WMS_CONTACTVOICETELEPHONE        "+49-phoneNumber"
           WMS_CONTACTORGANIZATION          "Private"
           WMS_ENCODING                     "utf-8"
       END
   END


   LAYER # query layer from PostgreSQL table
           NAME          "Contour"
           EXTENT        143 -20 145 -19
           TYPE          LINE
           STATUS        ON
           DEBUG         ON
           TEMPLATE      "./Maps/test.map"
           DUMP          true
           METADATA
               WMS_NAME          "Contour"
               WMS_TITLE         "Contour Lines - 90m"
               WMS_ABSTRACT      "Contour Lines - 90m"
               WMS_SRS           "EPSG:4326"
               GML_INCLUDE_ITEMS "all"
           END

           CONNECTIONTYPE POSTGIS
           CONNECTION    "host=192.168.10.15 port=5432
dbname=my_spatial_db user=admin password=******"
           DATA          "geom FROM atest using unique gid using srid=4326"

           CLASS
               STYLE
                   COLOR 000 000 000
                   OUTLINECOLOR 199 199 199
           END
       END

   END
END


#
==================================================================================
#








# =================================== debug.log
=================================== #

FreeBSD [/usr/local/www/cgi-bin/Maps]# cat ./debug.log

[Sat Feb 11 19:02:01 2012].3032 CGI Request 1 on process 2663
[Sat Feb 11 19:02:01 2012].10325 msDrawMap(): rendering using
outputformat named png (AGG/PNG).
[Sat Feb 11 19:02:01 2012].10365 msDrawMap(): WMS/WFS set-up and query,
0.000s
[Sat Feb 11 19:02:01 2012].10388 msDrawMap(): Drawing Label Cache, 0.000s
[Sat Feb 11 19:02:01 2012].10398 msDrawMap() total time: 0.007s
[Sat Feb 11 19:02:01 2012].76893 msSaveImage(stdout) total time: 0.066s
[Sat Feb 11 19:02:01 2012].77721 mapserv request processing time
(loadmap not incl.): 0.075s
[Sat Feb 11 19:02:01 2012].77749 msFreeMap(): freeing map at 0x29879800.
[Sat Feb 11 19:02:01 2012].77839 msPostGISLayerIsOpen called.

#
==================================================================================
#
#############

Cherly,

 One issue could be that you've asked Mapserver to render the entire world:


EXTENT    -90 -180 90 180

into a small image:

mapsize=600+800

Adjust the extents of the output image to be the extent of you contour
data.  I see that you've given that in your LAYER definition


           EXTENT        143 -20 145 -19

so try that for the map extent (but I think it would be valid only if the
contours were stored in a Geographic system and not a Projected system).
What SRS are you storing your data in?  The same as your display
(EPSG:4326)?

Best Regards,
Brent Fraser


################

Hi Brent,

Thanks for your reply.

The SRS my data is stored in WGS84.

Unfortunately, I am not getting configuration file right. I adjusted the
map EXTENT to something smaller,

Map

Extent 16 -28 25 -16


The layer extent I also adjusted to the output image of the contour data,

Layer

Extent 17.002 -20.965 18.007 -20.002

I played around with the figures a little but I get this error message at
all times,

"msDrawMap(): Image handling error. Failed to draw layer named 'Contour'.
msPostGISLayerWhichShapes(): Query error. Error (ERROR: function
geomfromtext(unknown, integer) does not exist LINE 1: ...R'),'hex') as
geom,"gid" from atest where 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("geom"),'NDR'),'hex') as geom,"gid" from
atest where geom && GeomFromText('POLYGON((15.8348164627364
-28,15.8348164627364 -16,25.1651835372636 -16,25.1651835372636
-28,15.8348164627364 -28))',4326)"

Since this is my first time configurating a mapfile, I am unsure of what is
essential and what not, thus, I copied and pasted the script and adjusted
it to my CONNECTION details. I am not too sure whether it is vital to have
both a "map extent" and a "layer extend"?

Do you perhaps have any hints in this regard?

Best Regards
Cheryl


###############

Yikes!   That looks like a compatibility problem.  PostGIS has been
changing their function names (e.g. from "GeomFromText" to
"ST_GeomFromText"), and I don't  think Mapserver has kept up.  Can you use
an older version of PostGIS (<2.0)?

http://postgis.refractions.net/pipermail/postgis-devel/2012-January/017272.html

############


Opened a ticket for this problem:

http://trac.osgeo.org/mapserver/ticket/4186

Add yourselves to the CC list if you want to track it.

-Steve W

##########
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120220/6791602b/attachment-0001.html


More information about the mapserver-users mailing list