[Geoserver-devel] [JIRA] (GEOS-8034) YSLD to SLD conversion

M. Gone created an issue

GeoServer / BugGEOS-8034

YSLD to SLD conversion

Issue Type:

BugBug

Affects Versions:

2.10.0

Assignee:

Unassigned

Components:

REST

Created:

15/Mar/17 4:17 PM

Environment:

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 8
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 45
Stepping: 7
CPU MHz: 2493.788
BogoMIPS: 4987.57
Hypervisor vendor: Xen
Virtualization type: para
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 15360K
NUMA node0 CPU(s): 0-7

Red Hat Enterprise Linux Server release 6.5 (Santiago)
Red Hat Enterprise Linux Server release 6.5 (Santiago)
cpe:/o:redhat:enterprise_linux:6server:ga:server

GeoTools Version:16.0
Java version:1.8

Priority:

HighHigh

Reporter:

M. Gone

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><name>$style_name</name><format>ysld</format><filename>$style_name.yaml</filename><languageVersion><version>1.0.0</version></languageVersion></style>” 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:Name>test</sld:Name>
<sld:UserStyle>
<sld:Name>Test</sld:Name>
<sld:Title>Test Style</sld:Title>
<sld:Abstract>Styling abstract desc.</sld:Abstract>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:Title>raster</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: Null; Invalid color, must be one of ‘#RRGGBB’, rgb(r,g,b), or expression: in ‘reader’ line 14, column 14:- java.awt.Color[r=226,g=3,b=116] …

It seems that something goes wrong during conversion.

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v1000.824.2#100035-sha1:a97671d)

Atlassian logo