I am trying to serve my Mapfile data as a MapServer layer in OL, rather than a WMS layer.

When I display it using WMS, everything works fine. The part of the mapfile I have struggled with was SIZEUNITS. Seems easy enough, but I encountered some strange behavior along the way.

The issue: my SIZEUNITS units is miles and the size is 100 (so a 50 mile radius). When I use the WMS layer below, everything is fine:

var cust = new OpenLayers.Layer.WMS("POIs",
{layers: ['POIs']}, {wrapDateLine: true, singleTile: true});

However, when I try to switch it over to:

var cust = new OpenLayers.Layer.MapServer("POIs",
{map: "/data2/html/html2/david_POIs4.map",
layers: ['POIs']}, {singleTile: true} ); 

The points (circles rather, with points in the middle) are HUGE. More or less taking up the whole map.

So, why would switching from WMS to MapServer show such glaring differences? A MapServer layer should be simpler to correctly configure.

When I was stuck on a similar issue last week I posted here (of course hadn't gotten this far yet).

Edit: see the images here for a visual. First map is correct (zoomed in), 2nd map is incorrect.

Edit2: I've never had an issue with projections before (I have the same projection set in both the LAYER and the MAP). Here's the layer in question, and if I use SIZEUNITS MILES it seems to automatically get blown out of proportion, regardless of the value you pass to SIZE within STYLE.

            NAME POIs
            DEBUG 5
            TYPE POINT
            CONNECTION 'PointsOfInterest_Latest.db'
            DATA 'POIs'
            STATUS ON
            SIZEUNITS miles
            LABELITEM "name"
                            SYMBOL 'Airport'
                            COLOR 8 29 118
                            #WIDTH 5
                            SIZE 10
                            #MINWIDTH 1
                            #MAXWIDTH 1
                    #       SYMBOL 'City'
                    #       COLOR 8 29 118
                    #       SIZE 6
                            FONT "andalewt"
                            TYPE truetype
                            ENCODING "UTF-8"
                            MINSIZE 9
                            MAXSIZE 9
                            POSITION AUTO
                            PARTIALS FALSE
                            COLOR 8 29 118
                            OFFSET 1 1
                            PRIORITY 10
                            BUFFER 0
                    END # LABEL


Now, you can see the SIZEUNITS set to MILES and the SIZE set to 10. Being the farthest zoom level out, you should barely be able to see the circles, but they are huge, as you can see here.

Any input is appreciated.

1 Answer 1


Set UNITS dd in the MAP level. Big thank you to fellow user from MapServer mailing list.

He was saying UNITS dd is automatically set using WMS, but not MapServer. Good to know.

"You are probably missing a "UNITS dd" at the map level. It works with WMS because the SRS included in the WMS call will set the map.units to dd automatically."

  • What do you ean MAP level? Where exactly do you set the UNITS to dd? And what format is your layer above in? I'm new to OpenLayers, so not familiar with everything. Thanks.
    – ianbroad
    Jul 23, 2013 at 18:13
  • Hi I-B, MAP level is the 'outermost' level in the Mapfile. Just add it somewhere at the top before you start your LAYER definitions. Not sure what you mean by format? It's just a database (lat and long are stored in there, along with other columns). Let me know if you have other questions.
    – Nubtacular
    Jul 23, 2013 at 18:23
  • Oh, okay, so Mapfile is specific to MapServer? I installed GeoServer to begin, so that's probably why I'm not familiar with it. Thanks for the help. And for what format, I just meant the information you're showing above. I didn't know if that was like XML or what. With the STYLE/END stuff. I'll have to install MapServer and check it out sometime.
    – ianbroad
    Jul 23, 2013 at 18:46
  • I'm a novice myself but yes I'm fairly certain if you want to generate a Mapfile you need to be using MapServer. As for format, you'll see LABELITEM "name". name is a column in my database, so that will be used to display the data. The documentation is actually quite handy for configuring Mapfiles.
    – Nubtacular
    Jul 23, 2013 at 18:56
  • Yeah, I'm looking at it right now. Thanks again. mapserver.org/mapfile
    – ianbroad
    Jul 23, 2013 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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