Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves the rendering of labels in polygons #778

Merged
merged 2 commits into from
Nov 9, 2018

Conversation

lgoltz
Copy link
Contributor

@lgoltz lgoltz commented Oct 12, 2016

If the requested bounding box in a GetMap request splits the geometry feature into a multpolygon (e.g. a 'banana'-geometry into the two ends of the 'banana') the label is rendered in the center of the original geometry, which may be somewhere outside the geometry (e.g. between the two ends of the 'banana').

This pull requests fixes this by calculating points into the visible parts of the geometry in the map if auto="true" is configured.

Example

<?xml version="1.0" encoding="UTF-8"?>
<FeatureTypeStyle
    version="1.1.0"
    xmlns="http://www.opengis.net/se"
    xmlns:wupp="http://www.deegree.org/app"
    xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:sed="http://www.deegree.org/se"
    xmlns:deegreeogc="http://www.deegree.org/ogc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/se http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd http://www.deegree.org/se http://schemas.deegree.org/se/1.1.0/Symbolizer-deegree.xsd">
    ...
    <Rule>
        <TextSymbolizer>
            <Label>
                <ogc:PropertyName>app:label</ogc:PropertyName>
            </Label>
            <Font>
                <SvgParameter name="font-family">Arial</SvgParameter>
            </Font>  
                         <LabelPlacement>
                <PointPlacement  auto="true">
                    <Displacement>
                        <DisplacementX>0</DisplacementX>
                        <DisplacementY>0</DisplacementY>
                    </Displacement>
                    <Rotation>0</Rotation>
                </PointPlacement>
            </LabelPlacement> 
            ...
        </TextSymbolizer>
        ...
    </Rule>
</FeatureTypeStyle>

@tfr42 tfr42 added this to the 3.4.1 milestone Oct 21, 2016
@tfr42 tfr42 added the enhancement enhancement or improvement label Oct 21, 2016
@tfr42 tfr42 added ready and removed in progress labels Apr 8, 2018
@tfr42 tfr42 modified the milestones: 3.4.1, 3.5 Jun 18, 2018
@tfr42 tfr42 modified the milestones: 3.5, 3.4.3 Jul 22, 2018
@tfr42 tfr42 modified the milestones: 3.4.3, 3.4.4 Sep 28, 2018
@copierrj copierrj merged commit b60f9c1 into deegree:master Nov 9, 2018
@lgoltz lgoltz deleted the polygonLabels-206 branch December 8, 2022 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement enhancement or improvement ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants