Discussion:
[Geoserver-users] Repeat Labels Inside of Polygons
FunkMonkey33
2017-05-09 22:36:44 UTC
Permalink
When you zoom into a large polygon, let's say a County, you often zoom past
the label, and then you don't know what county you're in.

LineSymbolizer allows you to repeat labels, but I haven't found any way to
repeat them in a polygon. No combination of maxDisplacement or repeat in
the SLD is having the desired effect.

Extensive googling only came up with posts about labels repeating due to
being served as tiles, which is not the behavior I'm going for.

Thanks!

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Andrea Aime
2017-05-10 06:28:33 UTC
Permalink
Hi,
there is indeed no vendor option to get the behavior your want, normally
people complain about it and ask about getting rid of it, so no support
was developed to get it in untiled mode.

Anyways, patches welcomed, if you are interested I can point you at where
the action is (roughly, gt-render module down in Geotools)

Cheers
Andrea


On Wed, May 10, 2017 at 12:36 AM, FunkMonkey33 <
***@ponderosa-advisors.com> wrote:

> When you zoom into a large polygon, let's say a County, you often zoom past
> the label, and then you don't know what county you're in.
>
> LineSymbolizer allows you to repeat labels, but I haven't found any way to
> repeat them in a polygon. No combination of maxDisplacement or repeat in
> the SLD is having the desired effect.
>
> Extensive googling only came up with posts about labels repeating due to
> being served as tiles, which is not the behavior I'm going for.
>
> Thanks!
>
> Aaron
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.
> nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970.html
> Sent from the GeoServer - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo Ú consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------
Rahkonen Jukka (MML)
2017-05-10 07:19:25 UTC
Permalink
Hi,


Do I undestand right that the desire is not necessarily to get multiple labels but one label at any scale, at any region of interest?


Polygons labels are placed dynamically so with basic WMS it should not be possible to zoom past the label. The label is set to partial polygons if there are place for them. You can test with demo layer "states" with QGIS or OpenJUMP and you should experience that you can't zoom past labels. Quick test with browser:


http://localhost:8080/geoserver/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1601&HEIGHT=839&LAYERS=topp%3Astates&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-115.408,34.685,-113.877,35.487&SRS=EPSG:4326&STYLES=<http://localhost:8080/geoserver/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1601&HEIGHT=839&LAYERS=topp%3Astates&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-115.408,34.685,-113.877,35.487&SRS=EPSG:4326&STYLES>


-Jukka Rahkonen-


________________________________
Andrea Aime wrote:
Re: [Geoserver-users] Repeat Labels Inside of Polygons

Hi,
there is indeed no vendor option to get the behavior your want, normally
people complain about it and ask about getting rid of it, so no support
was developed to get it in untiled mode.

Anyways, patches welcomed, if you are interested I can point you at where
the action is (roughly, gt-render module down in Geotools)

Cheers
Andrea


On Wed, May 10, 2017 at 12:36 AM, FunkMonkey33 <***@ponderosa-advisors.com<mailto:***@ponderosa-advisors.com>> wrote:
When you zoom into a large polygon, let's say a County, you often zoom past
the label, and then you don't know what county you're in.

LineSymbolizer allows you to repeat labels, but I haven't found any way to
repeat them in a polygon. No combination of maxDisplacement or repeat in
the SLD is having the desired effect.

Extensive googling only came up with posts about labels repeating due to
being served as tiles, which is not the behavior I'm going for.

Thanks!

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
Geoserver-***@lists.sourceforge.net<mailto:Geoserver-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geoserver-users



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

-------------------------------------------------------
Andrea Aime
2017-05-10 07:24:20 UTC
Permalink
Hum... right... well, maybe the map gets so dense with labels that the
county
one does not get drawn anymore? When you are fully inside the county its
label would appear in the center of the map.

If that's the case, raising its Priority would solve that problem, just set
a value
higher than 1000 (that being the default, yes, I know, it's a weird default
value).
Of course you'd lose other labels.
Another option would be to give it a large maxDisplacement value to help it
locate a free spot that's not in the center.

