[Geoserver-users] Problem with YSLD ColorMapEntry from YAML file.

Dear List,
We are using Geoserver REST API to upload and attach yaml style files to layers. A sample yaml file looks like this:

name: Test
title: Test Style title
abstract: Styling of Test layer
feature-styles:

  • rules:
  • title: raster
    symbolizers:
  • raster:
    opacity: 1.0
    color-map:
    type: values
    entries:
  • [‘#e20374’, 1.0, 1, Lorem Ipsum (magenta = covered)]

We use the following curl commands to upload the style:

Creating Style
curl -u “$credentials” -XPOST -H “Content-type: text/xml” -d “$style_nameysld$style_name.yaml1.0.0” http://host:8081/geoserver/rest/workspaces/$workspace_name/styles

Update the style with uploaded style info
curl -u $credentials -XPUT -H “Content-type: application/vnd.geoserver.ysld+yaml” --data-binary @$style_name.yaml http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name

Check result:
curl -u $credentials -XGET http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name.sld?pretty=true

<?xml version="1.0" encoding="UTF-8"?>

<sld:StyledLayerDescriptor xmlns=“http://www.opengis.net/sld” xmlns:sld=“http://www.opengis.net/sld” xmlns:gml=“http://www.opengis.net/gml” xmlns:ogc=“http://www.opengis.net/ogc” version=“1.0.0”>
sld:NamedLayer
sld:Nametest</sld:Name>
sld:UserStyle
sld:NameTest</sld:Name>
sld:TitleTest Style</sld:Title>
sld:AbstractStyling abstract desc.</sld:Abstract>
sld:FeatureTypeStyle
sld:Rule
sld:Titleraster</sld:Title>
sld:RasterSymbolizer
<sld:ColorMap type=“values”>
<sld:ColorMapEntry color=“java.awt.Color[r=226,g=3,b=116]” opacity=“1.0” quantity=“1” label=“lorem ipsum (magenta = covered)”/>
</sld:ColorMapEntry>
sld:ContrastEnhancement/
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>

As can be seen, #e20374 is converted to java.awt.Color instead of the same ‘#e20374’ literal. When I manually edit the yaml file in geoserver (i.e replace java.awt.Color[r=226,g=3,b=116] with #e20374) , I get the correct styling.

However, if I use the the java color ( java.awt.Color[r=226,g=3,b=116]****), I get the following error

It seems that something goes wrong during conversion. Does anyone know the cause of this problem?

Regards,
Moses

Hi Moses,
this is most likely a minor bug in the YSLD to SLD conversion.

SLD parser will not chew a Java color.

Picture (Device Independent Bitmap) 2.jpg

Picture (Device Independent Bitmap) 1.jpg

···

On Wed, Mar 15, 2017 at 11:03 AM, <Moses.Gone@anonymised.com> wrote:

Dear List,
We are using Geoserver REST API to upload and attach yaml style files to layers. A sample yaml file looks like this:

name: Test
title: Test Style title
abstract: Styling of Test layer
feature-styles:

  • rules:
  • title: raster
    symbolizers:
  • raster:
    opacity: 1.0
    color-map:
    type: values
    entries:
  • [‘#e20374’, 1.0, 1, Lorem Ipsum (magenta = covered)]

We use the following curl commands to upload the style:

Creating Style
curl -u “$credentials” -XPOST -H “Content-type: text/xml” -d “$style_nameysld$style_name.yaml1.0.0” http://host:8081/geoserver/rest/workspaces/$workspace_name/styles

Update the style with uploaded style info
curl -u $credentials -XPUT -H “Content-type: application/vnd.geoserver.ysld+yaml” --data-binary @$style_name.yaml http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name

Check result:
curl -u $credentials -XGET http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name.sld?pretty=true

<?xml version="1.0" encoding="UTF-8"?>

<sld:StyledLayerDescriptor xmlns=“http://www.opengis.net/sld” xmlns:sld=“http://www.opengis.net/sld” xmlns:gml=“http://www.opengis.net/gml” xmlns:ogc=“http://www.opengis.net/ogc” version=“1.0.0”>
sld:NamedLayer
sld:Nametest</sld:Name>
sld:UserStyle
sld:NameTest</sld:Name>
sld:TitleTest Style</sld:Title>
sld:AbstractStyling abstract desc.</sld:Abstract>
sld:FeatureTypeStyle
sld:Rule
sld:Titleraster</sld:Title>
sld:RasterSymbolizer
<sld:ColorMap type=“values”>
<sld:ColorMapEntry color=“java.awt.Color[r=226,g=3,b=116]” opacity=“1.0” quantity=“1” label=“lorem ipsum (magenta = covered)”/>
</sld:ColorMapEntry>
sld:ContrastEnhancement/
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>

As can be seen, #e20374 is converted to java.awt.Color instead of the same ‘#e20374’ literal. When I manually edit the yaml file in geoserver (i.e replace java.awt.Color[r=226,g=3,b=116] with #e20374) , I get the correct styling.

However, if I use the the java color ( java.awt.Color[r=226,g=3,b=116]****), I get the following error

It seems that something goes wrong during conversion. Does anyone know the cause of this problem?

Regards,
Moses


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


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

Regards,
Simone Giannecchini

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

Ing. Simone Giannecchini
@simogeo
Founder/Director

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

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 Simone,

Thanks a lot, I have raised an issue on this: https://osgeo-org.atlassian.net/browse/GEOS-8034?filter=-4

Regards,

Moses

Picture (Device Independent Bitmap) 1.jpg

Picture (Device Independent Bitmap) 2.jpg

···

From: Simone Giannecchini [mailto:simone.giannecchini@…1107…]
Sent: Mittwoch, 15. März 2017 12:47
To: Gone, Moses
Cc: geoserver-users
Subject: Re: [Geoserver-users] Problem with YSLD ColorMapEntry from YAML file.

Hi Moses,

this is most likely a minor bug in the YSLD to SLD conversion.

SLD parser will not chew a Java color.

Regards,
Simone Giannecchini

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

Ing. Simone Giannecchini
@simogeo
Founder/Director

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

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 Wed, Mar 15, 2017 at 11:03 AM, <Moses.Gone@…3945…> wrote:

Dear List,

We are using Geoserver REST API to upload and attach yaml style files to layers. A sample yaml file looks like this:

name: Test

title: Test Style title

abstract: Styling of Test layer

feature-styles:

  • rules:

  • title: raster

symbolizers:

  • raster:

opacity: 1.0

color-map:

type: values

entries:

  • [‘#e20374’, 1.0, 1, Lorem Ipsum (magenta = covered)]

We use the following curl commands to upload the style:

Creating Style

curl -u “$credentials” -XPOST -H “Content-type: text/xml” -d “$style_nameysld$style_name.yaml1.0.0” http://host:8081/geoserver/rest/workspaces/$workspace_name/styles

Update the style with uploaded style info

curl -u $credentials -XPUT -H “Content-type: application/vnd.geoserver.ysld+yaml” --data-binary @$style_name.yaml http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name

Check result:

curl -u $credentials -XGET http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name.sld?pretty=true

<?xml version="1.0" encoding="UTF-8"?>

<sld:StyledLayerDescriptor xmlns=“http://www.opengis.net/sld” xmlns:sld=“http://www.opengis.net/sld” xmlns:gml=“http://www.opengis.net/gml” xmlns:ogc=“http://www.opengis.net/ogc” version=“1.0.0”>

sld:NamedLayer

sld:Nametest</sld:Name>

sld:UserStyle

sld:NameTest</sld:Name>

sld:TitleTest Style</sld:Title>

sld:AbstractStyling abstract desc.</sld:Abstract>

sld:FeatureTypeStyle

sld:Rule

sld:Titleraster</sld:Title>

sld:RasterSymbolizer

<sld:ColorMap type=“values”>

<sld:ColorMapEntry color=“java.awt.Color[r=226,g=3,b=116]” opacity=“1.0” quantity=“1” label=“lorem ipsum (magenta = covered)”/>

</sld:ColorMapEntry>

sld:ContrastEnhancement/

</sld:RasterSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

</sld:NamedLayer>

</sld:StyledLayerDescriptor>

As can be seen, #e20374 is converted to java.awt.Color instead of the same ‘#e20374’ literal. When I manually edit the yaml file in geoserver (i.e replace java.awt.Color[r=226,g=3,b=116] with #e20374) , I get the correct styling.

However, if I use the the java color ( java.awt.Color[r=226,g=3,b=116]), I get the following error

It seems that something goes wrong during conversion. Does anyone know the cause of this problem?

Regards,

Moses


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


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

Thanks, I have updated the formatting.

I had a look here and it kind of agreed with your email, let’s move discussion to the bug report.

String yaml =
“raster: \n” +
" color-map:\n" +
" type: values\n" +
" entries:\n" +
" - “+tuple(”#ff0000", “1.0”, “0”, “start”)+“\n” +
" - “+tuple(”#00ff00", “1.0”, “500”, “middle”)+“\n” +
" - “+tuple(”#0000ff", “1.0”, “1000”, “end”)+“\n” +
“”;

