[Geoserver-devel] get Min/Max feature and pass it as argument for an other function

Hi everyone,

I m working on a function that I will use in Geoserver which get a feature as input and return a color code to fill a polygon.

I have 4 others paramters : min,max,saturation and brightness.
Concerning the min and the max I’d like not to hardcode them but get it directly from the attribute.

I found theses 2 functions :

https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/function/Collection_MaxFunction.java

https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/function/Collection_MinFunction.java

Any idea about how I can use them ? I mean it would be cool if I could get a max value and a min value from these function and use them as parameter for the function which calculate and return the color.

Thank you All.

···

Matthieu BONVENTI

Those are “aggregate” functions … used by clients to process a feature collection. You are correct that they are often used to generate metrics about a dataset, which are then used to construct an appropriate style.

There is actually a while color brewer workflow that involves generating styles for a dataset:

http://docs.geotools.org/stable/userguide/extension/brewer/colorbrewer.html

···

On 29 January 2015 at 05:59, Bonventi Matthieu <matthieu.bonventi@anonymised.com> wrote:

Hi everyone,

I m working on a function that I will use in Geoserver which get a feature as input and return a color code to fill a polygon.

I have 4 others paramters : min,max,saturation and brightness.
Concerning the min and the max I’d like not to hardcode them but get it directly from the attribute.

I found theses 2 functions :

https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/function/Collection_MaxFunction.java

https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/function/Collection_MinFunction.java

Any idea about how I can use them ? I mean it would be cool if I could get a max value and a min value from these function and use them as parameter for the function which calculate and return the color.

Thank you All.

Matthieu BONVENTI


Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/


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


Jody Garnett

On Thu, Jan 29, 2015 at 2:59 PM, Bonventi Matthieu <
matthieu.bonventi@anonymised.com> wrote:

Any idea about how I can use them ? I mean it would be cool if I could get
a max value and a min value from these function and use them as parameter
for the function which calculate and return the color.

Not so easy though... the issue is that you cannot pass the whole feature
collection to a filter function in a style,
they are always fed feature by feature.

Also, computing the min/max value would be rather expensive to do on a call
by call basis, and would also
return different values every time, because the feature collection the
renderer gets is relative only
to the current bbox.

Long story short, it's better to pre-compute these values (against the
whole dataset, and once
for all).
One idea that might work would be to have a GeoServer extension that
computes the extrema
values on the full dataset periodically, or event based, and attach them to
the layer info/resource info
metadata map, and then have another extension that feeds these values into
the env function,
for the styles to pick up at runtime.
Just thinking out loud.

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.

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

" return different values every time, because the feature collection the renderer gets is relative only
to the current bbox."

Actually that’s what I want.
For example when you use the Heatmap process when you zoom in there is a kind of rescaling to match the zone you are zooming into.
I would like to have this kind of effect with the Choropleth map. Each time I zoom the min value and max value change and the colors of polygons recompute for the current zoom level.

I don’t even know if it is possible that s why I wanted to ask on the mailing list

Best regards
Matthieu Bonventi

      1. 오후 4:15에 “Andrea Aime” <andrea.aime@anonymised.com>님이 작성:
···

On Thu, Jan 29, 2015 at 2:59 PM, Bonventi Matthieu <matthieu.bonventi@anonymised.com> wrote:

Any idea about how I can use them ? I mean it would be cool if I could get a max value and a min value from these function and use them as parameter for the function which calculate and return the color.

Not so easy though… the issue is that you cannot pass the whole feature collection to a filter function in a style,
they are always fed feature by feature.

Also, computing the min/max value would be rather expensive to do on a call by call basis, and would also
return different values every time, because the feature collection the renderer gets is relative only
to the current bbox.

Long story short, it’s better to pre-compute these values (against the whole dataset, and once
for all).
One idea that might work would be to have a GeoServer extension that computes the extrema
values on the full dataset periodically, or event based, and attach them to the layer info/resource info
metadata map, and then have another extension that feeds these values into the env function,
for the styles to pick up at runtime.
Just thinking out loud.

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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 Fri, Jan 30, 2015 at 4:59 PM, Bonventi Matthieu <
matthieu.bonventi@anonymised.com> wrote:

" return different values every time, because the feature collection the
renderer gets is relative only
to the current bbox."

