[mapserver-dev] RFC 89 Layer Geomtransform: Call for vote

Alan Boudreault aboudreault at mapgears.com
Tue Feb 19 07:51:24 PST 2013


In fact, here's a more detailed explanation:

If you don't use the binding [map_cellsize], the UNITS has no effect. As 
far as I know, the UNITS is only used to specify the layer units, not to 
specify a kind of size units (like SIZEUNITS for the units in the classes)

- If you don't use [map_cellsize], the value is simply passed through 
the shape parsing code (mapparser.y). The value has to be in ground 
coordinates of the layer.

- If you use [map_cellsize], the internal need is to convert the map 
cellsize value into the layer units. That way, the math expression will 
be parsed properly inside the mapparser.y code. Here's the convertion 
workflow if you use [map_cellsize]:

1. If the Layer UNITS  is specified, use it.
2. Else, try to get the Layer Projection Unit.
3. Otherwise, that means that the layer is in the same projection/unit 
of the map, there is no conversion to do.

I hope it's clear.

Alan

On 13-02-19 10:30 AM, Alan Boudreault wrote:
> Thanks Daniel for the good explanation. If everyone agree, I'll add this
> information in the RFC.
>
> Steve, in the code, if the UNITS is specified... it will be used. Else,
> I'll try to get the projection unit, and finally default to degree. Is
> this ok?
>
> Thanks,
> Alan
>
> On 13-02-19 10:12 AM, Daniel Morissette wrote:
>> Alan, All,
>>
>> As we looked into the implementation details with Alan, we found out
>> that the STYLE-level GEOMTRANSFORM receives a shape in pixel
>> coordinates, whereas the LAYER-level GEOMTRANSFORM will receive the raw
>> shape in ground coordinates (meters, degrees, etc.)
>>
>> This poses a little potential for confusion in the user's mind as the
>> argument to methods such as simplify() must be in the same units as the
>> coordinates of the shapes at that point of the rendering workflow, i.e.
>> pixels at the STYLE-level and in ground units at the LAYER-level.
>>
>> e.g.
>>
>> LAYER NAME "my_layer"
>>    TYPE LINE
>>    STATUS DEFAULT
>>    DATA "lines.shp"
>>    GEOMTRANSFORM (simplify([shape], 10))  ## 10 ground units
>>    CLASS
>>      STYLE
>>        GEOMTRANSFORM (buffer([shape], 5)  ## 5 pixels
>>        WIDTH 2
>>        COLOR 255 0 0
>>      END
>>    END
>> END
>>
>>
>> It would be possible (but messy) to include some maths at the
>> layer-level to allow passing a value in pixels at the layer level as
>> well. This way things would be consistent between STYLE level and LAYER
>> level as we would always pass args in pixels, but this may not be what
>> we want in lots of cases, for instance if a LAYER-level GEOMTRANSFORM is
>> used to simplify shapes in a WFS context where pixel size makes no or
>> little sense.
>>
>> It is also not possible at all to deal with values in ground units at
>> the style level because we do not have information about map cellsize at
>> that level in the code (so passing values in ground units at the style
>> level is not an option without messy code changes)
>>
>> Note that in cases where we want to pass a pixel value at the layer
>> level, a [map_cellsize]  variable will be available, e.g.
>>
>> LAYER NAME "my_layer"
>>    TYPE LINE
>>    STATUS DEFAULT
>>    DATA "lines.shp"
>>    # 10 * [map_cellsize] == 10 pixels converted to ground units
>>    GEOMTRANSFORM (simplify([shape], [map_cellsize]*10))
>>    ...
>>
>>
>> It seems that our best option would be to keep the values as pixels at
>> the style level and ground units at the layer level, and properly
>> document the difference, and hope that users won't be too confused.
>>
>> What do you all think?
>>
>> Daniel
>>
>>
>>
>> On 13-02-14 6:58 AM, Alan Boudreault wrote:
>>> Hi devs,
>>>
>>> Please vote on RFC 89, Layer Geomtransform (
>>> http://mapserver.org/trunk/development/rfc/ms-rfc-89.html )
>>>
>>> I'll start with my +1.
>>>
>>> Thanks,
>>> Alan
>>>
>>
>>
>
>


-- 
Alan Boudreault
http://www.mapgears.com/


More information about the mapserver-dev mailing list