This is desired output:
I am trying to construct the point at the top of each polygon (visible part of polygon) and point label to it.
EDIT:
How to get Y coordinate of the top of the visible polygon? I tried to combine the getY functions with the env function and the predefined variable wms_bbox but I didn't get the bbox from each polygon, I get the bbox from the whole visible image.
Here is part of my code, there is no validation or preview errors.
The grid is shown on the map but no labels are displayed
<TextSymbolizer>
<Geometry>
<ogc:Function name="geomFromWKT">
<ogc:Function name="Concatenate">
<ogc:Literal>POINT(</ogc:Literal>
<ogc:Function name="getX">
<ogc:Function name="centroid">
<ogc:PropertyName>geom</ogc:PropertyName>
</ogc:Function>
</ogc:Function>
<ogc:Literal><![CDATA[ ]]></ogc:Literal>
<ogc:Function name="getY">
<ogc:Function name="env">
<ogc:Literal>wms_bbox</ogc:Literal>
<ogc:PropertyName>geom</ogc:PropertyName>
</ogc:Function>
</ogc:Function>
<ogc:Literal>)</ogc:Literal>
</ogc:Function>
</ogc:Function>
</Geometry>
<Label>
<ogc:PropertyName>date</ogc:PropertyName>
</Label>
centroid
(but slower) - you need to change yourY
coordinate to be the top of the visible polygon - you'll want to add 1/2 the polygon height or the distance to the top of the map which ever is smaller.