Re: [Geoserver-users] Trouble with dynamically generated SLD

2018-05-15 Thread Martin Davis
You can also read the Geoserver SLD Reference docs, which describe the
element ordering specified by the standard (and might be a bit easier to
read).

On Mon, May 14, 2018 at 7:17 AM, Kris Johnson  wrote:

> Hi Ian,
>
> Thanks for the response.
> Your answer is what I was afraid of.
> It's a bit frustrating because I couldn't find any mention of this order
> enforcement for rules in the official OGC specification.
> But, more to the point, the python library I'm using (
> https://github.com/azavea/python-sld) doesn't seem capable of enforcing
> this.
>
> Do you have any suggestions for dynamically creating SLDs (for ingestion
> into Geoserver via REST calls) using python?
>
>
> On Fri, May 11, 2018 at 1:46 PM, Ian Turton  wrote:
>
>> As the error message suggests your filter is in the wrong place. It
>> should be at the top of the rule.
>>
>> Ian
>>
>> On Fri, 11 May 2018, 18:48 Kris Johnson,  wrote:
>>
>>> Hello,
>>>
>>> I'm attempting to generate an SLD file in python.
>>> And while the output appears valid to me when I load it in as a new
>>> style in Geoserver and click "Validate" I get an error:
>>>
 line 17: cvc-complex-type.2.4.a: Invalid content was found starting
 with element 'ogc:Filter'. One of 
 '{"http://www.opengis.net/sld":Symbolizer}'
 is expected.
>>>
>>>
>>> ​I'm assuming this occurs 18 times--once for each filter.
>>> The filter tag is correctly nested within the rule tag alongside a
>>> symbolizer, so I don't see what the issue is here.
>>> Here's the full SLD:
>>> ​
>>>
>>> http://www.opengis.net/ogc"; 
>>> xmlns:sld="http://www.opengis.net/sld"; 
>>> xmlns:xlink="http://www.w3.org/1999/xlink"; 
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0">
>>>   
>>> my style
>>> 
>>>   
>>> 
>>>   White Pine Rule
>>>   
>>> 
>>>   #f490bd
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   White Pine
>>> 
>>>   
>>> 
>>> 
>>>   Aspen-Oak Land Rule
>>>   
>>> 
>>>   #dfb1f9
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Aspen-Oak Land
>>> 
>>>   
>>> 
>>> 
>>>   Mixed White Pine and Red Pine Rule
>>>   
>>> 
>>>   #7a40bc
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Mixed White Pine and Red Pine
>>> 
>>>   
>>> 
>>> 
>>>   River Bottom Forest Rule
>>>   
>>> 
>>>   #6ef46e
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   River Bottom Forest
>>> 
>>>   
>>> 
>>> 
>>>   Lakes (open water) Rule
>>>   
>>> 
>>>   #65d14d
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Lakes (open water)
>>> 
>>>   
>>> 
>>> 
>>>   Big Woods - Hardwoods (oak, maple, basswood, hickory) 
>>> Rule
>>>   
>>> 
>>>   #5ff47f
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Big Woods - Hardwoods (oak, maple, basswood, 
>>> hickory)
>>> 
>>>   
>>> 
>>> 
>>>   Wet Prairie Rule
>>>   
>>> 
>>>   #c746f2
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Wet Prairie
>>> 
>>>   
>>> 
>>> 
>>>   Prairie Rule
>>>   
>>> 
>>>   #e552cd
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Prairie
>>> 
>>>   
>>> 
>>> 
>>>   Undefined Rule
>>>   
>>> 
>>>   #c933f7
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Undefined
>>> 
>>>   

Re: [Geoserver-users] Trouble with dynamically generated SLD

2018-05-14 Thread Kris Johnson
Hi Ian,

Thank you for the explanation regarding . I didn't pick up on
that while examining the spec.

I'll see what I can do to get the python script to proceed the correct
order.

Thanks again.

On Mon, May 14, 2018 at 9:29 AM, Ian Turton  wrote:

