## geotools-devel

 [Geotools-devel] SLD, PointSymbolizer and multi geometries From: Andrea Aime - 2010-03-26 16:37:27 Attachments: california_points.png ```Hi, I was looking at a specific issue making maps with both point a polygon symbolizers. One such map is attached as an example. The map contains a single geometry, a multipolygon representing the state of California. As you can see the state has islands, each of them covered by a point. Now, I'm questioning whether this is proper behavior or not... the spec says: --------------------------------------------------- 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. --------------------------------------------------- It says "the centroid". As in, one. Imho the proper behavior would be to extract a single centroid, not to split the geometry and compute (and draw) a centroid per polygon. That centroid... what would it be though? The centroid of a group of polygons might not fall inside one of the polygons at all. So... the centroid of the biggest polygon maybe? The same would go for multi lines. Multi points imho should be drawn like they are, that is, one point symbol for each point in the multipoint. Another approach could be to tell people to use a geometry transformation function that extract the centroid. But we should make one that ensures decent behavior even in the case of multipolygons... thus, a rendering oriented fuction. I find all this a bit confusing. What is other people opinion? Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ```
 Re: [Geotools-devel] SLD, PointSymbolizer and multi geometries From: Ian Turton - 2010-03-26 18:08:33 ```On Fri, Mar 26, 2010 at 12:37 PM, Andrea Aime wrote: > Hi, > I was looking at a specific issue making maps with > both point a polygon symbolizers. > One such map is attached as an example. > > The map contains a single geometry, a multipolygon > representing the state of California. > As you can see the state has islands, each of them > covered by a point. > Now, I'm questioning whether this is proper behavior > or not... the spec says: > > --------------------------------------------------- > 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. > --------------------------------------------------- > > It says "the centroid". As in, one. > Imho the proper behavior would be to extract a single > centroid, not to split the geometry and compute > (and draw) a centroid per polygon. > That centroid... what would it be though? > The centroid of a group of polygons might not fall > inside one of the polygons at all. > So... the centroid of the biggest polygon maybe? > The centroid of the collection is my guess (after all the centroid of a polygon doesn't necessarily fall in the polygon anyway). Ian -- Ian Turton ```
 Re: [Geotools-devel] SLD, PointSymbolizer and multi geometries From: Christian Müller - 2010-03-27 05:34:26 ```ASFAIK, the centorid of geometry is not guaranteed to be within the geometry. As an example, s simple Polygon with a shape like the letter "U" has its centroid not on the surface. There is a operation "pointOnSurface" you should use. For multipolygons, I use an additional Multipoint geometry initialized with points on the surface for each polygon. This mp attribute is referenced in the sld. Ian Turton writes: > On Fri, Mar 26, 2010 at 12:37 PM, Andrea Aime wrote: >> Hi, >> I was looking at a specific issue making maps with >> both point a polygon symbolizers. >> One such map is attached as an example. >> >> The map contains a single geometry, a multipolygon >> representing the state of California. >> As you can see the state has islands, each of them >> covered by a point. >> Now, I'm questioning whether this is proper behavior >> or not... the spec says: >> >> --------------------------------------------------- >> 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. >> --------------------------------------------------- >> >> It says "the centroid". As in, one. >> Imho the proper behavior would be to extract a single >> centroid, not to split the geometry and compute >> (and draw) a centroid per polygon. >> That centroid... what would it be though? >> The centroid of a group of polygons might not fall >> inside one of the polygons at all. >> So... the centroid of the biggest polygon maybe? >> > > The centroid of the collection is my guess (after all the centroid of > a polygon doesn't necessarily fall in the polygon anyway). > > Ian > -- > Ian Turton > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Geotools-devel mailing list > Geotools-devel@... > https://lists.sourceforge.net/lists/listinfo/geotools-devel ```
 Re: [Geotools-devel] SLD, PointSymbolizer and multi geometries From: Michael Bedward - 2010-03-27 02:17:45 ```At the risk of spec heresy I don't think it makes any sense to plot a single point for a MultiPolygon which has disjunct parts. Any way of implementing it, such as point in largest component polygon, is arbitrary. It seems more natural, and much more useful, to draw the centroid for each component polygon. Michael ```
 Re: [Geotools-devel] SLD, PointSymbolizer and multi geometries From: Andrea Aime - 2010-03-27 07:35:30 ```Michael Bedward ha scritto: > At the risk of spec heresy I don't think it makes any sense to plot a > single point for a MultiPolygon which has disjunct parts. Any way of > implementing it, such as point in largest component polygon, is > arbitrary. > > It seems more natural, and much more useful, to draw the centroid for > each component polygon. I see your point. Let me explain mine:say you are using point symbolizer to stick a pie chart on top of that multipolygon using the gt-chart module. How many charts per state do you want? :-) But yeah, there is a legitimate case for both. I guess I'll roll a geometry transformation function that turns a geometry, whatever that is, into a single point, guaranteed to be inside or at most on the border of the geometry. How should we call it? "LabelPoint" function? Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ```
 Re: [Geotools-devel] SLD, PointSymbolizer and multi geometries From: Michael Bedward - 2010-03-27 08:42:17 ```On 27 March 2010 18:35, Andrea Aime wrote: > I see your point. Let me explain mine:say you are using point > symbolizer to stick a pie chart on top of that multipolygon using > the gt-chart module. How many charts per state do you want? :-) > A good (ahem) point :-) > How should we call it? "LabelPoint" function? Yes, I like that name. Michael ```