On Tue, Nov 2, 2010 at 4:01 PM, Sveen Atle Frenvik (Geomatikk IKT) <[email protected]> wrote: > Hello all. > > Excuse me if this topic has been dealt with before, but I couldn't find > any relevant information on this. > > I have a case where I want to display an external graphic on top of a > line geometry. The grahpic is used to indicate certain properties of the > line. > > Anyways: I quickly found out that, for labels (i.e. textSymbolizers) > this was easy, make a rule with both a LineSymbolizer and a > TextSymbolizers. The label seems to be drawn on the centerpoint of the > visible part of the line (and, most important: on _top_ of the line). > > Following this line of thought i tried using the same approach with a > PointSymbolizer (in this case with a Graphic, but the plan is an > ExternalGraphic). > In this case however, with a LineSymbolizer and a PointSymbolizer in the > same rule, the graphic is drawn at what seems to be the center if the > line is converted to a polygon: i.e. for curved lines not on top of the > line, but in the vinciity. > > See the attached image for how the PointSymolizer and TextSymbolizer > places its content relative to the line (the x is a TextSymbolizerm the > dot is a PointSymbolizer). > > The SLD I'm currently using is atteched beneath. > > So, the question is if it is possible to use a PointSymbolizer to draw > it's content in the same position (relative to a line) as the > TextSymbolizer does. The easy solution would of course be to use a > TextSymbolizer instead, but we kinda require an icon on the, which calls > for a PointSymbolizer. > > And, more out of interest: another question is wether the difference > between Points and Text relative to lines are on purpose, or just > something that noone has thought of?
We basically just followed the SLD spec to the letter. For point symbolizers it is said: "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." What we did was just to pick the centroid no matter what the geometry is. For lines we could indeed have picked the midpoint instead, was just more work to calculate it compared to the centroid, for which we have a ready made JTS routine. If you want to contribute a patch changing the behavior for lines I can show you the java code that currently extracts the centroid Cheers Andrea ----------------------------------------------------- Ing. Andrea Aime Senior Software Engineer GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584962313 fax: +39 0584962313 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ----------------------------------------------------- ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ Geoserver-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
