in your creation code do something like:
*var **wms_bmid_pipes_diameter *= *new *ol.*source*.TileWMS({
*url*: *'http://foo:8080/geoserver/wms <http://foo:8080/geoserver/wms>'*
,
*params*: { *'LAYERS'*: *'bmid_pipes', 'STYLES':'mystyle' *},
*serverType*: *'geoserver'*
});
Assuming of course that you called your style mystyle :-)
Ian
On 3 November 2015 at 16:40, Jair Santos <[email protected]> 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
> <http://foo:8080/geoserver/wms>'*,
> *params*: { *'LAYERS'*: *'bmid_pipes' *},
> *serverType*: *'geoserver'*
>
> });
>
>
>
> And then
>
>
>
> *new *ol.*layer*.Tile({
> *source*: *wms_bmid_pipes_diameter*,
> *title*:*'BMID Mains by Diameter'*
>
> *});*
>
>
>
> I didn’t find the style as an option when creating the layer.
>
>
>
> JJ.
>
>
>
>
>
>
>
>
>
> *From:* Ian Turton [mailto:[email protected]]
> *Sent:* Tuesday, November 03, 2015 8:25 AM
> *To:* Jair Santos <[email protected]>
> *Cc:* geoserver-users <[email protected]>
> *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 <[email protected]> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
>
>
>
> --
>
> Ian Turton
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
--
Ian Turton
------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users