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

Brent Fraser bfraser at geoanalytic.com
Sun Feb 12 12:49:48 EST 2012


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


On 2/12/2012 9:43 AM, cheryl buckley wrote:
> 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 test-2.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 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
>
>
> . . . my test-2.map definition is 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.
>
> # ==================================================================================
> #
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>



More information about the mapserver-users mailing list