> The ordering is specified in the XML schema snippet on Page 25 of my copy
> of the spec:
>
> 
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>
> Rules contain a Sequence (or ordered list) with  above line
> symbolizer.
>
> It looks like a call to normalize on the rule should fix the order.
> Otherwise you can look to fix the python.
>
> The second easiest way is to ignore the validator (GeoServer is relaxed
> about the SLD it will ingest) and proceed.
>
> Ian
>
> On Mon, 14 May 2018 at 15:18, Kris Johnson  wrote:
>
>> Hi Ian,
>>
>> Thanks for the response.
>> Your answer is what I was afraid of.
>> It's a bit frustrating because I couldn't find any mention of this order
>> enforcement for rules in the official OGC specification.
>> But, more to the point, the python library I'm using (
>> https://github.com/azavea/python-sld) doesn't seem capable of enforcing
>> this.
>>
>> Do you have any suggestions for dynamically creating SLDs (for ingestion
>> into Geoserver via REST calls) using python?
>>
>>
>> On Fri, May 11, 2018 at 1:46 PM, Ian Turton  wrote:
>>
>>> As the error message suggests your filter is in the wrong place. It
>>> should be at the top of the rule.
>>>
>>> Ian
>>>
>>> On Fri, 11 May 2018, 18:48 Kris Johnson,  wrote:
>>>
 Hello,

 I'm attempting to generate an SLD file in python.
 And while the output appears valid to me when I load it in as a new
 style in Geoserver and click "Validate" I get an error:

> line 17: cvc-complex-type.2.4.a: Invalid content was found starting
> with element 'ogc:Filter'. One of 
> '{"http://www.opengis.net/sld":Symbolizer}'
> is expected.


 ​I'm assuming this occurs 18 times--once for each filter.
 The filter tag is correctly nested within the rule tag alongside a
 symbolizer, so I don't see what the issue is here.
 Here's the full SLD:
 ​

 http://www.opengis.net/ogc"; 
 xmlns:sld="http://www.opengis.net/sld"; 
 xmlns:xlink="http://www.w3.org/1999/xlink"; 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0">
   
 my style
 
   
 
   White Pine Rule
   
 
   #f490bd
 
 
   #000
   1
 
   
   
 
   xclass
   White Pine
 
   
 
 
   Aspen-Oak Land Rule
   
 
   #dfb1f9
 
 
   #000
   1
 
   
   
 
   xclass
   Aspen-Oak Land
 
   
 
 
   Mixed White Pine and Red Pine Rule
   
 
   #7a40bc
 
 
   #000
   1
 
   
   
 
   xclass
   Mixed White Pine and Red Pine
 
   
 
 
   River Bottom Forest Rule
   
 
   #6ef46e
 
 
   #000
   1
 
   
   
 
   xclass
   River Bottom Forest
 
   
 
 
   Lakes (open water) Rule
   
 
   #65d14d
 
 
   #000
   1
 
   
   
 
   xclass
   Lakes (open water)
 
   
 
 
   Big Woods - Hardwoods (oak, maple, basswood, hickory) 
 Rule
   
 
   #5ff47f
 
 
   #000
   1
 
   
   
 
   xclass
   Big Woods - Hardwoods (oak, maple, basswood, 
 hickory)
 
   
 
 
   Wet Prairie Rule
   
 
   #c746f2
 
 
   #000
   1
 
   
   

Re: [Geoserver-users] Trouble with dynamically generated SLD

2018-05-14 Thread Ian Turton
The ordering is specified in the XML schema snippet on Page 25 of my copy
of the spec:


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Rules contain a Sequence (or ordered list) with  above line
symbolizer.

It looks like a call to normalize on the rule should fix the order.
Otherwise you can look to fix the python.

The second easiest way is to ignore the validator (GeoServer is relaxed
about the SLD it will ingest) and proceed.

Ian
On Mon, 14 May 2018 at 15:18, Kris Johnson  wrote:

