Hi fellows,<br><br>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! :)<br><br>Kind regards<br>Cheryl<br><br><br><br>#######<br>Hi,<br>
<br>I'm trying to get Mapserver connected with PostGIS. PostGIS is holding<br>
a shape2pgsql contourline import in the table "atest" while a test has<br>the following columns (shape2pgsql default):<br>
<br>--------------------------------------<br>| Actions | gid | id | height | geom |<br>--------------------------------------<br><br>Quantum GIS picks the conection up perfectly to atest but with<br>Mapserver I just get a blank screen - or the color of IMAGECOLOR [. .<br>
.] definition in *.map definitions.<br><br>Somehow it seems like I got the connection between Mapserver and<br>PostGIS running - at least the debug.log doesn't complain. But still<br>I'm not seeing any of my contour lines as I'm used to by Quantum GIS<br>
;(<br><br>Could someone give me a hint of what I'm missing out or where my mistake is?<br>I got the feeling that it is either has something to do with the DATA<br>property or the projection properties …<br><br>The Link with which I call the mapserv binary is:<br>
<br><a href="http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map" target="_blank">http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map</a><br>But then it complains:<br>msDrawMap(): Image handling error. Unable to initialize image.<br>
msPrepareImage(): General error message. Image dimensions not<br>specified. msCalculateScale(): General error message. Invalid image<br>width or height.<br><br>So I changed it to the following:<br><a href="http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map&mapsize=600+800" target="_blank">http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map&mapsize=600+800</a><br>
which results in fortunately no errors but therefore in a blank screen<br>with a clean debug.log ...<br><br>Even this one wont change anything:<br><a href="http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map&mapsize=600+800&layer=Contour" target="_blank">http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map&mode=map&mapsize=600+800&layer=Contour</a><br>
<br>I attached some screenshots for clearity . . .<br>. . . my test-2.map definition is attached below:<br><br>P.S.: TEMPLATE "./Maps/test.map" does exist and is read and writeable<br>to the user which runs the webserver (Apache => User: www)<br>
CONFIG "PROJ_LIB" "/usr/local/share/proj/" should also be valid:<br><br>FreeBSD [~]# ls /usr/local/share/proj<br>FL WO hawaii null stlrnc<br>
GL27 alaska nad.lst nzgd2kgrid0005.gsb stpaul<br>IGNF conus nad27 other.extra world<br>MD epsg nad83 proj_def.dat<br>
TN esri ntf_r93.gsb prvi<br>WI esri.extra ntv1_can.dat stgeorge<br><br><br><br># =================================== test-2.map<br>
=================================== #<br><br><br>MAP<br><br> CONFIG "PROJ_LIB" "/usr/local/share/proj/"<br> CONFIG "MS_ERRORFILE" "./debug.log"<br> DEBUG 5<br><br> IMAGECOLOR 100 100 100<br>
<br> NAME "Contour"<br> EXTENT -<a href="tel:90%20-180%2090%20180" value="+19018090180" target="_blank">90 -180 90 180</a><br> STATUS ON<br><br> PROJECTION<br> "init=epsg:4326"<br>
END<br><br> WEB<br> METADATA<br> WMS_NAME "Contour"<br>
WMS_TITLE "SRTM - ContourLines"<br> WMS_ABSTRACT "My First Web Map Server"<br> WMS_SERVER_VERSION "1.1.1"<br>
WMS_SRS "EPSG:4326"<br> WMS_ONLINERESOURCE<br>"<a href="http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map" target="_blank">http://192.168.10.15/cgi-bin/mapserv?map=./Maps/test.map</a>"<br>
WMS_ATTRIBUTION_TITLE "Some Attribute Title"<br> WMS_ATTRIBUTION_ONLINERESOURCE "<a href="http://www.myHomepage.com/" target="_blank">http://www.myHomepage.com/</a>"<br>
WMS_KEYWORDLIST<br>
"DEM,SRTM,Contourlines,Contour,Lines,Digital,Area,Model"<br> WMS_FEATURE_INFO_MIME_TYPE "text/html"<br> WMS_CONTACTELECTRONICMAILADDRESS "User@Domain.tld"<br> WMS_CONTACTPERSON "Some Reference Person"<br>
WMS_CONTACTVOICETELEPHONE "+49-phoneNumber"<br> WMS_CONTACTORGANIZATION "Private"<br> WMS_ENCODING "utf-8"<br> END<br>
END<br><br><br> LAYER # query layer from PostgreSQL table<br> NAME "Contour"<br> EXTENT 143 -20 145 -19<br> TYPE LINE<br> STATUS ON<br>
DEBUG ON<br> TEMPLATE "./Maps/test.map"<br> DUMP true<br> METADATA<br> WMS_NAME "Contour"<br> WMS_TITLE "Contour Lines - 90m"<br>
WMS_ABSTRACT "Contour Lines - 90m"<br> WMS_SRS "EPSG:4326"<br> GML_INCLUDE_ITEMS "all"<br> END<br><br> CONNECTIONTYPE POSTGIS<br>
CONNECTION "host=192.168.10.15 port=5432<br>dbname=my_spatial_db user=admin password=******"<br> DATA "geom FROM atest using unique gid using srid=4326"<br><br> CLASS<br>
STYLE<br> COLOR 000 000 000<br> OUTLINECOLOR 199 199 199<br> END<br> END<br><br> END<br>END<br><br><br># ==================================================================================<br>
#<br><br><br><br><br><br><br><br><br># =================================== debug.log<br>=================================== #<br><br>FreeBSD [/usr/local/www/cgi-bin/Maps]# cat ./debug.log<br><br>[Sat Feb 11 19:02:01 2012].3032 CGI Request 1 on process 2663<br>
[Sat Feb 11 19:02:01 2012].10325 msDrawMap(): rendering using<br>outputformat named png (AGG/PNG).<br>[Sat Feb 11 19:02:01 2012].10365 msDrawMap(): WMS/WFS set-up and query, 0.000s<br>[Sat Feb 11 19:02:01 2012].10388 msDrawMap(): Drawing Label Cache, 0.000s<br>
[Sat Feb 11 19:02:01 2012].10398 msDrawMap() total time: 0.007s<br>[Sat Feb 11 19:02:01 2012].76893 msSaveImage(stdout) total time: 0.066s<br>[Sat Feb 11 19:02:01 2012].77721 mapserv request processing time<br>(loadmap not incl.): 0.075s<br>
[Sat Feb 11 19:02:01 2012].77749 msFreeMap(): freeing map at 0x29879800.<br>[Sat Feb 11 19:02:01 2012].77839 msPostGISLayerIsOpen called.<br><br># ==================================================================================<br>
#<br>#############<br><br>Cherly,<br><br> One issue could be that you've asked Mapserver to render the entire world:<br><br><br>EXTENT -<a href="tel:90%20-180%2090%20180" value="+19018090180" target="_blank">90 -180 90 180</a><br>
<br>into a small image:<br><br>mapsize=600+800<br><br>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<br>
<br><br> EXTENT 143 -20 145 -19<br><br>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)?<br>
<br>Best Regards,<br>Brent Fraser<br><br><br>################<br><br>Hi Brent,<br><br>Thanks for your reply.<br><br>The SRS my data is stored in WGS84.<br><br>Unfortunately, I am not getting configuration file right. I adjusted the map EXTENT to something smaller,<br>
<br>Map<br><br>Extent 16 -28 25 -16<br> <br><br>The layer extent I also adjusted to the output image of the contour data,<br><br>Layer<br><br>Extent 17.002 -20.965 18.007 -20.002<br><br>I played around with the figures a little but I get this error message at all times,<br>
<br>"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)"<br>
<br>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"?<br>
<br>Do you perhaps have any hints in this regard?<br><br>Best Regards<br>Cheryl <br><br><br>###############<br><br>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)?<br>
<br><a href="http://postgis.refractions.net/pipermail/postgis-devel/2012-January/017272.html" target="_blank">http://postgis.refractions.net/pipermail/postgis-devel/2012-January/017272.html</a><br><br>############<br><br>
<br>Opened a ticket for this problem:<br>
<br><a href="http://trac.osgeo.org/mapserver/ticket/4186" target="_blank">http://trac.osgeo.org/mapserver/ticket/4186</a><br><br>Add yourselves to the CC list if you want to track it.<br><br>-Steve W<br><br>##########<br>
<br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>