SLD for styling RGB raster as grayscale

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SLD for styling RGB raster as grayscale

Jon Britton-4

Hi,

 

We need to be able to provide a grayscale version of one of our map layers, however there isn’t an obvious way to do this. It easy to produce a single-band grayscale image, e.g.:

 

<RasterSymbolizer>

    <Opacity>0.6</Opacity>

    <ChannelSelection>

        <GrayChannel>

            <SourceChannelName>1</SourceChannelName>

        </GrayChannel>

    </ChannelSelection>

</RasterSymbolizer>

 

However I need to include all bands. Is there a way to do this using an SLD without pre-processing the data? The image is RGB.

 

Thanks,

 

Jon



Jon Britton 
Software Engineer, Delivery Team


0121 232 8007

07920101956

[hidden email] 

Dotted Eyes Logo      

TwitterLinkedIn

 T: +44 (0) 121 232 8050 |  E: [hidden email] |  W: www.field-dynamics.co.uk



Field Dynamics is a trading name of Dotted Eyes Solutions Ltd. Registered office: 67-71 Northwood Street, Birmingham, B3 1TX. Company registration number: 9506624.


This message may contain confidential and privileged information. If you are not the intended recipient, please accept our apologies. Please do not disclose, copy or distribute information in this email or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Please inform us that this message has gone astray before deleting it. Dotted Eyes Solutions Limited have taken precautions to minimize the risk of transmitting software viruses, however we advise you to carry out your own virus checks on any attachment to this message.




_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD for styling RGB raster as grayscale

jratike80

Hi,

 

How about making a new layer through coverage view https://docs.geoserver.org/latest/en/user/data/raster/coverageview.html?

A grayscale image from RGB might get better if different weights are applied to input bands but I do not know if it is possible with coverage views.

 

-Jukka Rahkonen-

 

Lähettäjä: Jon Britton [mailto:[hidden email]]
Lähetetty: 8. tammikuuta 2019 10:59
Vastaanottaja: [hidden email]
Aihe: [Geoserver-users] SLD for styling RGB raster as grayscale

 

Hi,

 

We need to be able to provide a grayscale version of one of our map layers, however there isn’t an obvious way to do this. It easy to produce a single-band grayscale image, e.g.:

 

<RasterSymbolizer>

    <Opacity>0.6</Opacity>

    <ChannelSelection>

        <GrayChannel>

            <SourceChannelName>1</SourceChannelName>

        </GrayChannel>

    </ChannelSelection>

</RasterSymbolizer>

 

However I need to include all bands. Is there a way to do this using an SLD without pre-processing the data? The image is RGB.

 

Thanks,

 

Jon

 

Jon Britton 
Software Engineer, Delivery Team

0121 232 8007

07920101956

[hidden email] 

 

Dotted Eyes Logo      

Twitter

LinkedIn

 

 T: +44 (0) 121 232 8050 |  E: [hidden email] |  W: www.field-dynamics.co.uk



Field Dynamics is a trading name of Dotted Eyes Solutions Ltd. Registered office: 67-71 Northwood Street, Birmingham, B3 1TX. Company registration number: 9506624.


This message may contain confidential and privileged information. If you are not the intended recipient, please accept our apologies. Please do not disclose, copy or distribute information in this email or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Please inform us that this message has gone astray before deleting it. Dotted Eyes Solutions Limited have taken precautions to minimize the risk of transmitting software viruses, however we advise you to carry out your own virus checks on any attachment to this message.

 



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD for styling RGB raster as grayscale

Lubomír Bucek
Hi, 
in coverage view, different wieghts to bands could be achieved by utilizing a raster algebra through Ras:Jiffle added in GeoServer version 2.14. https://docs.geoserver.org/stable/en/user/styling/sld/extensions/rendering-transform.html#running-map-algebra-on-the-fly-using-jiffle 
The script itself would look something like: 
<ogc:Literal>
    first = src[0];
    second = src[1];
    third = src[2];
    dest = (3*first + 4*second + 5*third) / 12;
