Steve W,

Thanks for the MINDISTANCE suggestion; I'll give that a go to get part way 
there, along with to Steve L.'s suggestion to sort. Still not quite at the goal 
yet. 

- Phil

-----Original Message-----
From: Anzel, Phil - NRCS, Fort Collins, CO 
Sent: Friday, February 03, 2012 7:00 AM
To: [email protected]; Anzel, Phil - NRCS, Fort Collins, CO
Subject: RE: How to label only largest displayed areas?

Hi, Jukka and Steve,

Thanks for your replies. Jukka is correct, I do not believe it is simple. 
Steve, your approach sorts all areas and then filters by those visible in the 
layer's extent. I'm looking for ranking by the clipped area. For example, if 
the current map and layer's extent shows the a small sliver of the mainland of 
California and a larger visible part of an island that is part of California, 
only the island would be labeled, as its visible area is larger than that of 
the sliver.

- Phil

-----Original Message-----
From: Rahkonen Jukka [mailto:[email protected]] 
Sent: Thursday, February 02, 2012 4:01 PM
To: Lime, Steve D (DNR); Anzel, Phil - NRCS, Fort Collins, CO; 
[email protected]
Subject: Re: How to label only largest displayed areas?

Hi,

I understood that meaning was to put exactly one label per state. Each state, 
even tiny ones, should be labeled. But one state should get only one label even 
if the map window is splitting the state polygon into two or more 
intersections. Those intersections may be bigger than the tiny state. Not 
extremely simple.

-Jukka-

________________________________________
L Lime, Steve D (DNR) wrote:

> I'd do this by sorting features based on area (ascending order). This would 
> draw the smallest polygons first, but would put the labels for the shapes 
> with the largest area into the label cache last (where they would be placed 
> and drawn first). I've done this with labeling lakes and it works fine.

Steve

--------------------------------------------------------
Date: Thu, 02 Feb 2012 15:19:19 -0500
From: Stephen Woodbridge <[email protected]>
Subject: Re: [mapserver-users] How to label only largest displayed areas?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi Phil,

I'm not sure I understand what you need here. Mapserver currently 
displays one label per polygon based on the visible extents of that 
polygon. If your state is represented by a single record with a 
multipolygon like the state and its coastal islands, then I suspect that 
it will label the first polygon in the multipolygon object. In the cases 
where you have multiple records in your dataset one for the state and 
additional polygons for the islands, then all of these are added to the 
labelcache and the last one in the labelcache is labeled first if the 
label does not collide. So in this case you could sort your data by 
state and area increasing in size so you largest is loaded last and 
labeled first.

You can also control the number of labels using MINDISTANCE <dist> so 
the same label in a layer is not presented within <dist> units of 
another with the same name.

Do you need more than this?
Are you trying to place the label in the biggest open space? (this we 
can not do because there is no easy algorithm for this).

-Steve W

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Anzel, Phil - 
NRCS, Fort Collins, CO
Sent: Thursday, February 02, 2012 1:43 PM
To: [email protected]
Cc: Anzel, Phil - NRCS, Fort Collins, CO
Subject: [mapserver-users] How to label only largest displayed areas?

Hi, All,

How can I label only the largest displayed areas within an extent? For example, 
if I'm labeling states of the United States and my extent covers a small region 
around the Maine, New Hampshire and Massachusetts junction, I only want a 
single label for each state, chosen by the largest displayed area (within the 
current map extent) in each state.

I'm using spatial data stored in Microsoft's SQL Server 2008.

I've created an enhancement request ticket (#4173: Define a current layer 
extent's WKT string for use in Data statement) as one possible approach, but 
this approach requires a change to MapServer.

Is there a better way?

Thanks.

- Phil Anzel
  Vistronix Inc for USDA/NRCS/ITC

This electronic message contains information generated by the USDA solely for 
the intended recipients.  Any unauthorized interception of this message or the 
use or disclosure of the information it contains may violate the law and 
subject the violator to civil or criminal penalties.  If you believe you have 
received this message in error, please notify the sender and delete the email 
immediately.


_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users


_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users


_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to