user30184 answered the same question here Why is MapServer returning a blank image?
user30184 answers to start by specifying SRID and that it often has to do with extent and projection.
I imported some soils data with ogr2ogr using -a_srs EPSG:4326
I am attempting to view the WMS layer with Google Earth. It currently shows a blank image.
My setup:
Ubuntu 14.0.4
PostGIS
POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.2, released 2015/02/10" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER
MapServer
MapServer version 6.4.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=GD SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
Mapfile
MAP
DEBUG 5
CONFIG "PROJ_DEBUG" "ON"
NAME "WMS-test"
CONFIG "MS_ERRORFILE" "/tmp/ms_error.txt"
STATUS ON
EXTENT -180 -90 180 90
PROJECTION
"init=epsg:4326"
END
IMAGECOLOR 55 55 55
WEB
METADATA
"wms_title" "WMS Test"
"wms_onlineresource" "http://10.0.0.7/cgi-bin/mapserv?map=/mapserver/wms.map&"
"wms_srs" "EPSG:4326 EPSG:3857"
"wms_enable_request" "*"
"wms_formatlist" "image/png,image/gif,image/jpeg"
"wms_format" "image/gif"
END
END # Web
LAYER
DEBUG 5
NAME "polygons"
PROJECTION
"init=epsg:4326"
END
METADATA
"wms_srs" "EPSG:4326"
"wms_name" "polygon"
"wms_title" "polygon layer"
"wms_server_version" "1.1.1"
"wms_format" "image/gif"
"wms_include_items" "all"
END
CONNECTIONTYPE postgis
CONNECTION "user=xxxx password=xxxx dbname=xxxx host=localhost"
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "geometry from polygon USING UNIQUE fid USING srid=4326"
STATUS ON
EXTENT -180 -90 180 90
TYPE POLYGON
CLASS
STYLE
COLOR 255 22 22
OUTLINECOLOR 32 32 32
END
END
END #layer
END # Map File
MapServer Logfile
CGI Request 1 on process 9224
msWMSLoadGetMapParams(): enabling non-square pixels.
msDrawMap(): kicking into non-square pixel preserving mode.
msDrawMap(): rendering using outputformat named gif (GD/GIF).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msPostGISLayerOpen called: geometry from polygon USING UNIQUE fid USING srid=4326
msPostGISLayerOpen: No connection in pool, creating a fresh one.
msConnPoolRegister(ssurgo,user=xxxx password=xxxx dbname=xxxx host=localhost,0xc7ad90)
msPostGISLayerOpen: Got PostGIS version 20100.
msPostGISLayerOpen: Forcing 2D geometries: yes.
msPostGISLayerFreeItemInfo called.
msPostGISLayerWhichShapes called.
msPostGISParseData called.
msPostGISParseData: unique_column=fid, srid=4326, geom_column_name=geometry, table_name=polygon
msPostGISBuildSQL called.
msPostGISBuildSQLItems called.
msPostGISBuildSQLItems: 0 items requested.
msPostGISBuildSQLFrom called.
msPostGISBuildSQLWhere called.
msPostGISBuildSQLSRID called.
msPostGISBuildSQLSRID: SRID provided (4326)
msPostGISBuildSQLBox called.
msPostGISLayerWhichShapes query: select encode(ST_AsBinary(ST_Force2D("geometry"),'NDR'),'hex') as geom,"fid" from polygon where geometry && ST_GeomFromText('POLYGON((-77.6373995911467 35.5916923817181,-77.6373995911467 35.6036240727873,-77.6170454186829 35.6036240727873,-77.6170454186829 35.5916923817181,-77.6373995911467 35.5916923817181))',4326)
msPostGISLayerWhichShapes query status: PGRES_TUPLES_OK (2)
msPostGISLayerWhichShapes got 0 records in result.
msPostGISLayerNextShape called.
msPostGISLayerFreeItemInfo called.
msPostGISLayerClose called: geometry from polygon USING UNIQUE fid USING srid=4326
msConnPoolRelease(ssurgo,user=xxxx password=xxxx dbname=xxxx host=localhost,0xc7ad90)
msDrawMap(): Layer 0 (ssurgo), 0.015s
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.015s
msSaveImage(stdout) total time: 0.002s
mapserv request processing time (msLoadMap not incl.): 0.017s
msFreeMap(): freeing map at 0xc0b630.
freeLayer(): freeing layer at 0xc14160.
msPostGISLayerIsOpen called.
msConnPoolClose(user=xxxx password=xxxx dbname=xxxx host=localhost,0xc7ad90)