</ogc:Literal>
Lubomir Bucek

Hi,

 

How about making a new layer through coverage view https://docs.geoserver.org/latest/en/user/data/raster/coverageview.html?

A grayscale image from RGB might get better if different weights are applied to input bands but I do not know if it is possible with coverage views.

 

-Jukka Rahkonen-

 

Lähettäjä: Jon Britton [mailto:[hidden email]]
Lähetetty: 8. tammikuuta 2019 10:59
Vastaanottaja: [hidden email]
Aihe: [Geoserver-users] SLD for styling RGB raster as grayscale

 

Hi,

 

We need to be able to provide a grayscale version of one of our map layers, however there isn’t an obvious way to do this. It easy to produce a single-band grayscale image, e.g.:

 

<RasterSymbolizer>

    <Opacity>0.6</Opacity>

    <ChannelSelection>

        <GrayChannel>

            <SourceChannelName>1</SourceChannelName>

        </GrayChannel>

    </ChannelSelection>

</RasterSymbolizer>

 

However I need to include all bands. Is there a way to do this using an SLD without pre-processing the data? The image is RGB.

 

Thanks,

 

Jon

 

Jon Britton 
Software Engineer, Delivery Team

0121 232 8007

07920101956

[hidden email] 

 

Dotted Eyes Logo      

Twitter

LinkedIn

 

 T: +44 (0) 121 232 8050 |  E: [hidden email] |  W: www.field-dynamics.co.uk



Field Dynamics is a trading name of Dotted Eyes Solutions Ltd. Registered office: 67-71 Northwood Street, Birmingham, B3 1TX. Company registration number: 9506624.


This message may contain confidential and privileged information. If you are not the intended recipient, please accept our apologies. Please do not disclose, copy or distribute information in this email or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Please inform us that this message has gone astray before deleting it. Dotted Eyes Solutions Limited have taken precautions to minimize the risk of transmitting software viruses, however we advise you to carry out your own virus checks on any attachment to this message.

 

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD for styling RGB raster as grayscale

geowolf
In reply to this post by jratike80
Hi,
coverage views at the moment only allow for band combinations... I think that Jon wants to do is to extract the L component of
the image in HSL space... which should be doable using Jiffle, if one has a recent enough version of GeoServer, the math is here:


and a reference to Jiffle here:


Mind, I did not try it out, but it seems it would be a viable approach

Cheers
Andrea

On Tue, Jan 8, 2019 at 10:50 AM Rahkonen Jukka (MML) <[hidden email]> wrote:

Hi,

 

How about making a new layer through coverage view https://docs.geoserver.org/latest/en/user/data/raster/coverageview.html?

A grayscale image from RGB might get better if different weights are applied to input bands but I do not know if it is possible with coverage views.

 

-Jukka Rahkonen-

 

Lähettäjä: Jon Britton [mailto:[hidden email]]
Lähetetty: 8. tammikuuta 2019 10:59
Vastaanottaja: [hidden email]
Aihe: [Geoserver-users] SLD for styling RGB raster as grayscale

 

Hi,

 

We need to be able to provide a grayscale version of one of our map layers, however there isn’t an obvious way to do this. It easy to produce a single-band grayscale image, e.g.:

 

<RasterSymbolizer>

    <Opacity>0.6</Opacity>

    <ChannelSelection>

        <GrayChannel>

            <SourceChannelName>1</SourceChannelName>

        </GrayChannel>

    </ChannelSelection>

</RasterSymbolizer>

 

However I need to include all bands. Is there a way to do this using an SLD without pre-processing the data? The image is RGB.

 

Thanks,

 

Jon

 

Jon Britton 
Software Engineer, Delivery Team

0121 232 8007

07920101956

[hidden email] 

 

Dotted Eyes Logo      