Cheers
Andrea



On Wed, May 10, 2017 at 9:19 AM, Rahkonen Jukka (MML) <
***@maanmittauslaitos.fi> wrote:

> Hi,
>
>
> Do I undestand right that the desire is not necessarily to get multiple
> labels but one label at any scale, at any region of interest?
>
>
> Polygons labels are placed dynamically so with basic WMS it should not be
> possible to zoom past the label. The label is set to partial polygons if
> there are place for them. You can test with demo layer "states" with QGIS
> or OpenJUMP and you should experience that you can't zoom past labels.
> Quick test with browser:
>
>
> http://localhost:8080/geoserver/wms?REQUEST=GetMap&
> SERVICE=WMS&VERSION=1.1.1&WIDTH=1601&HEIGHT=839&LAYERS=
> topp%3Astates&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-
> 115.408,34.685,-113.877,35.487&SRS=EPSG:4326&STYLES=
> <http://localhost:8080/geoserver/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1601&HEIGHT=839&LAYERS=topp%3Astates&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-115.408,34.685,-113.877,35.487&SRS=EPSG:4326&STYLES>
>
>
> -Jukka Rahkonen-
>
>
> ------------------------------
> Andrea Aime wrote:
> Re: [Geoserver-users] Repeat Labels Inside of Polygons
>
> Hi,
> there is indeed no vendor option to get the behavior your want, normally
> people complain about it and ask about getting rid of it, so no support
> was developed to get it in untiled mode.
>
> Anyways, patches welcomed, if you are interested I can point you at where
> the action is (roughly, gt-render module down in Geotools)
>
> Cheers
> Andrea
>
>
> On Wed, May 10, 2017 at 12:36 AM, FunkMonkey33 <
> ***@ponderosa-advisors.com> wrote:
>
>> When you zoom into a large polygon, let's say a County, you often zoom
>> past
>> the label, and then you don't know what county you're in.
>>
>> LineSymbolizer allows you to repeat labels, but I haven't found any way to
>> repeat them in a polygon. No combination of maxDisplacement or repeat in
>> the SLD is having the desired effect.
>>
>> Extensive googling only came up with posts about labels repeating due to
>> being served as tiles, which is not the behavior I'm going for.
>>
>> Thanks!
>>
>> Aaron
>>
>>
>>
>> --
>> View this message in context: http://osgeo-org.1560.x6.nabbl
>> e.com/Repeat-Labels-Inside-of-Polygons-tp5319970.html
>> Sent from the GeoServer - User mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Geoserver-users mailing list
>> Geoserver-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>
>
>
> --
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054 Massarosa (LU)
> phone: +39 0584 962313 <+39%200584%20962313>
> fax: +39 0584 1660272 <+39%200584%20166%200272>
> mob: +39 339 8844549 <+39%20339%20884%204549>
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
>
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
> loro utilizzo Ú consentito esclusivamente al destinatario del messaggio,
> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
> darcene notizia via e-mail e di procedere alla distruzione del messaggio
> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
> principi dettati dal D.Lgs. 196/2003.
>
>
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender
> does not give any warranty or accept liability as the content, accuracy or
> completeness of sent messages and accepts no responsibility for changes
> made after they were sent or for other risks which arise as a result of
> e-mail transmission, viruses, etc.
>
> -------------------------------------------------------
>



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo Ú consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------
GeoUser
2017-05-10 08:16:50 UTC
Permalink
Are you using cached tiles (GWC)?



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320009.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
FunkMonkey33
2017-05-11 15:26:58 UTC
Permalink
Yes. Using GWC.

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320209.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
FunkMonkey33
2017-05-11 19:48:00 UTC
Permalink
Just to be clear,

The Subject of this post isn't what I actually want, it turns out. My bad.
I can start a new thread if you all think I should.

What I am trying to do is have one label, but always have it be visible.

