[mapserver-users] Labelling Lines with Center justification not owrking as expected.
Stephen Woodbridge
woodbri at swoodbridge.com
Fri Aug 25 17:25:57 PDT 2017
bobb,
Ok, then I think you should probably compute a point, label, angle
columns in the SQL and then use these to generate the label
Something like:
LAYER
TYPE POINT
...
DATA "geom from ( select gid, st_centroid(geom) as geom, format(...,
st_length(geom)*convert2units), st_azimuth(geom) as angle from table )
as subquery using unique segid srid=200068"
LABELITEM "label"
CLASS
LABEL
ANGLE [angle]
...
END
END
END
On 8/25/2017 11:56 AM, Basques, Bob (CI-StPaul) wrote:
> Steve,
>
> Doesn’t look like there is a LABEL option avaiable for GEOMTRANSFORM.
> All needs to be inside of the STYLE block. I tried wrapping it in a
> STYLE block inside of the Label, and got back:
>
> <ServiceException>
> msDrawLabelCAche(): General error message. Labels only support LABELPNT
> and LABELPOLY GEOMTRANSFORMS
> </ServiceException>
>
> I also tried “center” and “centroid” as parameters. . . .
>
> bobb
>
>
>
>
>> On Aug 24, 2017, at 7:29 PM, Stephen Woodbridge
>> <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>> wrote:
>>
>> 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 <mailto: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
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org>
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
> Perfection is achieved, not when there is nothing more to add, but when
> there is nothing left to take away.
> —Antoine de Saint-Exupéry
>
>
>
More information about the MapServer-users
mailing list