[Geoserver-users] Two layers based in the same PosGis table with different styles

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.

So you should do so, simply add the same layer twice. Just be case a table has been published once, does not prevent you from publishing it a second time. This can also be done to publish the same table with different bounds (perhaps because you are telling a different story).

Note you can also register more than one style with a layer (and allow the client application to choose the most appropriate style.

···

On 3 November 2015 at 17:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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


Jody Garnett

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

···

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**

I didn’t find the style as an option when creating the layer.

JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos jsantos5954@anonymised.com
Cc: geoserver-users geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

···

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@anonymised.com> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: geoserver-users <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton

Here is what I did.

1- Created a new style and assigned it to the layer. Therefore, the layer has now one default style and one selected style.

2- Created two layers passing the parameter STYLES as suggested :

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

The result is that none of the layers show up. There is no error in the client side and the localhost_access_log.2015-11-03 return code 200

=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182 HTTP/1.1" 200 295

BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13315941.823503986%2C6437832.270290684%2C-13306157.883883484%2C6447616.209911186 HTTP/1.1" 200 296

As soon as I load one layer only it properly shows up in the map.

Any ideas?

Thanks.

JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 9:29 AM
To: Jair Santos jsantos5954@anonymised.com
Cc: GeoServer Mailing List List geoserver-users@anonymised.comrceforge.net
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@anonymised.com> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: geoserver-users <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com84…> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton

In addition, it seems that Geoserver cannot handle both stylesin the same layer. Or I did something wrong?

org.geoserver.platform.ServiceException: No such style: BMID_Pipes_Diameter

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:356)

at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:84)

2015-11-03 10:13:44,650 INFO [geoserver.wms] -

Request: getServiceInfo

2015-11-03 10:13:44,650 ERROR [geoserver.ows] -

org.geoserver.platform.ServiceException: No such style: BMID_Pipes_Material

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:356)

at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:84)

Thanks.

JJ

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 9:29 AM
To: Jair Santos jsantos5954@anonymised.com
Cc: GeoServer Mailing List List geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@anonymised.com> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: geoserver-users <geoserver-users@anonymised.comts.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton

Jair,

It appears you placed your styles into the workspace as well. When you do that, you have to use the workspace in the style name as well.

Example Layer Previewer:

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

I expect that changing your style references would start to work

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_ws:BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:’ BMID_ws:BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

image001.png

···

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@...5633...

From: Jair Santos [mailto:jsantos5954@…84…]
Sent: Tuesday, November 03, 2015 11:40 AM
To: ‘GeoServer Mailing List List’ geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

Here is what I did.

1- Created a new style and assigned it to the layer. Therefore, the layer has now one default style and one selected style.

2- Created two layers passing the parameter STYLES as suggested :

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

The result is that none of the layers show up. There is no error in the client side and the localhost_access_log.2015-11-03 return code 200

=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182 HTTP/1.1" 200 295

BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13315941.823503986%2C6437832.270290684%2C-13306157.883883484%2C6447616.209911186 HTTP/1.1" 200 296

As soon as I load one layer only it properly shows up in the map.

Any ideas?

Thanks.

JJ.

From: Ian Turton [mailto:ijturton@…84…]
Sent: Tuesday, November 03, 2015 9:29 AM
To: Jair Santos <jsantos5954@…84…>
Cc: GeoServer Mailing List List <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@…84…> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@…84…]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@…84…>
Cc: geoserver-users <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@…84…> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton

Unfortunately it didn’t work.

2015-11-03 11:24:48,861 ERROR [geoserver.ows] -

org.geoserver.platform.ServiceException: No such style: BMID_ws: BMID_Pipes_Diameter

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

2015-11-03 11:24:48,845 ERROR [geoserver.ows] -

org.geoserver.platform.ServiceException: No such style: BMID_ws: BMID_Pipes_Material

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:356)

Thanks.

JJ.

From: Chris Snider [mailto:chris.snider@anonymised.com]
Sent: Tuesday, November 03, 2015 11:18 AM
To: Jair Santos jsantos5954@anonymised.com; ‘GeoServer Mailing List List’ geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] Two layers based in the same PosGis table with different styles

Jair,

It appears you placed your styles into the workspace as well. When you do that, you have to use the workspace in the style name as well.

Example Layer Previewer:

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

I expect that changing your style references would start to work

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_ws:BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:’ BMID_ws:BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@anonymised.com

From: Jair Santos [mailto:jsantos5954@anonymised.com]
Sent: Tuesday, November 03, 2015 11:40 AM
To: ‘GeoServer Mailing List List’ <geoserver-users@anonymised.comrge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

Here is what I did.

1- Created a new style and assigned it to the layer. Therefore, the layer has now one default style and one selected style.

2- Created two layers passing the parameter STYLES as suggested :

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

The result is that none of the layers show up. There is no error in the client side and the localhost_access_log.2015-11-03 return code 200