I am using GWC, but will abandon it in favor of WMS if necessary.

Also, I should point out that we're using Google maps, not Open Layers. It
looks like Google provides only tiled image overlay layers. From what I've
seen from the LayerPreview pages in GeoServer, it looks like the
always-visible-ness of the labels requires that it be 1 image, not tiles.
Does that sound correct?

Thanks. And let me know if you would prefer me to start a new thread.

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320237.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
GeoUser
2017-05-12 08:55:55 UTC
Permalink
You can not have an always visible label using the GWC (cached tiles are
rather static). Use the WMS.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320299.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
FunkMonkey33
2017-05-12 16:04:30 UTC
Permalink
Thanks.

Yes, I understand that GWC won't be possible for this.

However, it looks like tiles WMS won't work either (see my comment above).

Thanks.

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320367.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
FunkMonkey33
2017-05-12 16:33:38 UTC
Permalink
I've started a new thread, with my corrected question in it:

http://osgeo-org.1560.x6.nabble.com/Always-Visible-Labels-in-Polygons-td5320370.html

Thanks everyone for your help!

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320373.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Rahkonen Jukka (MML)
2017-05-12 16:53:32 UTC
Permalink
Hi,

I can read from the documentation of vendor option "tiled=true" this:


"Meta-tiling prevents issues with duplicated labels when using a tiled client such as OpenLayers. When meta-tiling is used, images are rendered and then split into smaller tiles (by default in a 3x3 pattern) before being served. In order for meta-tiling to work, the tile size must be set to 256x256 pixels, and the tiled and tilesorigin parameters must be specified.

The tiled parameter controls whether meta-tiling is used. The syntax is:
tiled=[true|false]
To invoke meta-tiling use tiled=true."

So you explicitly set Geoserver to use 3x3 metatiles with WMS. Don't do if you do not want to prevent issues with duplicated labels. Leave out &tiled=true and you should be guaranteed to get at least enough labels, probably more because every tile will be labeled. If your labels are long you must also accept partial labels but it may be that they do not satisfy you.

This should be a test that you can reproduce:

No label in this tile
http://localhost:8080/geoserver/topp/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&tiled=true&STYLES&LAYERS=topp%3Astates&tilesOrigin=-124.73142200000001%2C24.955967&WIDTH=256&HEIGHT=256&SRS=EPSG%3A4326&BBOX=-101.513671875%2C39.462890625%2C-101.42578125%2C39.55078125

Same tile but for sure with label
http://localhost:8080/geoserver/topp/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&STYLES&LAYERS=topp%3Astates&tilesOrigin=-124.73142200000001%2C24.955967&WIDTH=256&HEIGHT=256&SRS=EPSG%3A4326&BBOX=-101.513671875%2C39.462890625%2C-101.42578125%2C39.55078125

For perfect label handling you should probably consider some other route like downloading borders as vector data that can be labeled on the client side, or something like UTFGrid. Perhaps you must change the platform by the same because Google Maps may not have advanced features.

-Jukka Rahkonen-


________________________________________
Lähettäjä: FunkMonkey33 <***@ponderosa-advisors.com>
Lähetetty: 12. toukokuuta 2017 19:04
Vastaanottaja: geoserver-***@lists.sourceforge.net
Aihe: Re: [Geoserver-users] Repeat Labels Inside of Polygons

Thanks.

Yes, I understand that GWC won't be possible for this.

However, it looks like tiles WMS won't work either (see my comment above).

Thanks.

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320367.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
Geoserver-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
FunkMonkey33
2017-05-11 15:25:36 UTC
Permalink
Hi Jukka,

You do indeed understand correctly. I don't really need multiple labels,
just I want the one label to always be visible.

I'm using GWC for this, so I think that precludes the behavior I want.

I tried doing a straight up WMS GetMap request, but so far no luck with that
either. I'll keep working with it.

Thanks.,

Aaron



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Repeat-Labels-Inside-of-Polygons-tp5319970p5320208.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Loading...