[mapserver-dev] Label Placement (cont.)

Steve Lime Steve.Lime at dnr.state.mn.us
Fri Sep 12 00:50:44 EDT 2008


A bit obsessed I think. I've been putzing with other algorithms. A center of gravity calculation turns out to
do quite well in many instances. I've attached 3 images based on the states shapefile. This is just GD since
I'm only looking at placement.

  - test_mbr.png: uses the center of the bounding box and then the scanline algorithm (4 polys need the 2nd pass)
  - test_centroid.png: uses the centroid code already present in mapprimitive.c (3 polys need the 2nd pass)
  - test_cog.png uses a center of gravity calculation (0 polys need the 2nd pass)

Visually the center of gravity computation produces the best placement for everything except Michigan. The algorithms are listed in order of speed (fastest to slowest).

Now to find a maximum inscribed circle algorithm...

Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_centroid.png
Type: image/png
Size: 13174 bytes
Desc: Portable Network Graphics Format
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20080911/c71104d7/test_centroid-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_cog.png
Type: image/png
Size: 13153 bytes
Desc: Portable Network Graphics Format
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20080911/c71104d7/test_cog-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_mbr.png
Type: image/png
Size: 13171 bytes
Desc: Portable Network Graphics Format
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20080911/c71104d7/test_mbr-0001.png


More information about the mapserver-dev mailing list