> Hi Ian,
>
> Thanks for the response.
> Your answer is what I was afraid of.
> It's a bit frustrating because I couldn't find any mention of this order
> enforcement for rules in the official OGC specification.
> But, more to the point, the python library I'm using (
> https://github.com/azavea/python-sld) doesn't seem capable of enforcing
> this.
>
> Do you have any suggestions for dynamically creating SLDs (for ingestion
> into Geoserver via REST calls) using python?
>
>
> On Fri, May 11, 2018 at 1:46 PM, Ian Turton  wrote:
>
>> As the error message suggests your filter is in the wrong place. It
>> should be at the top of the rule.
>>
>> Ian
>>
>> On Fri, 11 May 2018, 18:48 Kris Johnson,  wrote:
>>
>>> Hello,
>>>
>>> I'm attempting to generate an SLD file in python.
>>> And while the output appears valid to me when I load it in as a new
>>> style in Geoserver and click "Validate" I get an error:
>>>
 line 17: cvc-complex-type.2.4.a: Invalid content was found starting
 with element 'ogc:Filter'. One of 
 '{"http://www.opengis.net/sld":Symbolizer}'
 is expected.
>>>
>>>
>>> ​I'm assuming this occurs 18 times--once for each filter.
>>> The filter tag is correctly nested within the rule tag alongside a
>>> symbolizer, so I don't see what the issue is here.
>>> Here's the full SLD:
>>> ​
>>>
>>> http://www.opengis.net/ogc"; 
>>> xmlns:sld="http://www.opengis.net/sld"; 
>>> xmlns:xlink="http://www.w3.org/1999/xlink"; 
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0">
>>>   
>>> my style
>>> 
>>>   
>>> 
>>>   White Pine Rule
>>>   
>>> 
>>>   #f490bd
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   White Pine
>>> 
>>>   
>>> 
>>> 
>>>   Aspen-Oak Land Rule
>>>   
>>> 
>>>   #dfb1f9
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Aspen-Oak Land
>>> 
>>>   
>>> 
>>> 
>>>   Mixed White Pine and Red Pine Rule
>>>   
>>> 
>>>   #7a40bc
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Mixed White Pine and Red Pine
>>> 
>>>   
>>> 
>>> 
>>>   River Bottom Forest Rule
>>>   
>>> 
>>>   #6ef46e
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   River Bottom Forest
>>> 
>>>   
>>> 
>>> 
>>>   Lakes (open water) Rule
>>>   
>>> 
>>>   #65d14d
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Lakes (open water)
>>> 
>>>   
>>> 
>>> 
>>>   Big Woods - Hardwoods (oak, maple, basswood, hickory) 
>>> Rule
>>>   
>>> 
>>>   #5ff47f
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Big Woods - Hardwoods (oak, maple, basswood, 
>>> hickory)
>>> 
>>>   
>>> 
>>> 
>>>   Wet Prairie Rule
>>>   
>>> 
>>>   #c746f2
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Wet Prairie
>>> 
>>>   
>>> 
>>> 
>>>   Prairie Rule
>>>   
>>> 
>>>   #e552cd
>>> 
>>> 
>>>   #000
>>>   1
>>> 
>>>   
>>>   
>>> 
>>>   xclass
>>>   Prairie
>>> 
>>>   
>>> 
>>> 
>>>   Undefined R

Re: [Geoserver-users] Trouble with dynamically generated SLD

2018-05-14 Thread Kris Johnson
Hi Ian,

Thanks for the response.
Your answer is what I was afraid of.
It's a bit frustrating because I couldn't find any mention of this order
enforcement for rules in the official OGC specification.
But, more to the point, the python library I'm using (
https://github.com/azavea/python-sld) doesn't seem capable of enforcing
this.

Do you have any suggestions for dynamically creating SLDs (for ingestion
into Geoserver via REST calls) using python?


On Fri, May 11, 2018 at 1:46 PM, Ian Turton  wrote:

