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

Sizes not always Pixels #36

Open
1Map opened this issue Mar 19, 2019 · 3 comments
Open

Sizes not always Pixels #36

1Map opened this issue Mar 19, 2019 · 3 comments

Comments

@1Map
Copy link

1Map commented Mar 19, 2019

Although you handle your style sizes as Pixels, that may not always be the case, for example the following means that the font size is 2 meters, not 2 pixels:

          <sld:TextSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
            <sld:Label>
              <ogc:PropertyName>unitno</ogc:PropertyName>
            </sld:Label>
            <sld:Font>
              <sld:CssParameter name="font-family">Arial</sld:CssParameter>
              <sld:CssParameter name="font-size">2</sld:CssParameter>
              <sld:CssParameter name="font-style">normal</sld:CssParameter>
              <sld:CssParameter name="font-weight">normal</sld:CssParameter>
            </sld:Font>
            <sld:LabelPlacement>
              <sld:PointPlacement>
                <sld:AnchorPoint>
                  <sld:AnchorPointX>
                    <ogc:Literal>0.5</ogc:Literal>
                  </sld:AnchorPointX>
                  <sld:AnchorPointY>
                    <ogc:Literal>0.5</ogc:Literal>
                  </sld:AnchorPointY>
                </sld:AnchorPoint>
              </sld:PointPlacement>
            </sld:LabelPlacement>
            <sld:Halo>
              <sld:Radius>
                <ogc:Literal>0.5</ogc:Literal>
              </sld:Radius>
              <sld:Fill>
                <sld:CssParameter name="fill">#FFFFFF</sld:CssParameter>
                <sld:CssParameter name="fill-opacity">0.8</sld:CssParameter>
              </sld:Fill>
            </sld:Halo>
            <sld:Fill>
              <sld:CssParameter name="fill">#000000</sld:CssParameter>
            </sld:Fill>
            <sld:VendorOption name="maxDisplacement">10</sld:VendorOption>
            <sld:VendorOption name="spaceAround">0</sld:VendorOption>
            <sld:VendorOption name="group">false</sld:VendorOption>
            <sld:VendorOption name="repeat">0</sld:VendorOption>
            <sld:VendorOption name="partials">true</sld:VendorOption>
            <sld:VendorOption name="goodnessOfFit">1</sld:VendorOption>
          </sld:TextSymbolizer>

Also the same with PolygonSymbolizer, LineSymbolizer, etc...

@Razi91
Copy link
Contributor

Razi91 commented May 25, 2020

@1Map
Copy link
Author

1Map commented May 25, 2020

Yes,

Note: the Unit-of-Measure in the SLD

uom="http://www.opengeospatial.org/se/units/metre"

@Razi91 Razi91 mentioned this issue May 25, 2020
@ajkopinga
Copy link
Member

It's technically possible to support non-pixel uom on a symbolizer, but also a lot of work.

The style function recycles OpenLayers style objects with static properties (like a line symbolizer that's always 4px wide). But when you start using meters for instance, all dimension-related symbolizer properties will have to be dynamically modified at each zoom (and possibly pan) of the map.

Furthermore, according to the SLD spec you can override any uom set on the symbolizer by appending 'px' to a property (like '5px'). This means that units of measure can be mixed within a symbolizer, which in turn means that all numeric symbolizer properties relating to dimension should keep track of their own units of measure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants