W3C home > Mailing lists > Public > www-svg@w3.org > November 2012

Re: Label Point of Polygons

From: Andreas Neumann <a.neumann@carto.net>
Date: Mon, 19 Nov 2012 11:21:38 +0100
To: <www-svg@w3.org>
Message-ID: <6cbcde1da1d6f2e34fc6f11f67c59645@carto.net>
 Hi,

 Thanks Doug for bringing this up again.

 If we can implement something like in [4] as a label point, it would be 
 great.

 The other problem we need to solve, is what happens when a single SVG 
 path is made of multiple polygons. Do we only expose the label point of 
 the biggest polygon or one for each sub-path? IMO this should be 
 user-configurable.

 I will see if I can invite OSGeo people to join the discussion.

 Andreas



 On Sun, 18 Nov 2012 17:17:13 -0500, Doug Schepers wrote:
> Hi, folks-
>
> During the SVG WG F2F in Rigi-Kaltbad, Switzerland, while discussing
> various topics around mapping, we had a diversion into some of the
> problems of labeling [1], including the idea of exposing the centroid
> of a polygon via a keyword and/or API, so authors could use it as a
> label point (among other uses).
>
> But, as noted during that meeting, the centroid is not always a good
> label point, because of what I'll call the "Florida Problem":
> sometimes, the centroid of a shape is outside the boundaries of the
> shape [2].
>
> There are various ways to improve this. One mapping app (Manifold)
> addresses this by having several different "centroids": Centroids;
> Centroids (Box); Centroids (Inner); and Centroids (Weight) [3]. Each
> has benefits and downsides, which means that none is totally suitable
> for a completely automated solution.
>
> But digging a bit more, I found an alternate model that seems fairly
> robust [4]. Basically, if you find the maximal inscribed circle 
> (i.e.,
> the largest circle that will fit into the polygon), the centerpoint 
> of
> that circle will have the best chance of being the ideal label point
> [5][6].
>
> However, this may (or may not) be computationally expensive... a
> little more digging suggested various techniques for doing this [6],
> including using Voronoi tessellation.
>
> I'm not sure of next steps here, but I thought I'd mention what I
> found so far, in case it inspires someone. I do think this is
> something that could be very useful, and not just for mapping.
>
> Thoughts?
>
> [1] http://www.w3.org/2012/09/19-svg-minutes.html#item07
> [2] http://www.georeference.org/doc/images/eg_centroids_inner_02.gif
> [3] http://www.georeference.org/doc/transform_centroids.htm
> [4] http://trac.osgeo.org/mapserver/ticket/606
> [5] 
> http://trac.osgeo.org/mapserver/attachment/ticket/606/fl_circle.png
> [6]
> 
> http://stackoverflow.com/questions/3953623/is-there-an-simple-algorithm-for-calculating-maximum-inscribed-circle-into-a-con
>
> Regards-
> -Doug

-- 
 --
 Andreas Neumann
 Böschacherstrasse 10A
 8624 GrĂ¼t (Gossau ZH)
 Switzerland
Received on Monday, 19 November 2012 10:22:22 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:52 GMT