Picture (Device Independent Bitmap) 1.jpg

···

On 15 March 2017 at 08:21, <Moses.Gone@anonymised.com> wrote:

Hi Simone,

Thanks a lot, I have raised an issue on this: https://osgeo-org.atlassian.net/browse/GEOS-8034?filter=-4

Regards,

Moses

From: Simone Giannecchini [mailto:simone.giannecchini@geo-solutions.it]
Sent: Mittwoch, 15. März 2017 12:47
To: Gone, Moses
Cc: geoserver-users
Subject: Re: [Geoserver-users] Problem with YSLD ColorMapEntry from YAML file.

Hi Moses,

this is most likely a minor bug in the YSLD to SLD conversion.

SLD parser will not chew a Java color.

Regards,
Simone Giannecchini

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

Ing. Simone Giannecchini
@simogeo
Founder/Director

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

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 Wed, Mar 15, 2017 at 11:03 AM, <Moses.Gone@anonymised.com> wrote:

Dear List,

We are using Geoserver REST API to upload and attach yaml style files to layers. A sample yaml file looks like this:

name: Test

title: Test Style title

abstract: Styling of Test layer

feature-styles:

  • rules:

  • title: raster

symbolizers:

  • raster:

opacity: 1.0

color-map:

type: values

entries:

  • [‘#e20374’, 1.0, 1, Lorem Ipsum (magenta = covered)]

We use the following curl commands to upload the style:

Creating Style

curl -u “$credentials” -XPOST -H “Content-type: text/xml” -d “$style_nameysld$style_name.yaml1.0.0” http://host:8081/geoserver/rest/workspaces/$workspace_name/styles

Update the style with uploaded style info

curl -u $credentials -XPUT -H “Content-type: application/vnd.geoserver.ysld+yaml” --data-binary @$style_name.yaml http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name

Check result:

curl -u $credentials -XGET http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name.sld?pretty=true

<?xml version="1.0" encoding="UTF-8"?>

<sld:StyledLayerDescriptor xmlns=“http://www.opengis.net/sld” xmlns:sld=“http://www.opengis.net/sld” xmlns:gml=“http://www.opengis.net/gml” xmlns:ogc=“http://www.opengis.net/ogc” version=“1.0.0”>

sld:NamedLayer

sld:Nametest</sld:Name>

sld:UserStyle

sld:NameTest</sld:Name>

sld:TitleTest Style</sld:Title>

sld:AbstractStyling abstract desc.</sld:Abstract>

sld:FeatureTypeStyle

sld:Rule

sld:Titleraster</sld:Title>

sld:RasterSymbolizer

<sld:ColorMap type=“values”>

<sld:ColorMapEntry color=“java.awt.Color[r=226,g=3,b=116]” opacity=“1.0” quantity=“1” label=“lorem ipsum (magenta = covered)”/>

</sld:ColorMapEntry>

sld:ContrastEnhancement/

</sld:RasterSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

</sld:NamedLayer>

</sld:StyledLayerDescriptor>

As can be seen, #e20374 is converted to java.awt.Color instead of the same ‘#e20374’ literal. When I manually edit the yaml file in geoserver (i.e replace java.awt.Color[r=226,g=3,b=116] with #e20374) , I get the correct styling.

However, if I use the the java color ( java.awt.Color[r=226,g=3,b=116]), I get the following error

It seems that something goes wrong during conversion. Does anyone know the cause of this problem?

Regards,

Moses


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


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


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


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


Jody Garnett