[mapserver-users] GEOMTRANSFORM LABELPNT example
Brent Fraser
bfraser at geoanalytic.com
Sun Dec 11 16:24:07 PST 2011
Steve,
I agree the new features should be driven from specific use cases,
but I like to expand designs to handle unforeseen uses (hopefully
without adding complexity).
So I prefer
GEOMTRANSFORM (getCentroid(labelpoly))
instead of
GEOMTRANSFORM LABELBBOXCENTROID
My use cases for expanded GEOMTRANSFORM (from an earlier email with
Steve L):
-------------------
The solution of using a STYLE with GEOMTRANSFORM got me thinking of
using the technique to solve some of the labeling challenges:
2. Place polygon annotation on/inside boundary line
(http://trac.osgeo.org/mapserver/ticket/1592 point 8.)
- label the line geometry resulting from GEOMTRANSFORM
(buffer([shape], -3)) of the original polygon
5. Place line anno above (or below) when using ANGLE FOLLOW
- label the line geometry resulting from GEOMTRANSFORM
(buffer([shape], 5)) of the original line
- useful for labeling rivers above their geometry
Currently the LABEL object uses the original geometry. Do you think it
would be possible to [optionally?] use the GEOMTRANSFORMed geometry?
Similarly, would it be possible to have the LABEL's convex hull (or a
buffer the character boxes?) used as a clipping polygons of the layer's
geometry to address:
8. Erase layer's geometry (but not other layers) under label
- possible syntax: GEOMTRANSFORM ( clip( [labelpoly] ) )
- useful for labeling contours
----------------
Best Regards,
Brent Fraser
On 12/11/2011 3:02 PM, Stephen Woodbridge wrote:
> It seems to me that we should develop specific use cases that we are
> trying to support.
>
> We have one that this feature was developed for, and that is as Steve
> L mention for labeling Highway Shields were the actual shield may be
> composed of multiple parts that need to be be super imposed relative
> to a label point, if I recall the details of that discussion without
> looking it up again.
>
> Ian, I think the point you are looking for is different. That would be
> the centroid of the label polygon. That point may or may not be
> coincidentally the same as the LABELPNT under some small set of
> configuration parameters but by no means guaranteed to be the same.
>
> I think that these points might be the same is you have a single line
> of text, ie: not wrapped, and POSITION CC and probable ANGLE 0. But I
> have not had time to test.
>
> -Steve W
>
> On 12/11/2011 4:18 PM, Ian Walberg wrote:
>> So is it expected that labelpnt generates a point with its center at
>> the middle of the bounding rectangle of the text?
>>
>> Thanks
>>
>> Ian
>>
>>
>> -----Original Message----- From:
>> mapserver-users-bounces at lists.osgeo.org
>> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Brent
>> Fraser Sent: Sunday, December 11, 2011 1:02 PM To: thomas bonfort Cc:
>> mapserver-users at lists.osgeo.org Subject: Re: [mapserver-users]
>> GEOMTRANSFORM LABELPNT example
>>
>> Thomas,
>>
>> I tracked it down to the LABELCACHE setting.
>>
>> LABELCACHE ON gives the expected results LABELCACHE OFF gives my
>> old blue-dot-on-the-left results.
>>
>> See attached PDFs.
>>
>> Best Regards, Brent Fraser
>>
>>
>> On 12/11/2011 1:05 PM, thomas bonfort wrote:
>>> There might have been a bug in the initial implementation. trying
>>> it out with current trunk gives me the expected result, unless I'm
>>> missing something.
>>>
>>>
>>> On Sun, Dec 11, 2011 at 20:44, Brent
>>> Fraser<bfraser at geoanalytic.com> wrote:
>>>> Thomas, See comments below.
>>>>
>>>> Best Regards, Brent Fraser
>>>>
>>>>
>>>>
>>>> On 12/11/2011 12:26 PM, thomas bonfort wrote:
>>>>> I think this is all expected behavior, although the
>>>>> documentation may be incorrect.
>>>>>
>>>>> LABELPNT draws a marker on the geographic position the label
>>>>> is attached to. This corresponds to the center of the label
>>>>> text only if the label is in position CC.
>>>> I think that is what is intended but my original test case (using
>>>> CC ) resulted in the LABELPNT rendered on the left side of the
>>>> labelpoly, see
>>>> http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20110526/47c9bc8c/labelpnt-0001.png.
>>>>
>>>>
>>>>
> I had expected it to be coincident with the yellow circle and green
> cross.
>>>>
>>>>
>>>>> To draw a label at the center of the label text, another
>>>>> geomtransform would have to be implemented, named e.g.
>>>>> LABELBBOXCENTROID.
>>>> or maybe
>>>>
>>>> GEOMTRANSFORM (centroid([LABELPOLY]))
>>>>
>>>>
>>>>> regards, thomas
>>>>>
>>>>> On Sun, Dec 11, 2011 at 19:34, Brent
>>>>> Fraser<bfraser at geoanalytic.com> wrote:
>>>>>> Hey Jeff,
>>>>>>
>>>>>> I've been looking into this too (not finished yet). I'm
>>>>>> using v6.0.1 and can reproduce my original results (blue dot
>>>>>> to the left) AND Ian's (grey dot coincident with white dot).
>>>>>> Very strange. My shapefile dataset gets reprojected from
>>>>>> geographic to UTM, so that may be causing the difference. I
>>>>>> need to look into that...
>>>>>>
>>>>>> Best Regards, Brent Fraser
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 12/11/2011 10:57 AM, Jeff McKenna wrote:
>>>>>>> On 11-12-11 11:20 AM, Ian Walberg wrote:
>>>>>>>> Here is the map file we are using ms4w 3.0.3.
>>>>>>>>
>>>>>>>> We thought the larger grey circle should be drawn in the
>>>>>>>> center of the label text.
>>>>>>>>
>>>>>>>> What have we done wrong?
>>>>>>>>
>>>>>>>>
>>>>>>> I have done some testing on this on Windows, with MapServer
>>>>>>> trunk (6.1-dev), here are my findings:
>>>>>>>
>>>>>>> - I used Brent's original example styles (from
>>>>>>>
>>>>>>> http://osgeo-org.1803224.n2.nabble.com/GEOMTRANSFORM-labelpnt-location-td6408065.html)
>>>>>>>
>>>>>>>
>>>>>>>
> with Ian's FEATURE layer --> Brent's "Blue Dot" LABELPNT with
> POSITION
>>>>>>> CC is now correctly placed in the center of the label text
>>>>>>> (so it seems this has been fixed in the code, but I can't
>>>>>>> find the ticket that says that) - If I change to POSITION
>>>>>>> LR (as in Ian's example layer) then I get Ian's issue
>>>>>>> (LABELPNT is placed at the geometry location, not in the
>>>>>>> center of the label text - but this is now an issue of
>>>>>>> understanding the developer's logic (from that thread
>>>>>>> SteveL says "Let me ponder this and get back to you. I
>>>>>>> think it makes sense to use the label point geotransform
>>>>>>> only with position CC so that it matches actual shape
>>>>>>> location.")
>>>>>>>
>>>>>>> That's all I know at this point (ha pun).
>>>>>>>
>>>>>>> -jeff
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> mapserver-users mailing list mapserver-users at lists.osgeo.org
>>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>
>>>>
>>>>
>>>> _______________________________________________ mapserver-users
>>>> mailing list mapserver-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list