1

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:

<html>
<head><title>Mapserver Template HTML Document</title></head>
<body bgcolor=#AAAAAA>
<h2>Template</h2>
<img src="[img]" border=1>
</body>
</html>

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.

  • try a path without space, ie. Program Files may causing you problems. – Gery Apr 11 '14 at 8:39
  • @Gery I just did a complete reinstall of mapserver, Installed into C:/MS4W , so no spaces in the path. Problem remains. I forgot to mention that I am using precompiled MS4W binary. – afaf12 Apr 11 '14 at 16:00
2

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

CLASS STYLE COLOR 0 0 0 END END

  • Thanks, but that did not fix the issue. I forgot to mention that I am using MS4W. I also reinstalled MS4W to avoid having space in the path. – afaf12 Apr 11 '14 at 16:14
  • The image you posted seems plausible to me, i.e. black polygon on a gray background. Without knowing what's actually present in your shapefile it's hard to know more. – Thomas Bonfort Apr 11 '14 at 17:26
  • 1
    I am guilty. It appears the shapefile I was trying to connect was actually a rectangle, and did not contain anything else. I tried using a shapefile which contains actual map information and it works. Thanks! – afaf12 Apr 11 '14 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.