state names with national atlas data

Steve Lime steve.lime at DNR.STATE.MN.US
Fri Apr 22 13:29:28 EDT 2005


The problem is the data (ok, and MapServer, but it's easier to address
the data). You've got multipolygon states and their order in the
shapefile is influencing which part gets labeled. If this is the case
you have a couple of options:

  1) Turn the multiple polygons into one multipart polygon for each
state (except for perhaps Michigan). That way you can only get one
label/state. Doing so will require a desktop tool (like arcview) but
could also be done using MapScript.

  2) use sortshp to sort your shapefile based on area (hopefully you
have an area or some size related attribute) in ascending order. This
will cause labels for the larger polygons to get priority when labeling
(last on the map is labeled first). When combined with MINDISTANCE only
the largest part should get labeled.

Steve

>>> Mark Dieterich <mdieterich at GMAIL.COM> 4/22/2005 11:16:53 AM >>>
Hi everyone,

I'm trying to use the generalized national atlas data at high zoom
levels for my maps.  It's working out pretty well, until I get to a
zoom
level where all I want to display is state names.  Two problems:

1) I only want each state name to display once.  I can put a really
big
MINDISTANCE in my mapfile to handle this, but it introduces the next
problem.

2) Where mapserver chooses to put the label appears to be random.  I'm
sure it's not, but it certainly isn't the center of the state.

Any idea how I can work around these two issues?

Thanks,

Mark



More information about the mapserver-users mailing list