Thanks Torben, it's exactly what I needed !
On Sat, Jun 8, 2019 at 1:13 AM Torben Barsballe <
[email protected]> wrote:
> (Resending this to the user list as delivery failed, if you already saw my
> reply disregard this)
>
> Hi Florent,
>
> I took a look at your style, and the two layers each are missing the
> "source-layer" attribute.
> MBStyle is able to apply to multiple GeoServer layers, so when the style
> has more than one layer, this attribute is required (when there is only one
> layer, it automatically applies to the first layer. One of the other issues
> with the current MBStyle codebase is it doesn't have all that good error
> messages yet (some parts are pretty good, but then you get an error like
> the one you ran into, which isn't helpful at all).
>
> Try something like this for your style:
>
> {
> "version": 8,
> "name": "violet polygon",
> "layers": [
> {
> "id": "violet polygon",
> "source-layer": "countries",
> "type": "fill",
> "filter": [">", "IDN3", 710],
> "paint": {
> "fill-color": "#3300ff",
> "fill-outline-color":"#000000"
> }
> }, {
> "id": "red polygon",
> "source-layer": "countries",
> "type": "fill",
> "filter": ["<", "IDN3", 710],
> "paint": {
> "fill-color": "#aa0000",
> "fill-outline-color":"#000000"
> }
> }
> ]
> }
>
> (Replace "countries" with the name of the layer you are styling)
> For more information about styling with MBStyle, take a look at this
> tutorial
> <https://docs.boundlessgeo.com/suite/latest/cartography/mbstyle/tutorial/index.html>.
> It explains a bit more about how to use MBStyle with multiple layers, and
> how to make best use of source-layer.
>
> Cheers,
> Torben
>
> On Fri, Jun 7, 2019 at 4:08 PM Torben Barsballe <
> [email protected]> wrote:
>
>> Hi Florent,
>>
>> I took a look at your style, and the two layers each are missing the
>> "source-layer" attribute.
>> MBStyle is able to apply to multiple GeoServer layers, so when the style
>> has more than one layer, this attribute is required (when there is only one
>> layer, it automatically applies to the first layer. One of the other issues
>> with the current MBStyle codebase is it doesn't have all that good error
>> messages yet (some parts are pretty good, but then you get an error like
>> the one you ran into, which isn't helpful at all).
>>
>> Try something like this for your style:
>>
>> {
>> "version": 8,
>> "name": "violet polygon",
>> "layers": [
>> {
>> "id": "violet polygon",
>> "source-layer": "countries",
>> "type": "fill",
>> "filter": [">", "IDN3", 710],
>> "paint": {
>> "fill-color": "#3300ff",
>> "fill-outline-color":"#000000"
>> }
>> }, {
>> "id": "red polygon",
>> "source-layer": "countries",
>> "type": "fill",
>> "filter": ["<", "IDN3", 710],
>> "paint": {
>> "fill-color": "#aa0000",
>> "fill-outline-color":"#000000"
>> }
>> }
>> ]
>> }
>>
>> (Replace "countries" with the name of the layer you are styling)
>> For more information about styling with MBStyle, take a look at this
>> tutorial
>> <https://docs.boundlessgeo.com/suite/latest/cartography/mbstyle/tutorial/index.html>.
>> It explains a bit more about how to use MBStyle with multiple layers, and
>> how to make best use of source-layer.
>>
>> Cheers,
>> Torben
>>
>>
>>
>>
>>
>>
>> On Thu, Jun 6, 2019 at 2:24 AM Florent Gravin <
>> [email protected]> wrote:
>>
>>> Hi Jody,
>>>
>>> Thanks for the answer, the syntax works well if you just have one layer,
>>> this works fine:
>>>
>>> {
>>> "version": 8,
>>> "name": "violet polygon",
>>> "layers": [
>>> {
>>> "id": "violet polygon",
>>> "type": "fill",
>>> "filter": [">", "IDN3", 710],
>>> "paint": {
>>> "fill-color": "#3300ff",
>>> "fill-outline-color":"#000000"
>>> }
>>> }
>>> }
>>>
>>> My concern is that I want multi rules, some US states displayed in
>>> green, and others in red for instance, and I am not sure the mbstyle
>>> extension handles it, and if yes, what it the correct syntax.
>>> The document only shows examples with one rule.
>>>
>>> Still I expected that to work, are you in position to write a test case
>>>> and patch? I know the codebase enough to review.
>>>
>>> I think we can do something yes
>>>
>>> I am quite keen on the mbstyle technology and would like to see the
>>>> functionality become a formal extension if we can identify enough
>>>> interested parties for maintenance and improvements.
>>>
>>> I totally agree, we'll try to push a bit on it if we manage to make it
>>> work for multi rules styles layer.
>>>
>>> Thanks for support Jody
>>>
>>> On Wed, Jun 5, 2019 at 7:02 AM Jody Garnett <[email protected]>
>>> wrote:
>>>
>>>> You may wish to try with function stops for the fill-color.
>>>>
>>>> Boundless Server had some documentation on how much of the mapbox style
>>>> expression syntax was implemented, the filter syntax you are describing is
>>>> now deprecated in the specticication.
>>>>
>>>> Still I expected that to work, are you in position to write a test case
>>>> and patch? I know the codebase enough to review.
>>>>
>>>> I am quite keen on the mbstyle technology and would like to see the
>>>> functionality become a formal extension if we can identify enough
>>>> interested parties for maintenance and improvements.
>>>> --
>>>> Jody Garnett
>>>>
>>>>
>>>> On Tue, 4 Jun 2019 at 02:09, Florent Gravin <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi guys,
>>>>>
>>>>> Is there a way to create a style in mbstyle format for a layer with
>>>>> differents rules ?
>>>>> There is only one paint per layer so i was expecting something
>>>>> like that could work but it doesn't, "Invalid SLD".
>>>>> The idea is to have 2 layers with 2 differents filters and paints..
>>>>>
>>>>> {
>>>>> "version": 8,
>>>>> "name": "violet polygon",
>>>>> "layers": [
>>>>> {
>>>>> "id": "violet polygon",
>>>>> "type": "fill",
>>>>> "filter": [">", "IDN3", 710],
>>>>> "paint": {
>>>>> "fill-color": "#3300ff",
>>>>> "fill-outline-color":"#000000"
>>>>> }
>>>>> }, {
>>>>> "id": "red polygon",
>>>>> "type": "fill",
>>>>> "filter": ["<", "IDN3", 710],
>>>>> "paint": {
>>>>> "fill-color": "#aa0000",
>>>>> "fill-outline-color":"#000000"
>>>>> }
>>>>> }
>>>>> ]
>>>>> }
>>>>>
>>>>> Maybe it's not possible with the current implementation ?
>>>>> Thanks for hints
>>>>>
>>>>> --
>>>>> *camptocamp*
>>>>> INNOVATIVE SOLUTIONS
>>>>> BY OPEN SOURCE EXPERTS
>>>>>
>>>>> *Florent Gravin*
>>>>> *Technical Leader - Architect*
>>>>> +33 4 58 48 20 36
>>>>> _______________________________________________
>>>>> 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
>>>>>
>>>>>
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>>>
>>>>
>>>
>>> --
>>> *camptocamp*
>>> INNOVATIVE SOLUTIONS
>>> BY OPEN SOURCE EXPERTS
>>>
>>> *Florent Gravin*
>>> *Technical Leader - Architect*
>>> +33 4 58 48 20 36
>>> _______________________________________________
>>> 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
>>>
>>>
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>
>>
--
*camptocamp*
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS
*Florent Gravin*
*Technical Leader - Architect*
+33 4 58 48 20 36
_______________________________________________
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users