[Geoserver-users] labeling polygons

Hi Jan,

Aha. Well, I guess I should have ready the mail a bit more closely. :slight_smile:
You may want to try something like this..

Define a view in PostGIS and register it with Geoserver, something like this...

SELECT ST_PointOnSurface(the_geom) ....(rest of your columns here)...
FROM mygeometrytable

You probably would want to dump this into a table to speed up
everything, as you do not want to have to calculate this everytime you
hit the layer.

This function (unlike the centroid function) is supposed to provide a
point on or inside the surface. It has worked for me, but your mileage
may vary.

You can seen an example of this here..

Centroids

http://www.who.int/tools/geoserver/wms/kml_reflect?layers=WHO:countries_centroid

PointOnSurface

http://www.who.int/tools/geoserver/wms/kml_reflect?layers=WHO:countries_inside_points

If you look at Malaysia, the geometry returned from PointOnSurface is
actually in Western Malaysia. The centroid is out in the sea.

If you use FME, there is a function "InsidePointExtractor" that will
do the same thing and you can dump the results into another table for
performance.

Maybe this is more of what you are looking for?
Regards,
Jason

2008/9/2 <jan.rombout@anonymised.com>:

Hi Jason,
Thanks for your response.

Although it doesn't solf my problem . See also the reaction of David Winslow.
http://jira.codehaus.org/browse/GEOS-2189

Groetjes,

Jan

-----Oorspronkelijk bericht-----
Van: Jason Pickering [mailto:jason.p.pickering@anonymised.com]
Verzonden: maandag 1 september 2008 13:39
Aan: Rombout, J (Jan)
CC: geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] labeling polygons

Hi Jan,

You will need to develop SLD's and freemarker templates to control the
KML output.

I refer you to http://geoserver.org/display/GEOSDOC/KML+Placemark+Templates.

Groetjes,
Jason

On Mon, Sep 1, 2008 at 1:07 PM, <jan.rombout@anonymised.com> wrote:

Hi All,

can anybody help me?
I'm using Geoserver in combination with Google Earth.
The problem I met is labeling polygons.
I think/suspect the label position is calculated by the boundary box coordinates of the polygon.
So e.g. with curved polygons or polygons with a holes in it, labels are placed outside the polygon.

Are there options in SLD to ensure that each label is placed inside the polygon?

Thanks,

Jan
------------------------------

Deze e-mail en de inhoud daarvan is vertrouwelijk.
Het is mogelijk dat tijdens het opstellen of het transport van dit bericht fouten zijn ontstaan zodat het bericht onjuist of onvolledig is overgekomen of verkeerd is geadresseerd. Hiervoor kan ProRail geen aansprakelijkheid erkennen. Uitsluitend een document dat door een bevoegd persoon namens ProRail is ondertekend is bindend. De inhoud van dit bericht mag niet openbaar worden gemaakt, vermenigvuldigd of worden verspreid aan derden. Wij verzoeken u om bij twijfel over de juistheid, de volledigheid of de adressering de e-mail direct te retourneren en daarna te vernietigen.

This e-mail and its contents are confidential.
It is possible that during the making or transmission of this message errors have arisen, so that this message is improperly or incompletely dispatched or has wrongfully been addressed. In this case, ProRail cannot be held liable. Only a document which has been signed by an authorized person on behalf of ProRail is binding. The contents of this e-mail may not be disclosed, copied or dispatched to anyone. In case of doubt about the correctness, the completeness or the address, you are requested to reply the e-mail immediately and then destroy the e-mail.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------

Deze e-mail en de inhoud daarvan is vertrouwelijk.
Het is mogelijk dat tijdens het opstellen of het transport van dit bericht fouten zijn ontstaan zodat het bericht onjuist of onvolledig is overgekomen of verkeerd is geadresseerd. Hiervoor kan ProRail geen aansprakelijkheid erkennen. Uitsluitend een document dat door een bevoegd persoon namens ProRail is ondertekend is bindend. De inhoud van dit bericht mag niet openbaar worden gemaakt, vermenigvuldigd of worden verspreid aan derden. Wij verzoeken u om bij twijfel over de juistheid, de volledigheid of de adressering de e-mail direct te retourneren en daarna te vernietigen.

This e-mail and its contents are confidential.
It is possible that during the making or transmission of this message errors have arisen, so that this message is improperly or incompletely dispatched or has wrongfully been addressed. In this case, ProRail cannot be held liable. Only a document which has been signed by an authorized person on behalf of ProRail is binding. The contents of this e-mail may not be disclosed, copied or dispatched to anyone. In case of doubt about the correctness, the completeness or the address, you are requested to reply the e-mail immediately and then destroy the e-mail.