I am trying to set the symbol radius to 100 miles. This seems ok (note, not including the whole mapfile, just what's at hand here):

   LABELITEM "name"
   SIZEUNITS miles      
       SYMBOL 'Airport'
       COLOR 61 245 0
       SIZE 100
       MINWIDTH 100
       MAXWIDTH 100
      SIZE 9

I'd like to keep the label size at 9. If I am NOT using


the label at size 9 looks fine. But using SIZEUNITS miles makes it much much smaller.

After reading here: http://lists.osgeo.org/pipermail/mapserver-users/2012-February/071582.html it seems you can set a maxwidth and minwidth within your STYLE to accompany for having the symbol width in pixels but the radius in miles (correct me if I am wrong).


When I zoom in on a handful of points, certain points and labels start to disappear. I know I could set FORCE ON and PARTIALS TRUE but this doesn't look good.

So what I would like to understand:

1) why are the labels becoming much smaller with SIZEUNITS miles on?


2) why are certain points disappearing when zooming in (and some only showing up when zooming in, not initially present) when there seems to be ample room on the map for them to display without FORCE ON? See here for original zoom. Right click image link into new tab to see better view.

  • your icons shouldn't dissapear, my question is why are you using "sizeunits miles" in the first place?
    – Gery
    Jul 16 '13 at 21:44
  • Trust me, same thing that crossed my mind. Boss wants it. Seems unnecessary.
    – Nubtacular
    Jul 16 '13 at 21:46
  • I think you don't need it, you just need to set a radius of 100 miles, that's all, and sizeunits will dissapear your labels and icons after changing resolutions (ie. zoom in). One thing about this is that probably OL doesn't understand miles, so it doesn't do the conversion properly and this might impact negatively the rendering of your features, but this is only an idea, though.
    – Gery
    Jul 16 '13 at 21:51
  • Sorry, where would you specify radius? Don't see any mention of it in the docs (or not specifically at least).
    – Nubtacular
    Jul 16 '13 at 22:12
  • if I'm right you need to specify that when you call your features, are you using some backend for this? postgresql/postgis? sqlserver?
    – Gery
    Jul 16 '13 at 22:18

I think the most efficient way to do what you need is with a sql query. You need to test this first, here you have an example:


Longitude: -74.008680
Latitude: 40.711676
Radius: 1 mile


FROM restaurant
POW( ( 69.1 * ( Longitude - -74.008680 ) * cos( 40.711676 / 57.3 ) ) , 2 ) + POW( ( 69.1 * ( Latitude - 40.711676 ) ) , 2 )
) < ( 1 *1 );

Once you test this in sqllite and get the right call, you add this in the ogr connection (ie. DATA).

There is a lot of discussion about this issue, basically the problem is that results are not "exact" because the spherical and flat nature of the earth after getting results from long/latitude and UTM. The best would be to use UTM to get accurate results.

Check this link that could solve the UTM conversion problem: https://stackoverflow.com/questions/574691/mysql-great-circle-distance-haversine-formula

this may also help you: https://stackoverflow.com/questions/1006654/fastest-way-to-find-distance-between-two-lat-long-points

I also forgot to mention that SIZEUNITS should be used in the MAP tag rather than in the LAYER tag, check this please (point 10): http://smercier1.mapgears.com/blog/?p=37

Hope this helps,

  • Hi Gery, thanks for the detailed reply. Honestly I do not think a sql query is the best way to do this. I did find a solution: although I'm not sure it's the best. I set the MAXSIZE and MINSIZE label to 9. the SIZEUNITS within the LAYER to 100 (which yields a 50mi radius). If you set the SIZEUNITS to 100 or bigger values in general is when the labels start to unfortunately disappear.
    – Nubtacular
    Jul 19 '13 at 15:12

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.