Actually that's what I want.
For example when you use the Heatmap process when you zoom in there is a
kind of rescaling to match the zone you are zooming into.
I would like to have this kind of effect with the Choropleth map. Each
time I zoom the min value and max value change and the colors of polygons
recompute for the current zoom level.

I don't even know if it is possible that s why I wanted to ask on the
mailing list

I see... but no, there is no way to give anything in the style a view of
the entire collection being
processed.

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.

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

By the way, forgot one thing… there is a function that can see the whole collection, it’s the rendering
transformation one.
So I guess if you wanted, you could use that one to do the computation, and bake directly into the
attributes the color you want, and then in the style you just pick the color.

See also: http://docs.geoserver.org/2.5.x/en/developer/programming-guide/wps-services/implement-rendertrans.html

Cheers
Andrea

···

On Fri, Jan 30, 2015 at 4:15 PM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Thu, Jan 29, 2015 at 2:59 PM, Bonventi Matthieu <matthieu.bonventi@anonymised.com…> wrote:

Any idea about how I can use them ? I mean it would be cool if I could get a max value and a min value from these function and use them as parameter for the function which calculate and return the color.

Not so easy though… the issue is that you cannot pass the whole feature collection to a filter function in a style,
they are always fed feature by feature.

Also, computing the min/max value would be rather expensive to do on a call by call basis, and would also
return different values every time, because the feature collection the renderer gets is relative only
to the current bbox.

Long story short, it’s better to pre-compute these values (against the whole dataset, and once
for all).
One idea that might work would be to have a GeoServer extension that computes the extrema
values on the full dataset periodically, or event based, and attach them to the layer info/resource info
metadata map, and then have another extension that feeds these values into the env function,
for the styles to pick up at runtime.
Just thinking out loud.

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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/NWWaa2 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.


That is a good idea … although this is probably the whole collection for the current bounding box. All we would have to do is be able to assign the result to an environment variable to complete the workflow.

···

On 30 January 2015 at 08:14, Andrea Aime <andrea.aime@anonymised.com> wrote:

By the way, forgot one thing… there is a function that can see the whole collection, it’s the rendering
transformation one.
So I guess if you wanted, you could use that one to do the computation, and bake directly into the
attributes the color you want, and then in the style you just pick the color.

See also: http://docs.geoserver.org/2.5.x/en/developer/programming-guide/wps-services/implement-rendertrans.html

Cheers

Andrea


Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/


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


Jody Garnett

On Fri, Jan 30, 2015 at 4:15 PM, Andrea Aime <andrea.aime@anonymised.com> wrote:

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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 Thu, Jan 29, 2015 at 2:59 PM, Bonventi Matthieu <matthieu.bonventi@anonymised.com> wrote:

Any idea about how I can use them ? I mean it would be cool if I could get a max value and a min value from these function and use them as parameter for the function which calculate and return the color.

Not so easy though… the issue is that you cannot pass the whole feature collection to a filter function in a style,
they are always fed feature by feature.

Also, computing the min/max value would be rather expensive to do on a call by call basis, and would also
return different values every time, because the feature collection the renderer gets is relative only
to the current bbox.

Long story short, it’s better to pre-compute these values (against the whole dataset, and once
for all).
One idea that might work would be to have a GeoServer extension that computes the extrema
values on the full dataset periodically, or event based, and attach them to the layer info/resource info
metadata map, and then have another extension that feeds these values into the env function,
for the styles to pick up at runtime.
Just thinking out loud.

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.


Yes…It is a bit difficult for me, I will try to figure it out something. I will keep you in touch if I found something out.

Best regards

Matthieu Bonventi

      1. 오후 8:54에 “Jody Garnett” <jody.garnett@anonymised.com>님이 작성:
···


Jody Garnett

On 30 January 2015 at 08:14, Andrea Aime <andrea.aime@anonymised.com> wrote:

By the way, forgot one thing… there is a function that can see the whole collection, it’s the rendering
transformation one.
So I guess if you wanted, you could use that one to do the computation, and bake directly into the
attributes the color you want, and then in the style you just pick the color.

See also: http://docs.geoserver.org/2.5.x/en/developer/programming-guide/wps-services/implement-rendertrans.html

Cheers

Andrea


Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

