[mapserver-users] Labelling Lines with Center justification not owrking as expected.

Stephen Woodbridge woodbri at swoodbridge.com
Thu Aug 24 17:29:37 PDT 2017


On 8/24/2017 5:47 PM, Basques, Bob (CI-StPaul) wrote:
> All,
> 
> I’m working on a Parcel Assessment app that will display Parcel edges 
> and which streets they abut.  I’m trying to label each edge of the 
> parcel with it’s Edge length, but the positioning of the labels is not 
> at all what I’m expecting in the output.  Here is a sample image:
> 
> https://www.dropbox.com/s/ppp1cihnl4flycf/rc_parcels_assessment.02.png?dl=0
> 
> The blue lines represent a connection from the center of each of the 
> parcel edge segments being assigned, to the approriate Street/Alley 
> centerline (not shown).  I can’t seem to get the labels to center them 
> selves on the segments.  There should be one distance label centered on 
> each segment at the start of each of the blue lines where they intersect 
> the red parcel edges.
> 
> My next workaround would be to use a centroid of the line as the label 
> point.  I think I’ve tried all available combinations of settings in the 
> Mapfile, but maybe I missed something.
> 
> Anyone have any ideas?

In the LABEL use a geotransform "center" to create the label point, but 
this has the problem that you have a point so you have to precompute the 
ANGLE [angle] in the SQL and make that available to align the label with 
the edge.

-Steve W

> Here is the Label layer for the Parcel edges:
> 
> LAYER
> NAME 'Parcels-Query-Edges'
> STATUS ON
> TYPE LINE
> 
> METADATA
> "ows_title" "Parcels-Query-Edges"
> "gml_include_items" "all"
> END
> 
> CONNECTIONTYPE PostGIS
> CONNECTION “***REMOVED***”
> DATA "geom from (
> select
> round(length::numeric,2) round_el,
> * from assessment.rc_parcel_segments_no_overlaps
> WHERE parcelid = '%pin%'
> OR parcelid = '%qstring%'
> ) as subquery using unique segid srid=200068"
> 
> PROJECTION
> "init=epsg:200068"
> END
> 
> CLASSITEM "parcelid"
> LABELITEM "round_el"
> 
> VALIDATION
> 'pin' '^[0-9]{12}$'
> 'qstring' '^[0-9]{12}$'
> END
> 
> CLASS
> STYLE
> GEOMTRANSFORM "start"
> SYMBOL "circle"
> COLOR 255 0 0
> SIZE 12
> END
> STYLE
> GEOMTRANSFORM "end"
> SYMBOL "circle"
> COLOR 255 0 0
> SIZE 12
> END # STYLE
> LABEL
> FORCE true
> COLOR  255 0 0
> OUTLINECOLOR 255 255 255
> FONT "arial-bold"
> TYPE truetype
> SIZE 12
> ANGLE auto
> POSITION auto
> END
> END # CLASS
> TEMPLATE 'TEMPLATES/empty.html'
> END # LAYER
> 
> Thanks
> 
> bobb
> 
> 
> 
> 
> 
> 
> "Reality is merely an illusion, albeit a very persistent one."
>     - Albert Einstein
> 
> 
> 
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the mapserver-users mailing list