> As the error message suggests your filter is in the wrong place. It should
> be at the top of the rule.
>
> Ian
>
> On Fri, 11 May 2018, 18:48 Kris Johnson,  wrote:
>
>> Hello,
>>
>> I'm attempting to generate an SLD file in python.
>> And while the output appears valid to me when I load it in as a new style
>> in Geoserver and click "Validate" I get an error:
>>
>>> line 17: cvc-complex-type.2.4.a: Invalid content was found starting with
>>> element 'ogc:Filter'. One of '{"http://www.opengis.net/sld":Symbolizer}'
>>> is expected.
>>
>>
>> ​I'm assuming this occurs 18 times--once for each filter.
>> The filter tag is correctly nested within the rule tag alongside a
>> symbolizer, so I don't see what the issue is here.
>> Here's the full SLD:
>> ​
>>
>> http://www.opengis.net/ogc"; 
>> xmlns:sld="http://www.opengis.net/sld"; 
>> xmlns:xlink="http://www.w3.org/1999/xlink"; 
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0">
>>   
>> my style
>> 
>>   
>> 
>>   White Pine Rule
>>   
>> 
>>   #f490bd
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   White Pine
>> 
>>   
>> 
>> 
>>   Aspen-Oak Land Rule
>>   
>> 
>>   #dfb1f9
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Aspen-Oak Land
>> 
>>   
>> 
>> 
>>   Mixed White Pine and Red Pine Rule
>>   
>> 
>>   #7a40bc
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Mixed White Pine and Red Pine
>> 
>>   
>> 
>> 
>>   River Bottom Forest Rule
>>   
>> 
>>   #6ef46e
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   River Bottom Forest
>> 
>>   
>> 
>> 
>>   Lakes (open water) Rule
>>   
>> 
>>   #65d14d
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Lakes (open water)
>> 
>>   
>> 
>> 
>>   Big Woods - Hardwoods (oak, maple, basswood, hickory) 
>> Rule
>>   
>> 
>>   #5ff47f
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Big Woods - Hardwoods (oak, maple, basswood, 
>> hickory)
>> 
>>   
>> 
>> 
>>   Wet Prairie Rule
>>   
>> 
>>   #c746f2
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Wet Prairie
>> 
>>   
>> 
>> 
>>   Prairie Rule
>>   
>> 
>>   #e552cd
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Prairie
>> 
>>   
>> 
>> 
>>   Undefined Rule
>>   
>> 
>>   #c933f7
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Undefined
>> 
>>   
>> 
>> 
>>   Aspen-Birch (trending to Conifers) Rule
>>   
>> 
>>   #ef7cf9
>> 
>> 
>>   #000
>>   1
>> 
>>   
>>   
>> 
>>   xclass
>>   Aspen-Birch (trending to Conifers)
>> 
>>   
>> 
>> 
>>   Jack Pine Barrens 

Re: [Geoserver-users] Trouble with dynamically generated SLD

2018-05-11 Thread Ian Turton
As the error message suggests your filter is in the wrong place. It should
be at the top of the rule.

Ian

On Fri, 11 May 2018, 18:48 Kris Johnson,  wrote:

> Hello,
>
> I'm attempting to generate an SLD file in python.
> And while the output appears valid to me when I load it in as a new style
> in Geoserver and click "Validate" I get an error:
>
>> line 17: cvc-complex-type.2.4.a: Invalid content was found starting with
>> element 'ogc:Filter'. One of '{"http://www.opengis.net/sld":Symbolizer}'
>> is expected.
>
>
> ​I'm assuming this occurs 18 times--once for each filter.
> The filter tag is correctly nested within the rule tag alongside a
> symbolizer, so I don't see what the issue is here.
> Here's the full SLD:
> ​
>
> http://www.opengis.net/ogc"; 
> xmlns:sld="http://www.opengis.net/sld"; 
> xmlns:xlink="http://www.w3.org/1999/xlink"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0">
>   
> my style
> 
>   
> 
>   White Pine Rule
>   
> 
>   #f490bd
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   White Pine
> 
>   
> 
> 
>   Aspen-Oak Land Rule
>   
> 
>   #dfb1f9
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Aspen-Oak Land
> 
>   
> 
> 
>   Mixed White Pine and Red Pine Rule
>   
> 
>   #7a40bc
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Mixed White Pine and Red Pine
> 
>   
> 
> 
>   River Bottom Forest Rule
>   
> 
>   #6ef46e
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   River Bottom Forest
> 
>   
> 
> 
>   Lakes (open water) Rule
>   
> 
>   #65d14d
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Lakes (open water)
> 
>   
> 
> 
>   Big Woods - Hardwoods (oak, maple, basswood, hickory) 
> Rule
>   
> 
>   #5ff47f
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Big Woods - Hardwoods (oak, maple, basswood, 
> hickory)
> 
>   
> 
> 
>   Wet Prairie Rule
>   
> 
>   #c746f2
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Wet Prairie
> 
>   
> 
> 
>   Prairie Rule
>   
> 
>   #e552cd
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Prairie
> 
>   
> 
> 
>   Undefined Rule
>   
> 
>   #c933f7
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Undefined
> 
>   
> 
> 
>   Aspen-Birch (trending to Conifers) Rule
>   
> 
>   #ef7cf9
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Aspen-Birch (trending to Conifers)
> 
>   
> 
> 
>   Jack Pine Barrens and Openings Rule
>   
> 
>   #ff5ebe
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Jack Pine Barrens and Openings
> 
>   
> 
> 
>   Mixed Hardwood and Pine (Maple, White Pine, Basswood, 
> etc) Rule
>   
> 
>   #66dd9b
> 
> 
>   #000
>   1
> 
>   
>   
> 
>   xclass
>   Mixed Hardwood and Pine (Maple, White Pine, 
> Basswood, etc)
> 
>   
> 
> 
> 

