[mapserver-dev] Need Better highway labeling for multiple names and labels

Stephen Woodbridge woodbri at swoodbridge.com
Mon Feb 14 15:54:24 EST 2011


On 2/14/2011 11:36 AM, Lime, Steve D (DNR) wrote:
> Steve: I’m assuming on the data side you have multiple road name
> attributes for each road segment.

Ok, this is common in most street data, for example Tiger, Navteq and 
TeleAtlas all support the fact the a street segment, might have multiple 
highway labels associated with it in addition to a street name. I have 
been working with Navteq data in Spain and I am also seeing multiple 
street names for a single segment. And this does not even deal with the 
fact that in some regions for the country you have names in multiple 
languages like SPA and CAT to further compound the problems. Here is one 
simple example of a segment with a route number B-20 and two separate names:

64368639:B-20:CAT::::2:2:H
64368639:RONDA DE DALT:CAT::::2::H
64368639:CARRETERA D'ESPLUGUES:CAT::::2::H

Here is one with two route numbers and street name:

64373062:AUTOPISTA DEL MEDITERRÃNEO:SPA::::1::H
64373062:AP-7:CAT::::1:2:H
64373062:E-15:CAT::::1:1:H

Here is one with two route numbers and two names:

64395851:C-16:CAT::::2:2:H
64395851:CARRETERA COMARCAL:CAT::::2::H
64395851:CARRETERA DE MANRESA A BELLVER DE CERDANYA:CAT::::2::H
64395851:E-9:CAT::::2:1:H

Also notice that often the names are very long which complicates labeling.


A separate use case is want to display right_from_addr, left_from_addr, 
right_to_addr and left_to_addr numbers along the segment but offset.

      l_f_addr              l_t_addr
    f-+---------------------+------>t
      r_f_addr              r_t_addr

Something like this where the label point is defined alone the segment. 
I could do this by ANNOTATION layer four times once for each label if I 
could control the label point. "+" points would be defined labelpoints 
like say 5% and 80% along the line.

I have actually had a little bit of luck doing the house numbers with 
GEOTRANSFORM START|END, ANGLE AUTO, and OFFSET x y to push the labels 
into position. This is done as an overlay layer in OpenLayers that can 
be toggled on/off so it does not clutter up the map unless you need it.

> Thinking about this I would approach this by augmenting the
> REPEATDISTANCE operations with a new REPEATOFFSET (default is 0). That
> way you could add a second set of labels to the same set of geometries
> with some hope that labels would not collide. I would think this would
> work best with labels that are of a consistent size, like road shields.

Any thoughts on how this would be defined? percentage, pixel, units, all 
are possible?

REPEATOFFSET 10% #
REPEATOFFSET 20 # this would be in UNITS if defined otherwise in pixels

This is awkward, how about just being able to define

BASELABELPOINT [n%|n]

where n in an signed integer. Negative values imply computing the point 
from the end of the linestring instead of the beginning. OR why not enhance

GEOTRANSFORM (START|END|CENTROID)
GEOTRANSFORMOFFSET i[%] j

where:
  i[%] = offset along the line as %age of line length or in UNITS
  j = offset normal to the line at the i-th position

> Then from a mapfile perspective you’d draw things twice, in 6.0 it would
> look like:
>
> LAYER
>
>    NAME ‘highway1’
>
>    TYPE LINE
>
>    LABELITEM ‘road_name1’
>
>    # classes follow using label styles to draw the shields and class
> styles to draw the linework and no repeat offset
>
> END
>
> LAYER
>
>    NAME ‘highway2’
>
>    TYPE ANNOTATION
>
>    LABELITEM ‘road_name2’
>
>    # classes follow using class styles to draw the shields with a repeat
> offset
>
> END
>
> So, highway1 would lay down the line work and one set of shields and
> highway2 would draw a second set of shields offset from the first.

Yeah, something like this might work. It would at least solve some of 
the problems and take some pressure off this issue.

> Another idea might be to allow multiple class expression matches. It
> might be possible to do what you want using one layer definition if a
> feature could match multiple classes. So you’d have one set for
> road_name1, one for road_name2, one for road_name3. The set for
> road_name1 would always draw line work and a first set of shields, the
> subsequent would do only shields. I’ve never used CLASSGROUPs so perhaps
> this concept is already supported.

I have never used CLASSGROUPs either, but this implies it is main for 
named styles:
   http://mapserver.org/development/rfc/ms-rfc-39.html

Something like match multiple cases could work also and probably would 
be faster them multiple passes over the data.

> In either case you’d need REPEATOFFSET. Alan could comment on the
> feasibility of adding that.

It's probably to late to get this into 6.0, but it would be nice if 
someone had some time to try and do something with it.

SUMMARY:

1. Seems like the simplest solution would be to provide some control on 
how to set the label point and then render the line and put some label 
on it using the default or set label point. Then use annotation layers 
to add additional labels.

2. Devs seem to think using and extending REPEAT mechanism is the 
easiest way to code this. But it in not clear the this would give much 
control over the label points used.

> Doing things like multiple labels or label items is too disruptive IMHO…

3. This sounds too hard without a lot of refactoring and code disruption.

> Steve
>
> *From:*mapserver-dev-bounces at lists.osgeo.org
> [mailto:mapserver-dev-bounces at lists.osgeo.org] *On Behalf Of *Tamas Szekeres
> *Sent:* Saturday, February 12, 2011 4:20 PM
> *To:* Stephen Woodbridge
> *Cc:* mapserver-dev
> *Subject:* Re: [mapserver-dev] Need Better highway labeling for multiple
> names and labels
>
> Steve,
>
> Wouldn't that be feasible to utilize the REPEATDISTANCE as per MS-RFC-57
> <http://mapserver.org/development/rfc/ms-rfc-57.html> to define the
> positions? In this case we could define some special character as a
> separator to split the labeltext into fragments that could be alternated
> in the subsequent positions.
>
> Best regards,
>
> Tamas
>
>
> 2011/2/12 Stephen Woodbridge <woodbri at swoodbridge.com
> <mailto:woodbri at swoodbridge.com>>
>
> Hi all,
>
> I just wrote and enhancement request:
>
> http://trac.osgeo.org/mapserver/ticket/3675
>
> I would be interested in some feedback on this and if anyone has ways to
> work around these limitations.
>
> Best regards,
> -Steve W
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org <mailto:mapserver-dev at lists.osgeo.org>
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>



More information about the mapserver-dev mailing list