On Fri, Jan 30, 2015 at 4:15 PM, Andrea Aime <andrea.aime@anonymised.com> wrote:

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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 Thu, Jan 29, 2015 at 2:59 PM, Bonventi Matthieu <matthieu.bonventi@anonymised.com> wrote:

Any idea about how I can use them ? I mean it would be cool if I could get a max value and a min value from these function and use them as parameter for the function which calculate and return the color.

Not so easy though… the issue is that you cannot pass the whole feature collection to a filter function in a style,
they are always fed feature by feature.

Also, computing the min/max value would be rather expensive to do on a call by call basis, and would also
return different values every time, because the feature collection the renderer gets is relative only
to the current bbox.

Long story short, it’s better to pre-compute these values (against the whole dataset, and once
for all).
One idea that might work would be to have a GeoServer extension that computes the extrema
values on the full dataset periodically, or event based, and attach them to the layer info/resource info
metadata map, and then have another extension that feeds these values into the env function,
for the styles to pick up at runtime.
Just thinking out loud.

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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 Fri, Jan 30, 2015 at 8:53 PM, Jody Garnett <jody.garnett@anonymised.com>
wrote:

That is a good idea ... although this is probably the whole collection for
the current bounding box. All we would have to do is be able to assign the
result to an environment variable to complete the workflow.

If you want to go that way yes... otherwise you just extend the feature
type with a "color" attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector
and vice versa), adding an
attribute is kind of light lifting for it :wink:

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.

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

Hello Andrea,Jody,

I am back to work and I just want to check something.
First, let’s back to the problem, The process will be :

1/ get dataset through the ‘data’ paramter of the tranformation function
2/ access the all data collection to get be able to get the min and the max
3/ compute the hue color code
4/ return it to the sld where I call the function I made 2 weeks ago to color it

Basically If I understood, The tranformation process get the data set, compute something and send it back to the symbolizer.

Secondly, You told me I should use the tranformation process one. So you mean I have to use the heatmap ? I read the code and find

@DescribeProcess(title = "Heatmap", description = "Computes a heatmap surface over a set of irregular data points as a GridCoverage.")
public class HeatmapProcess implements GSProcess {