[Geoserver-users] Trouble with dynamically generated SLD

2018-05-11 Thread Kris Johnson
Hello,

I'm attempting to generate an SLD file in python.
And while the output appears valid to me when I load it in as a new style
in Geoserver and click "Validate" I get an error:

> line 17: cvc-complex-type.2.4.a: Invalid content was found starting with
> element 'ogc:Filter'. One of '{"http://www.opengis.net/sld":Symbolizer}'
> is expected.


​I'm assuming this occurs 18 times--once for each filter.
The filter tag is correctly nested within the rule tag alongside a
symbolizer, so I don't see what the issue is here.
Here's the full SLD:
​

http://www.opengis.net/ogc";
xmlns:sld="http://www.opengis.net/sld";
xmlns:xlink="http://www.w3.org/1999/xlink";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0.0">
  
my style

  

  White Pine Rule
  

  #f490bd


  #000
  1

  
  

  xclass
  White Pine

  


  Aspen-Oak Land Rule
  

  #dfb1f9


  #000
  1

  
  

  xclass
  Aspen-Oak Land

  


  Mixed White Pine and Red Pine Rule
  

  #7a40bc


  #000
  1

  
  

  xclass
  Mixed White Pine and Red Pine

  


  River Bottom Forest Rule
  

  #6ef46e


  #000
  1

  
  

  xclass
  River Bottom Forest

  


  Lakes (open water) Rule
  

  #65d14d


  #000
  1

  
  

  xclass
  Lakes (open water)

  


  Big Woods - Hardwoods (oak, maple, basswood,
hickory) Rule
  

  #5ff47f


  #000
  1

  
  

  xclass
  Big Woods - Hardwoods (oak, maple,
basswood, hickory)

  


  Wet Prairie Rule
  

  #c746f2


  #000
  1

  
  

  xclass
  Wet Prairie

  


  Prairie Rule
  

  #e552cd


  #000
  1

  
  

  xclass
  Prairie

  


  Undefined Rule
  

  #c933f7


  #000
  1

  
  

  xclass
  Undefined

  


  Aspen-Birch (trending to Conifers) Rule
  

  #ef7cf9


  #000
  1

  
  

  xclass
  Aspen-Birch (trending to Conifers)

  


  Jack Pine Barrens and Openings Rule
  

  #ff5ebe


  #000
  1

  
  

  xclass
  Jack Pine Barrens and Openings

  


  Mixed Hardwood and Pine (Maple, White Pine,
Basswood, etc) Rule
  

  #66dd9b


  #000
  1

  
  

  xclass
  Mixed Hardwood and Pine (Maple, White Pine,
Basswood, etc)

  


  Aspen-Birch (trending to hardwoods) Rule
  

  #882dd8


  #000
  1

  
  

  xclass
  Aspen-Birch (trending to hardwoods)

  


  Brush Prairie Rule
  

  #8effb2


  #000
  1

  
  

  xclass
  Brush Prairie

  


  Pine Flats (Hemlock, Spruce, Fir, White Pine,
Aspen