Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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):

LAYER
  NAME POIs
   TOLERANCE 50 
   TOLERANCEUNITS miles
   LABELITEM "name"
   SIZEUNITS miles      
  CLASS
    STYLE
       SYMBOL 'Airport'
       COLOR 61 245 0
       SIZE 100
       MINWIDTH 100
       MAXWIDTH 100
    END
    LABEL
      SIZE 9
    END
  END

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

SIZEUNITS miles

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).

Also:

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?

and

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.

share|improve this question
    
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. –  DfnD 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). –  DfnD 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
show 2 more comments

1 Answer

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:

***Parameters***

Longitude: -74.008680
Latitude: 40.711676
Radius: 1 mile

***Query***

SELECT *
FROM restaurant
WHERE (
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: http://stackoverflow.com/questions/574691/mysql-great-circle-distance-haversine-formula

this may also help you: http://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,

share|improve this answer
    
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. –  DfnD Jul 19 '13 at 15:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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