Is it possible to label the start and end of a line in MapServer?

I would like to be able to have the upstream invert at the top of the main and the downstream at the bottom.

<---Down Label---------------------------------------------Up Label---> 


The GEOMTRANSFORM keyword can be used to add symbols to the start and the end points.

Have a look at the tricks section where arrows are added to the start and end of a line.

Is it possible to label the start and end of a line in MapServer?

As a simpler (and perhaps more flexible) alternative, you can create a point layer in your map file with no symbology that dynamically reads the end points of the line. You can even create your dynamic start and end labels in the query.

The SQL example below works with SQL Server 2008, but if you are using a different database you should be able to use a similar syntax.

DATA "GEOM FROM (SELECT MyID, GEOM.STStartPoint(), 'Start' as Label FROM MyLines
      UNION ALL SELECT MyID, GEOM.STEndPoint(), 'End' as Label
      FROM MyLines) as points USING UNIQUE MyID USING SRID=4326"

As a plus you can then switch labels on and off by showing/hiding the layer.

Category: mapserver Time: 2011-11-07 Views: 1

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.213 (s). 12 q(s)