    @DescribeResult(name = "result", description = "The heat map surface as a raster")
    public GridCoverage2D execute(

            // process data
            @DescribeParameter(name = "data", description = "Features containing the data points") SimpleFeatureCollection obsFeatures

So I should be able to get the min and max from obsFeatures right ? My question is what I have to put instead of GridCoverage2D Because Actually I don't want any tranformation, just compute a value using the min and max of the collection and return that value to the sld to proceed with the coloration ?

I hope I don’t bother your with all these questions but at the end maybe we will have a dynamic Choropleth map, interesting isn’t it ?

Best regards :wink:

···

2015-01-30 21:44 GMT+01:00 Andrea Aime <andrea.aime@anonymised.com>:

On Fri, Jan 30, 2015 at 8:53 PM, Jody Garnett <jody.garnett@anonymised.com> wrote:

That is a good idea … although this is probably the whole collection for the current bounding box. All we would have to do is be able to assign the result to an environment variable to complete the workflow.

If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it :wink:

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.


Matthieu BONVENTI

Plus, how can I access the current feature to code the color ? I mean what I need to contribute the new attribute is the current value,the min and the max.

···

2015-02-09 11:33 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

Hello Andrea,Jody,

I am back to work and I just want to check something.
First, let’s back to the problem, The process will be :

1/ get dataset through the ‘data’ paramter of the tranformation function
2/ access the all data collection to get be able to get the min and the max
3/ compute the hue color code
4/ return it to the sld where I call the function I made 2 weeks ago to color it

Basically If I understood, The tranformation process get the data set, compute something and send it back to the symbolizer.

Secondly, You told me I should use the tranformation process one. So you mean I have to use the heatmap ? I read the code and find

@DescribeProcess(title = "Heatmap", description = "Computes a heatmap surface over a set of irregular data points as a GridCoverage.")
public class HeatmapProcess implements GSProcess {

    @DescribeResult(name = "result", description = "The heat map surface as a raster")
    public GridCoverage2D execute(

            // process data
            @DescribeParameter(name = "data", description = "Features containing the data points") SimpleFeatureCollection obsFeatures

So I should be able to get the min and max from obsFeatures right ? My question is what I have to put instead of GridCoverage2D Because Actually I don't want any tranformation, just compute a value using the min and max of the collection and return that value to the sld to proceed with the coloration ?

I hope I don’t bother your with all these questions but at the end maybe we will have a dynamic Choropleth map, interesting isn’t it ?

Best regards :wink:

2015-01-30 21:44 GMT+01:00 Andrea Aime <andrea.aime@anonymised.com>:

Matthieu BONVENTI

On Fri, Jan 30, 2015 at 8:53 PM, Jody Garnett <jody.garnett@anonymised.com> wrote:

That is a good idea … although this is probably the whole collection for the current bounding box. All we would have to do is be able to assign the result to an environment variable to complete the workflow.

If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it :wink:

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.


Matthieu BONVENTI

I think I don’t understand how the whole thing is functionning . I try to code , the first part is :

@DescribeProcess(title = “DynamicColorCompute”, description = “xxxx”)
public class DynamicColorCompute implements GSProcess {

@DescribeResult(name = “result”, description = “xxx”)
public SimpleFeatureCollection execute(

// process data
@DescribeParameter(name = “data”, description = “Features containing the data points”) SimpleFeatureCollection obsFeatures, ProgressListener progressListener)

throws ProcessException {

FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

Expression = ff.property(obsFeatures);
MaxVisitor maxVisitor = new MaxVisitor(expression);
collection.accepts(maxVisitor, null);
CalcResult resultmax = maxVisitor.getResult();

Object max = resultmax.getValue();

MinVisitor minVisitor = new MinVisitor(expression);
collection.accepts(minVisitor, null);
CalcResult resultmin = minVisitor.getResult();

Object min = resultmin.getValue();

}

}

Is it the right way to get the min value and max value ? But how can I connect it with that part of code (which need to have a value as input with the min and max) :

private Color getRGBcolor(float value,float minValue,float maxValue,float saturation,float brightness) {
float hue = (value - minValue) / (maxValue - minValue);
if (hue < 0.0f || hue > 1.0f) {
return null;
}

int rgb = Color.HSBtoRGB(adjustedGradient(hue), saturation, brightness);
return new Color(rgb);
}

private float adjustedGradient(float hue) {

return hue * 0.32f;
}

···

2015-02-09 12:10 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

Plus, how can I access the current feature to code the color ? I mean what I need to contribute the new attribute is the current value,the min and the max.

2015-02-09 11:33 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com03…>:

Hello Andrea,Jody,

I am back to work and I just want to check something.
First, let’s back to the problem, The process will be :

1/ get dataset through the ‘data’ paramter of the tranformation function
2/ access the all data collection to get be able to get the min and the max
3/ compute the hue color code
4/ return it to the sld where I call the function I made 2 weeks ago to color it

Basically If I understood, The tranformation process get the data set, compute something and send it back to the symbolizer.

Secondly, You told me I should use the tranformation process one. So you mean I have to use the heatmap ? I read the code and find

@DescribeProcess(title = "Heatmap", description = "Computes a heatmap surface over a set of irregular data points as a GridCoverage.")
public class HeatmapProcess implements GSProcess {

    @DescribeResult(name = "result", description = "The heat map surface as a raster")
    public GridCoverage2D execute(

            // process data
            @DescribeParameter(name = "data", description = "Features containing the data points") SimpleFeatureCollection obsFeatures

So I should be able to get the min and max from obsFeatures right ? My question is what I have to put instead of GridCoverage2D Because Actually I don't want any tranformation, just compute a value using the min and max of the collection and return that value to the sld to proceed with the coloration ?

I hope I don’t bother your with all these questions but at the end maybe we will have a dynamic Choropleth map, interesting isn’t it ?

Best regards :wink:

Matthieu BONVENTI

2015-01-30 21:44 GMT+01:00 Andrea Aime <andrea.aime@anonymised.com>:

Matthieu BONVENTI

On Fri, Jan 30, 2015 at 8:53 PM, Jody Garnett <jody.garnett@…403…> wrote:

That is a good idea … although this is probably the whole collection for the current bounding box. All we would have to do is be able to assign the result to an environment variable to complete the workflow.

If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it :wink:

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.


Matthieu BONVENTI

‘If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it ;-)’

It seems simple to you but not for me…I am on the same poblem for weeks now And I am still not able to get some results, I hope you will be able to help me :wink:

Thank you

···

2015-02-09 13:03 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

I think I don’t understand how the whole thing is functionning . I try to code , the first part is :

@DescribeProcess(title = “DynamicColorCompute”, description = “xxxx”)
public class DynamicColorCompute implements GSProcess {

@DescribeResult(name = “result”, description = “xxx”)
public SimpleFeatureCollection execute(

// process data
@DescribeParameter(name = “data”, description = “Features containing the data points”) SimpleFeatureCollection obsFeatures, ProgressListener progressListener)

throws ProcessException {

FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

Expression = ff.property(obsFeatures);
MaxVisitor maxVisitor = new MaxVisitor(expression);
collection.accepts(maxVisitor, null);
CalcResult resultmax = maxVisitor.getResult();

Object max = resultmax.getValue();

MinVisitor minVisitor = new MinVisitor(expression);
collection.accepts(minVisitor, null);
CalcResult resultmin = minVisitor.getResult();

Object min = resultmin.getValue();

}

}

Is it the right way to get the min value and max value ? But how can I connect it with that part of code (which need to have a value as input with the min and max) :

private Color getRGBcolor(float value,float minValue,float maxValue,float saturation,float brightness) {
float hue = (value - minValue) / (maxValue - minValue);
if (hue < 0.0f || hue > 1.0f) {
return null;
}

int rgb = Color.HSBtoRGB(adjustedGradient(hue), saturation, brightness);
return new Color(rgb);
}

private float adjustedGradient(float hue) {

return hue * 0.32f;
}

2015-02-09 12:10 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

Plus, how can I access the current feature to code the color ? I mean what I need to contribute the new attribute is the current value,the min and the max.

Matthieu BONVENTI

2015-02-09 11:33 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

Hello Andrea,Jody,

I am back to work and I just want to check something.
First, let’s back to the problem, The process will be :

1/ get dataset through the ‘data’ paramter of the tranformation function
2/ access the all data collection to get be able to get the min and the max
3/ compute the hue color code
4/ return it to the sld where I call the function I made 2 weeks ago to color it

Basically If I understood, The tranformation process get the data set, compute something and send it back to the symbolizer.

Secondly, You told me I should use the tranformation process one. So you mean I have to use the heatmap ? I read the code and find

@DescribeProcess(title = "Heatmap", description = "Computes a heatmap surface over a set of irregular data points as a GridCoverage.")
public class HeatmapProcess implements GSProcess {

    @DescribeResult(name = "result", description = "The heat map surface as a raster")
    public GridCoverage2D execute(

            // process data
            @DescribeParameter(name = "data", description = "Features containing the data points") SimpleFeatureCollection obsFeatures

So I should be able to get the min and max from obsFeatures right ? My question is what I have to put instead of GridCoverage2D Because Actually I don't want any tranformation, just compute a value using the min and max of the collection and return that value to the sld to proceed with the coloration ?

I hope I don’t bother your with all these questions but at the end maybe we will have a dynamic Choropleth map, interesting isn’t it ?

Best regards :wink:

Matthieu BONVENTI

2015-01-30 21:44 GMT+01:00 Andrea Aime <andrea.aime@anonymised.com>:

Matthieu BONVENTI

On Fri, Jan 30, 2015 at 8:53 PM, Jody Garnett <jody.garnett@…403…> wrote:

That is a good idea … although this is probably the whole collection for the current bounding box. All we would have to do is be able to assign the result to an environment variable to complete the workflow.

If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it :wink:

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.


Matthieu BONVENTI

Hello, (forgot to check answer all)

Sorry to bother you.

I am still trying to figure out something to get the minimum and maximum value of the feature collection and calculate the color.

I am a beginner so I understood only 50% of what you said in mails. I am trying to understand how geotools function and processes work but I only got headaches until now.

What you told me was to use a transformation process to get access the whole collection.

“By the way, forgot one thing… there is a function that can see the whole collection, it’s the rendering
transformation one.
So I guess if you wanted, you could use that one to do the computation, and bake directly into the
attributes the color you want, and then in the style you just pick the color.”

I didn’t understand what did you mean there. How I can get the current value (of the polygon I want to fill with a color), the current max and the current min to compute a color code ?

I think I missed something somewhere. In the SLD I will have a which takes juste one argument ? (My feature collection) and a which I will use to fill the polygon. But how do I get the value from the transformation process to till the polygon with a certain color. I mean could you possibly explain me the whole process with simple words and examples ? Because I can’t get it.

Again sorry to bother you,
Thank you very much

···

2015-02-09 13:21 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

'If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an

attribute is kind of light lifting for it ;-)’

It seems simple to you but not for me…I am on the same poblem for weeks now And I am still not able to get some results, I hope you will be able to help me :wink:

Thank you

2015-02-09 13:03 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com03…>:

I think I don’t understand how the whole thing is functionning . I try to code , the first part is :

@DescribeProcess(title = “DynamicColorCompute”, description = “xxxx”)
public class DynamicColorCompute implements GSProcess {

@DescribeResult(name = “result”, description = “xxx”)
public SimpleFeatureCollection execute(

// process data
@DescribeParameter(name = “data”, description = “Features containing the data points”) SimpleFeatureCollection obsFeatures, ProgressListener progressListener)

throws ProcessException {

FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

Expression = ff.property(obsFeatures);
MaxVisitor maxVisitor = new MaxVisitor(expression);
collection.accepts(maxVisitor, null);
CalcResult resultmax = maxVisitor.getResult();

Object max = resultmax.getValue();

MinVisitor minVisitor = new MinVisitor(expression);
collection.accepts(minVisitor, null);
CalcResult resultmin = minVisitor.getResult();

Object min = resultmin.getValue();

}

}

Is it the right way to get the min value and max value ? But how can I connect it with that part of code (which need to have a value as input with the min and max) :

private Color getRGBcolor(float value,float minValue,float maxValue,float saturation,float brightness) {
float hue = (value - minValue) / (maxValue - minValue);
if (hue < 0.0f || hue > 1.0f) {
return null;
}

int rgb = Color.HSBtoRGB(adjustedGradient(hue), saturation, brightness);
return new Color(rgb);
}

private float adjustedGradient(float hue) {

return hue * 0.32f;
}

Matthieu BONVENTI

2015-02-09 12:10 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

Plus, how can I access the current feature to code the color ? I mean what I need to contribute the new attribute is the current value,the min and the max.

Matthieu BONVENTI

2015-02-09 11:33 GMT+01:00 Bonventi Matthieu <matthieu.bonventi@anonymised.com>:

Hello Andrea,Jody,

I am back to work and I just want to check something.
First, let’s back to the problem, The process will be :

1/ get dataset through the ‘data’ paramter of the tranformation function
2/ access the all data collection to get be able to get the min and the max
3/ compute the hue color code
4/ return it to the sld where I call the function I made 2 weeks ago to color it

Basically If I understood, The tranformation process get the data set, compute something and send it back to the symbolizer.

Secondly, You told me I should use the tranformation process one. So you mean I have to use the heatmap ? I read the code and find

@DescribeProcess(title = "Heatmap", description = "Computes a heatmap surface over a set of irregular data points as a GridCoverage.")
public class HeatmapProcess implements GSProcess {

    @DescribeResult(name = "result", description = "The heat map surface as a raster")
    public GridCoverage2D execute(

            // process data
            @DescribeParameter(name = "data", description = "Features containing the data points") SimpleFeatureCollection obsFeatures

So I should be able to get the min and max from obsFeatures right ? My question is what I have to put instead of GridCoverage2D Because Actually I don't want any tranformation, just compute a value using the min and max of the collection and return that value to the sld to proceed with the coloration ?

I hope I don’t bother your with all these questions but at the end maybe we will have a dynamic Choropleth map, interesting isn’t it ?

Best regards :wink:

Matthieu BONVENTI

2015-01-30 21:44 GMT+01:00 Andrea Aime <andrea.aime@anonymised.com>:

Matthieu BONVENTI

On Fri, Jan 30, 2015 at 8:53 PM, Jody Garnett <jody.garnett@…403…> wrote:

That is a good idea … although this is probably the whole collection for the current bounding box. All we would have to do is be able to assign the result to an environment variable to complete the workflow.

If you want to go that way yes… otherwise you just extend the feature type with a “color” attribute and use
it directly in the style.
A rendering transformation can do worse things (change raster into vector and vice versa), adding an
attribute is kind of light lifting for it :wink:

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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.


Matthieu BONVENTI