Twitter

LinkedIn

 

 T: +44 (0) 121 232 8050 |  E: [hidden email] |  W: www.field-dynamics.co.uk



Field Dynamics is a trading name of Dotted Eyes Solutions Ltd. Registered office: 67-71 Northwood Street, Birmingham, B3 1TX. Company registration number: 9506624.


This message may contain confidential and privileged information. If you are not the intended recipient, please accept our apologies. Please do not disclose, copy or distribute information in this email or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Please inform us that this message has gone astray before deleting it. Dotted Eyes Solutions Limited have taken precautions to minimize the risk of transmitting software viruses, however we advise you to carry out your own virus checks on any attachment to this message.

 

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--

Regards, Andrea Aime == 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 ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD for styling RGB raster as grayscale

geowolf
In reply to this post by Lubomír Bucek
Interesting,
besides Luminosity and this formula, looks like there are other various options too, e.g:

Cheers
Andrea


On Tue, Jan 8, 2019 at 11:01 AM Lubomír Bucek <[hidden email]> wrote:
Hi, 
in coverage view, different wieghts to bands could be achieved by utilizing a raster algebra through Ras:Jiffle added in GeoServer version 2.14. https://docs.geoserver.org/stable/en/user/styling/sld/extensions/rendering-transform.html#running-map-algebra-on-the-fly-using-jiffle 
The script itself would look something like: 
<ogc:Literal>
    first = src[0];
    second = src[1];
    third = src[2];
    dest = (3*first + 4*second + 5*third) / 12;
</ogc:Literal>
Lubomir Bucek
---------- Původní e-mail ----------
Od: Rahkonen Jukka (MML) <[hidden email]>
Komu: Jon Britton <[hidden email]>, [hidden email] <[hidden email]>
Datum: 8. 1. 2019 10:47:27
Předmět: Re: [Geoserver-users] SLD for styling RGB raster as grayscale

Hi,

 

How about making a new layer through coverage view https://docs.geoserver.org/latest/en/user/data/raster/coverageview.html?

A grayscale image from RGB might get better if different weights are applied to input bands but I do not know if it is possible with coverage views.

 

-Jukka Rahkonen-

 

Lähettäjä: Jon Britton [mailto:[hidden email]]
Lähetetty: 8. tammikuuta 2019 10:59
Vastaanottaja: [hidden email]
Aihe: [Geoserver-users] SLD for styling RGB raster as grayscale

 

Hi,

 

We need to be able to provide a grayscale version of one of our map layers, however there isn’t an obvious way to do this. It easy to produce a single-band grayscale image, e.g.:

 

<RasterSymbolizer>

    <Opacity>0.6</Opacity>

    <ChannelSelection>

        <GrayChannel>

            <SourceChannelName>1</SourceChannelName>

        </GrayChannel>

    </ChannelSelection>

</RasterSymbolizer>

 

However I need to include all bands. Is there a way to do this using an SLD without pre-processing the data? The image is RGB.

 

Thanks,

 

Jon

 

Jon Britton 
Software Engineer, Delivery Team

0121 232 8007

07920101956

[hidden email] 

 

Dotted Eyes Logo      

Twitter

LinkedIn

 

 T: +44 (0) 121 232 8050 |  E: [hidden email] |  W: www.field-dynamics.co.uk



Field Dynamics is a trading name of Dotted Eyes Solutions Ltd. Registered office: 67-71 Northwood Street, Birmingham, B3 1TX. Company registration number: 9506624.


This message may contain confidential and privileged information. If you are not the intended recipient, please accept our apologies. Please do not disclose, copy or distribute information in this email or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Please inform us that this message has gone astray before deleting it. Dotted Eyes Solutions Limited have taken precautions to minimize the risk of transmitting software viruses, however we advise you to carry out your own virus checks on any attachment to this message.

 

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--

Regards, Andrea Aime == 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 ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users