=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182 HTTP/1.1" 200 295

BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13315941.823503986%2C6437832.270290684%2C-13306157.883883484%2C6447616.209911186 HTTP/1.1" 200 296

As soon as I load one layer only it properly shows up in the map.

Any ideas?

Thanks.

JJ.

From: Ian Turton [mailto:ijturton@anonymised.com…84…]
Sent: Tuesday, November 03, 2015 9:29 AM
To: Jair Santos <jsantos5954@anonymised.com84…>
Cc: GeoServer Mailing List List <geoserver-users@anonymised.com.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@anonymised.com> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: geoserver-users <geoserver-users@anonymised.comet>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton

I re-saved the styles in Geoserver without the work space and it worked.

JJ.

From: Chris Snider [mailto:chris.snider@anonymised.com]
Sent: Tuesday, November 03, 2015 11:18 AM
To: Jair Santos jsantos5954@anonymised.com; ‘GeoServer Mailing List List’ geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] Two layers based in the same PosGis table with different styles

Jair,

It appears you placed your styles into the workspace as well. When you do that, you have to use the workspace in the style name as well.

Example Layer Previewer:

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

I expect that changing your style references would start to work

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_ws:BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:’ BMID_ws:BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@anonymised.com

From: Jair Santos [mailto:jsantos5954@anonymised.com]
Sent: Tuesday, November 03, 2015 11:40 AM
To: ‘GeoServer Mailing List List’ <geoserver-users@anonymised.comrceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

Here is what I did.

1- Created a new style and assigned it to the layer. Therefore, the layer has now one default style and one selected style.

2- Created two layers passing the parameter STYLES as suggested :

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

The result is that none of the layers show up. There is no error in the client side and the localhost_access_log.2015-11-03 return code 200

=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182 HTTP/1.1" 200 295

BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13315941.823503986%2C6437832.270290684%2C-13306157.883883484%2C6447616.209911186 HTTP/1.1" 200 296

As soon as I load one layer only it properly shows up in the map.

Any ideas?

Thanks.

JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 9:29 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: GeoServer Mailing List List <geoserver-users@anonymised.comrceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@anonymised.com> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: geoserver-users <geoserver-users@anonymised.come.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton

Did you previously have the styles in the BMID_ws workspace?

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

and

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

now both work (removed the workspace from the style)

image001.png

···

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@...5633...

From: Jair Santos [mailto:jsantos5954@…84…]
Sent: Tuesday, November 03, 2015 12:27 PM
To: ‘GeoServer Mailing List List’ geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

Unfortunately it didn’t work.

2015-11-03 11:24:48,861 ERROR [geoserver.ows] -

org.geoserver.platform.ServiceException: No such style: BMID_ws: BMID_Pipes_Diameter

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

2015-11-03 11:24:48,845 ERROR [geoserver.ows] -

org.geoserver.platform.ServiceException: No such style: BMID_ws: BMID_Pipes_Material

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:356)

Thanks.

JJ.

From: Chris Snider [mailto:chris.snider@…3225…]
Sent: Tuesday, November 03, 2015 11:18 AM
To: Jair Santos <jsantos5954@…84…>; ‘GeoServer Mailing List List’ <geoserver-users@lists.sourceforge.net>
Subject: RE: [Geoserver-users] Two layers based in the same PosGis table with different styles

Jair,

It appears you placed your styles into the workspace as well. When you do that, you have to use the workspace in the style name as well.

Example Layer Previewer:

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

I expect that changing your style references would start to work

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_ws:BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:’ BMID_ws:BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@...5633...

From: Jair Santos [mailto:jsantos5954@…84…]
Sent: Tuesday, November 03, 2015 11:40 AM
To: ‘GeoServer Mailing List List’ <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

Here is what I did.

1- Created a new style and assigned it to the layer. Therefore, the layer has now one default style and one selected style.

2- Created two layers passing the parameter STYLES as suggested :

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

The result is that none of the layers show up. There is no error in the client side and the localhost_access_log.2015-11-03 return code 200

=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182 HTTP/1.1" 200 295

BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13315941.823503986%2C6437832.270290684%2C-13306157.883883484%2C6447616.209911186 HTTP/1.1" 200 296

As soon as I load one layer only it properly shows up in the map.

Any ideas?

Thanks.

JJ.

From: Ian Turton [mailto:ijturton@…84…]
Sent: Tuesday, November 03, 2015 9:29 AM
To: Jair Santos <jsantos5954@…84…>
Cc: GeoServer Mailing List List <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@…84…> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@…84…]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@…84…>
Cc: geoserver-users <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@…84…> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton

Yep, they both were in the same workspace. As soon as I removed them it started to work.

JJ.

From: Chris Snider [mailto:chris.snider@anonymised.com]
Sent: Tuesday, November 03, 2015 11:47 AM
To: Jair Santos jsantos5954@anonymised.com; ‘GeoServer Mailing List List’ geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] Two layers based in the same PosGis table with different styles

