M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Staff
Posts: 1,131
Registered: ‎10-18-2015
Accepted Solution

Label placement

[ Edited ]

Hi guys,

 

I'm not sure what is wrong with the style editor. I can only see labels placed in the middle of a polygon already defined in old styles. When I try to create the same style on top of the same feature I always get no labels displayed (either in the preview and on the map). The only placement is always working is the "line placement".

 

thanks,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Highlighted
Technical Evangelist
Posts: 148
Registered: ‎10-20-2015

Re: Label placement

[ Edited ]

Hi Stefano,

at the moment your requirement is not supported out of the box.

I check the OpenGIS Symbology Encoding (Document  #05-077r4) which defines the following:

 

#05-077r4 - 11.4.4 Text Symbolizer - Label placement - Page 31

For a PointPlacement, the anchor point of the label and a linear displacement from the point can be specified, to allow a graphic Symbolizer to be plotted directly at the point. This might be useful to label a city, for example

.....

#05-077r4 - 11.4.1 Text Symbolizer -  Page 30

These elements are discussed below, except for the Geometry and Fill elements, which were discussed in Subclauses 11.1.2 and 11.2.2, respectively. The geometry type is interpreted as being either a point or a line as needed by the LabelPlacement discussed in Subclause 11.4.4. If the given geometry is not of point or line type as appropriate, it shall be transformed into the appropriate type as discussed in Subclause 11.3.1 for point or Subclause 12.1.2 for line.

...

#05-077r4 - 11.3.1 Point Symbolizer - Format - Page 23

 

The Geometry element is discussed in Subclause 11.1.2. In this case, if a line, polygon, or raster geometry is used with this Symbolizer, then the semantic is to use the centroid of the geometry, or any similar representative point. The Graphic element is described below. It may occur multiple times so that a point Symbolizer may be composed of multiple graphics.

.....

 

It seems that "Subclause 12.1.2 for line" is a mistake... the correct Subclause is 11.1.2

 

#05-077r4 - 11.1.2 LineSymbolizer - Geometry - Page 15

Geometry types other than inherently linear types can also be used. If a point geometry is used, it should be interpreted as a line of “epsilon” (arbitrarily small) length with a horizontal orientation centered on the point, and should be rendered with two end caps. If a polygon is used (or other “area” type), then its closed outline is used as the line string (with no end caps)

...

 

Here is an example usage of this element, referencing a property of a feature called “centerline”:

 

<Geometry>
 <ogc:PropertyName>centerline</ogc:PropertyName>
</Geometry>

 

The centroid calculation could be a quick fix. I've found a good illustration for the centroid calculation.

 centroid.PNG

 

This should help you to decide if the automatic centroid conversion would help you at your project or if you need a pre-process which generates the dedicated points.

 

The advantage of the pre-processing would be the fact that this allows you to change the position of points where the centroid is outside of the polygon and generating a beautiful map.

 

Best Regards,
Steve 

Highlighted
Staff
Posts: 1,131
Registered: ‎10-18-2015

Re: Label placement

thanks Steve.

 

ciao,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial