[Geoserver-users] TR : Line label placement improvement


Hi Andrea, hi list,

We would like to submit a patch to improve line label placement in Geotools.

We are producing maps with a lot of street names using Geoserver. We noticed that many labels could not be placed because areas used to manage conflicts are quite big when labels follow diagonal directions.

We decided to manage the label index using “letters” bounding boxes rather than “label” bounding boxes. This improve noticeably the number of placed labels (it is not possible to tell how many more as it is highly data-dependant). The performance penalty does not seem very high (indeed, we could not really measure it).

Currently, we have implemented the change as a vendor option named “letterConflictEnabled”. But if the code is good enough, it could also replace the current one at some point.

Please, let us know if you’re interested by this patch. It includes some unit tests and can be submitted as a PullRequest on the current GeoTools 14-SNAPSHOT.
Here attached is a small document explaining the change.

Michaël Michaud and Mathieu Lemarchand for
Institut Géographique National (France)

ImproveLabelPlacement.pdf (93.8 KB)

Hi Michael,
I’ve been hoping to find the time to do something similar for quite a while now, so this is certainly welcomed.
I’d suggest you make a pull request with these changes enabled by default, and maybe have a system variable to disable
it in case we find situations in which the performance slowdown is noticeable?

Cheers
Andrea

···

On Mon, Aug 24, 2015 at 10:22 AM, Michael Michaud <Michael.Michaud@anonymised.com> wrote:


Hi Andrea, hi list,

We would like to submit a patch to improve line label placement in Geotools.

We are producing maps with a lot of street names using Geoserver. We noticed that many labels could not be placed because areas used to manage conflicts are quite big when labels follow diagonal directions.

We decided to manage the label index using “letters” bounding boxes rather than “label” bounding boxes. This improve noticeably the number of placed labels (it is not possible to tell how many more as it is highly data-dependant). The performance penalty does not seem very high (indeed, we could not really measure it).

Currently, we have implemented the change as a vendor option named “letterConflictEnabled”. But if the code is good enough, it could also replace the current one at some point.

Please, let us know if you’re interested by this patch. It includes some unit tests and can be submitted as a PullRequest on the current GeoTools 14-SNAPSHOT.
Here attached is a small document explaining the change.

Michaël Michaud and Mathieu Lemarchand for
Institut Géographique National (France)



Geoserver-users mailing list
Geoserver-users@anonymised.comsts.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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.


Oh, forgot, the feature freeze in in 4 days, after that, the pull request will be merged against the GeoTools 15.x/GeoServer 2.9.x series

Cheers
Andrea

···

On Mon, Aug 24, 2015 at 10:35 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi Michael,
I’ve been hoping to find the time to do something similar for quite a while now, so this is certainly welcomed.
I’d suggest you make a pull request with these changes enabled by default, and maybe have a system variable to disable
it in case we find situations in which the performance slowdown is noticeable?

Cheers
Andrea

On Mon, Aug 24, 2015 at 10:22 AM, Michael Michaud <Michael.Michaud@anonymised.com> wrote:


Hi Andrea, hi list,

We would like to submit a patch to improve line label placement in Geotools.

We are producing maps with a lot of street names using Geoserver. We noticed that many labels could not be placed because areas used to manage conflicts are quite big when labels follow diagonal directions.

We decided to manage the label index using “letters” bounding boxes rather than “label” bounding boxes. This improve noticeably the number of placed labels (it is not possible to tell how many more as it is highly data-dependant). The performance penalty does not seem very high (indeed, we could not really measure it).

Currently, we have implemented the change as a vendor option named “letterConflictEnabled”. But if the code is good enough, it could also replace the current one at some point.

Please, let us know if you’re interested by this patch. It includes some unit tests and can be submitted as a PullRequest on the current GeoTools 14-SNAPSHOT.
Here attached is a small document explaining the change.

Michaël Michaud and Mathieu Lemarchand for
Institut Géographique National (France)



Geoserver-users mailing list
Geoserver-users@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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.


==
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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.


Hi Andrea,

OK, I changed the way to activate the option (vendorOption → system variable), but I can’t create a pull request. I get the following error from my IDE:

Push failed:
unable to access ‘https://github.com/geotools/geotools/’: The requested URL returned error: 403

Maybe I should have created my fork on github first instead of checking out directly from geotools/geotools ?

I’ll try this tomorrow. Now that I removed the vendor option, there is only one file changed (out of test files)

Cheers,

Michaël

···

On Mon, Aug 24, 2015 at 10:22 AM, Michael Michaud <Michael.Michaud@anonymised.com> wrote:


Hi Andrea, hi list,

We would like to submit a patch to improve line label placement in Geotools.

We are producing maps with a lot of street names using Geoserver. We noticed that many labels could not be placed because areas used to manage conflicts are quite big when labels follow diagonal directions.

We decided to manage the label index using “letters” bounding boxes rather than “label” bounding boxes. This improve noticeably the number of placed labels (it is not possible to tell how many more as it is highly data-dependant). The performance penalty does not seem very high (indeed, we could not really measure it).

Currently, we have implemented the change as a vendor option named “letterConflictEnabled”. But if the code is good enough, it could also replace the current one at some point.

Please, let us know if you’re interested by this patch. It includes some unit tests and can be submitted as a PullRequest on the current GeoTools 14-SNAPSHOT.
Here attached is a small document explaining the change.

Michaël Michaud and Mathieu Lemarchand for
Institut Géographique National (France)



Geoserver-users mailing list
Geoserver-users@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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.


On Mon, Aug 24, 2015 at 8:34 PM, Michael Michaud <Michael.Michaud@anonymised.com.>
wrote:

Hi Andrea,

OK, I changed the way to activate the option (vendorOption -> system
variable), but I can't create a pull request. I get the following error
from my IDE:

Push failed:
unable to access 'https://github.com/geotools/geotools/': The requested
URL returned error: 403

You are trying to push to the main repository, this is not a pull requset
:slight_smile:

Maybe I should have created my fork on github first instead of checking
out directly from geotools/geotools ?

You should create your fork, push your branch there, and then from that
one,
you'll be able to make a pull request (just check your project's github
page after
pushing the branch)

More info on the internet, e.g., here:
https://help.github.com/articles/creating-a-pull-request/

Cheers
Andrea

--

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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.

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

Hi,

Thank you for the help,
I think you get the pull request now.

I added a static variable DISABLE_LETTER_LEVEL_CONFLICT in LabelCacheImpl to be able to disable the new behaviour from system property “org.geotools.labelcache.disableLetterLevelConflict”.
It should probably be final but I needed to switch the option on and off in the unit tests.

Let us know if there is something else we can do to validate the patch.

Michaël

···

On Mon, Aug 24, 2015 at 8:34 PM, Michael Michaud <Michael.Michaud@anonymised.com> wrote:

Hi Andrea,

OK, I changed the way to activate the option (vendorOption → system variable), but I can’t create a pull request. I get the following error from my IDE:

Push failed:
unable to access ‘https://github.com/geotools/geotools/’: The requested URL returned error: 403

You are trying to push to the main repository, this is not a pull requset :slight_smile:

Maybe I should have created my fork on github first instead of checking out directly from geotools/geotools ?

You should create your fork, push your branch there, and then from that one,
you’ll be able to make a pull request (just check your project’s github page after
pushing the branch)

More info on the internet, e.g., here:
https://help.github.com/articles/creating-a-pull-request/

Cheers
Andrea

==
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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.


I a going to assume this is your pull request here (https://github.com/geotools/geotools/pull/948). We should probably be discussing it on geotools list. Let me review quickly now …

···

On 25 August 2015 at 08:58, Michael Michaud <Michael.Michaud@anonymised.com> wrote:

Hi,

Thank you for the help,
I think you get the pull request now.

I added a static variable DISABLE_LETTER_LEVEL_CONFLICT in LabelCacheImpl to be able to disable the new behaviour from system property “org.geotools.labelcache.disableLetterLevelConflict”.
It should probably be final but I needed to switch the option on and off in the unit tests.

Let us know if there is something else we can do to validate the patch.

Michaël


De : andrea.aime@anonymised.com [andrea.aime@anonymised.com] de la part de Andrea Aime [andrea.aime@anonymised.com]
Date d’envoi : lundi 24 août 2015 20:37
À : Michael Michaud
Cc : geoserver-users@lists.sourceforge.net; Mathieu Lemarchand; Arnaud Braun
Objet : Re: RE : [Geoserver-users] TR : Line label placement improvement



Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Jody Garnett

On Mon, Aug 24, 2015 at 8:34 PM, Michael Michaud <Michael.Michaud@anonymised.com> wrote:

Hi Andrea,

OK, I changed the way to activate the option (vendorOption → system variable), but I can’t create a pull request. I get the following error from my IDE:

Push failed:
unable to access ‘https://github.com/geotools/geotools/’: The requested URL returned error: 403

You are trying to push to the main repository, this is not a pull requset :slight_smile:

Maybe I should have created my fork on github first instead of checking out directly from geotools/geotools ?

You should create your fork, push your branch there, and then from that one,
you’ll be able to make a pull request (just check your project’s github page after
pushing the branch)

More info on the internet, e.g., here:
https://help.github.com/articles/creating-a-pull-request/

Cheers
Andrea

==
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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.