Tuesday 21 July 2015

MapServer (MS4W) test page from shapefile shows only blank white square?



I am trying to create a test page with mapserver and shapefile. At the moment I just want to get the map shown on my test page. I have gotten the EXTENT coordinates by opening shapefiles with QGIS - I am sure those are correct. I have followed this tutorial as an example.


I am accessing my test page via this link:


http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\Apache\htdocs\mapfile.map

Problem I have - map is not loaded - I only see a blank white square.


When I look at contents of ms4w\Apache\htdocs\output , I see that images are actually getting generated but all of them are white (empty), for example:


lat_pmts_region13941906093724.png
lat_pmts_region13941910095144.png
lat_pmts_region13941913405500.png
...


Shapefiles are located at this location: C:\MS4W\ms4w\Apache\htdocs\shapefiles.


An example of what is logged to error file:


[Fri Apr 11 11:19:32 2014].883000 CGI Request 1 on process 7888
msWCSDispatch20(): wrong service (none)
msWCSParseRequest(): request is KVP.
msWCSDispatch(): SERVICE and REQUEST not included
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawMap(): Layer 0 (lat_pmts_region), 0.001s

msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.002s
msSaveImage(C:/MS4W/ms4w/Apache/htdocs/output/lat_pmts_region13972043727888.png) total time: 0.138s
[Fri Apr 11 11:19:33 2014].24000 mapserv request processing time (loadmap not incl.): 0.141s
[Fri Apr 11 11:19:33 2014].24000 msFreeMap(): freeing map at 0246EFD8.

ms4w\Apache\htdocs\template.html:



Mapserver Template HTML Document


Template






It looks like this: Test page looks like this


C:\MS4W\ms4w\Apache\htdocs\mapfile.map:


MAP
CONFIG "MS_ERRORFILE" "C:/MS4W/ms4w/tmp/ms_error.txt"
DEBUG 5

NAME lat_pmts_region
STATUS ON
SIZE 800 600

EXTENT 286878.53 142087.25 799084.10 481123.75
# lat_pmts_region

UNITS METERS
SHAPEPATH "shapefiles"
IMAGECOLOR 155 155 155


WEB
TEMPLATE "template.html"
IMAGEPATH "C:/MS4W/ms4w/Apache/htdocs/output/"
IMAGEURL "/output/"
END

LAYER
NAME "lat_pmts_region"
DATA lat_pmts_region

STATUS DEFAULT
TYPE POLYGON
END
END

I will gladly provide more information if it's asked.



Answer



You should add at least one CLASS/STYLE to your LAYER block:


CLASS STYLE COLOR 0 0 0 END END


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...