Did you previously have the styles in the BMID_ws workspace?

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

and

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

now both work (removed the workspace from the style)

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@anonymised.com

From: Jair Santos [mailto:jsantos5954@anonymised.com]
Sent: Tuesday, November 03, 2015 12:27 PM
To: ‘GeoServer Mailing List List’ <geoserver-users@anonymised.comsts.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

Unfortunately it didn’t work.

2015-11-03 11:24:48,861 ERROR [geoserver.ows] -

org.geoserver.platform.ServiceException: No such style: BMID_ws: BMID_Pipes_Diameter

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

2015-11-03 11:24:48,845 ERROR [geoserver.ows] -

org.geoserver.platform.ServiceException: No such style: BMID_ws: BMID_Pipes_Material

at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1459)

at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:356)

Thanks.

JJ.

From: Chris Snider [mailto:chris.snider@anonymised.com25…]
Sent: Tuesday, November 03, 2015 11:18 AM
To: Jair Santos <jsantos5954@anonymised.com4…>; ‘GeoServer Mailing List List’ <geoserver-users@lists.sourceforge.net>
Subject: RE: [Geoserver-users] Two layers based in the same PosGis table with different styles

Jair,

It appears you placed your styles into the workspace as well. When you do that, you have to use the workspace in the style name as well.

Example Layer Previewer:

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

http://174.4.62.160:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=bmid_pipes&styles=BMID_ws:BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182&format=application/openlayers

I expect that changing your style references would start to work

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_ws:BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:’ BMID_ws:BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@anonymised.com

From: Jair Santos [mailto:jsantos5954@anonymised.com]
Sent: Tuesday, November 03, 2015 11:40 AM
To: ‘GeoServer Mailing List List’ <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

Here is what I did.

1- Created a new style and assigned it to the layer. Therefore, the layer has now one default style and one selected style.

2- Created two layers passing the parameter STYLES as suggested :

var wms_bmid_pipes_material = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Material’ },
serverType: ‘geoserver’
});

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://174.4.62.160:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’,‘STYLES’:‘BMID_Pipes_Diameter’ },
serverType: ‘geoserver’
});

The result is that none of the layers show up. There is no error in the client side and the localhost_access_log.2015-11-03 return code 200

=BMID_Pipes_Diameter&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13286590.004642477%2C6418264.391049679%2C-13276806.065021975%2C6428048.330670182 HTTP/1.1" 200 295

BMID_Pipes_Material&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-13315941.823503986%2C6437832.270290684%2C-13306157.883883484%2C6447616.209911186 HTTP/1.1" 200 296

As soon as I load one layer only it properly shows up in the map.

Any ideas?

Thanks.

JJ.

From: Ian Turton [mailto:ijturton@anonymised.com]
Sent: Tuesday, November 03, 2015 9:29 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: GeoServer Mailing List List <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

in your creation code do something like:

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’, ‘STYLES’:‘mystyle’ },
serverType: ‘geoserver’

});

Assuming of course that you called your style mystyle :slight_smile:

Ian

On 3 November 2015 at 16:40, Jair Santos <jsantos5954@anonymised.com> wrote:

Thank you.

I understand that I should then set the style on the client side. I am using openlayers 3 where I create the layer like

var wms_bmid_pipes_diameter = new ol.source.TileWMS({
url: http://foo:8080/geoserver/wms,
params: { ‘LAYERS’: ‘bmid_pipes’ },
serverType: ‘geoserver’

});

And then

**new** ol.**layer**.Tile({
    **source**: <b>*wms_bmid_pipes_diameter*</b>,
    **title**:**'BMID Mains by Diameter'**
**});**
** **
I didn’t find the style as an option when creating the layer.
 
JJ.

From: Ian Turton [mailto:ijturton@anonymised.com4…]
Sent: Tuesday, November 03, 2015 8:25 AM
To: Jair Santos <jsantos5954@anonymised.com>
Cc: geoserver-users <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Two layers based in the same PosGis table with different styles

You can use the republish button to create a second layer from the table, but for your case you just need one layer with two styles - on the layer publishing tab you can add one (or more) additional styles in the list below the default style. Select the style you want and then press the right arrow to copy it to the selected list. Then when you request your layer simply put styles=other_style in the request.

Ian

On 3 November 2015 at 16:18, Jair Santos <jsantos5954@anonymised.com> wrote:

Hello all,

I need to create a layer that will be based on the same table as another already in Geoserver. They must have different styles though. In order to publish a layer I need to add the table to PosGis from a shape file and it will available to publish in Geoserver. To solve the problem I can duplicate the table with a different name, but I believe that this is not the best solution.

What I would like to do is to create a new layer in Geoserver using the same database and apply a different style to it.

What’s the best way of doing that?

TIA.

JJ.



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

Ian Turton



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

Ian Turton