Reading-eScience-Centre / ncwms

ncWMS - A Web Map Service for displaying environmental data over the web
Other
62 stars 30 forks source link

contours without sld #54

Open ghansham opened 4 years ago

ghansham commented 4 years ago

Is there a way to configure contour color and contour levels without sld. It used to work in ncWMS1.

guygriffiths commented 4 years ago

It depends what you mean by "without sld". You can define new custom styles and put them in .ncWMS2/.styles as described here: https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/06-development.html#styles

The styles are written in SLD, but you don't need to pass SLD_BODY as a WMS argument to use them - they are just new named styles.

But there is currently no way of specifying contour options as WMS arguments.

ghansham commented 4 years ago

There are styles coming in metadata one for contours and another for colored contours, but if we choose that way we cant set contour properties(styles e.g solid, dashed; contour line color, number of levels). This was possible in ncwms 1.

On Tue, May 19, 2020, 14:20 Guy Griffiths notifications@github.com wrote:

It depends what you mean by "without sld". You can define new custom styles and put them in .ncWMS2/.styles as described here: https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/06-development.html#styles

The styles are written in SLD, but you don't need to pass SLD_BODY as a WMS argument to use them - they are just new named styles.

But there is currently no way of specifying contour options as WMS arguments.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Reading-eScience-Centre/ncwms/issues/54#issuecomment-630681500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYXFJFVUHLEHEGSQYWLJKDRSJB6TANCNFSM4NCZFPOA .

guygriffiths commented 4 years ago

Yes. If you want different contour styles, you need to define them in SLD and add them to .ncWMS2/.styles. Here's an example: https://github.com/Reading-eScience-Centre/edal-java/blob/master/graphics/src/main/resources/styles/colored_contours.xml

ghansham commented 4 years ago

Referring to the url example, you mentioned, from where it picks layerName, opacity, scaleMin, scaleMax.and similarly if it is substituting, is it possible to pass the number of levels and contour style.

On Tue, May 19, 2020, 14:54 Guy Griffiths notifications@github.com wrote:

Yes. If you want different contour styles, you need to define them in SLD and add them to .ncWMS2/.styles. Here's an example: https://github.com/Reading-eScience-Centre/edal-java/blob/master/graphics/src/main/resources/styles/colored_contours.xml

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Reading-eScience-Centre/ncwms/issues/54#issuecomment-630700655, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYXFJDB7YHBBZQAW23ZLR3RSJF3DANCNFSM4NCZFPOA .

guygriffiths commented 4 years ago

No, the available placeholders are listed here: https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/06-development.html#styles

ghansham commented 4 years ago

Okay. That means we have to replace those placeholders and pass sld body in wms request url.

On Tue, May 19, 2020, 16:21 Guy Griffiths notifications@github.com wrote:

No, the available placeholders are listed here: https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/06-development.html#styles

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Reading-eScience-Centre/ncwms/issues/54#issuecomment-630742730, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYXFJBEFJBNAQSYPRZELLTRSJQC5ANCNFSM4NCZFPOA .

guygriffiths commented 4 years ago

If you want to set them dynamically, then yes you'll either have to set SLD_BODY or SLD. The latter is usually a better option, since some older browsers have a character limit on URLs.

ghansham commented 4 years ago

Can you share example url with sld and placeholders. Regards Ghansham

On Tue, May 19, 2020, 16:34 Guy Griffiths notifications@github.com wrote:

If you want to set them dynamically, then yes you'll either have to set SLD_BODY or SLD. The latter is usually a better option, since some older browsers have a character limit on URLs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Reading-eScience-Centre/ncwms/issues/54#issuecomment-630748351, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYXFJEAOUMO52U4YJC6BRDRSJRUJANCNFSM4NCZFPOA .

guygriffiths commented 4 years ago

I'm not sure what you mean. If you specify SLD_BODY in the URL, you don't have placeholders, you fill in the values you want. The example I attached earlier should work - you just need to replace all of the placeholders starting with $ with concrete values, and put it in the URL as SLD_BODY. It replaces LAYERS and STYLES so you don't need them.

ghansham commented 4 years ago

Sorry about the confusion.suppose i create a style template for contours in ".styles" directory. Now can I pass this template name in sld parameter. And where do I specify the placeholder values.. in the url itself? Thats not clear.

On Tue, May 19, 2020, 16:46 Guy Griffiths notifications@github.com wrote:

I'm not sure what you mean. If you specify SLD_BODY in the URL, you don't have placeholders, you fill in the values you want. The example I attached earlier should work - you just need to replace all of the placeholders starting with $ with concrete values, and put it in the URL as SLD_BODY. It replaces LAYERS and STYLES so you don't need them.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Reading-eScience-Centre/ncwms/issues/54#issuecomment-630753305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYXFJH7FYPHYODN75EY6LTRSJTALANCNFSM4NCZFPOA .

guygriffiths commented 4 years ago

If you create a style template in .styles, it will appear as a supported style name. You specify the template name as STYLES=mycontourstyle. This is how all of the included styles are defined (see https://github.com/Reading-eScience-Centre/edal-java/tree/master/graphics/src/main/resources/styles). When you do that, the placeholders listed here: https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/06-development.html#styles come from the URL arguments with the same names. For example $numColorBands comes from the NUMCOLORBANDS URL argument.

If this is not sufficient (e.g. you want more placeholder values) then you use SLD_BODY to specify the full SLD document. You can write a complete XML style in the SLD_BODY URL argument. There are no placeholders. You write the XML with the values you want.

ghansham commented 4 years ago

Ok got it. Very nice explanation. One last query. Does ncwms2 allow the xmls to be fetched on client side so that sld body can be constructed as passed as sld_body in the requested url?

One more thing, i observed that ncwms2 by default adds cors headers to the json requests atleast. Am I right?

Regards Ghansham

On Tue, May 19, 2020, 17:08 Guy Griffiths notifications@github.com wrote:

If you create a style template in .styles, it will appear as a supported style name. You specify the template name as STYLES=mycontourstyle. This is how all of the included styles are defined (see https://github.com/Reading-eScience-Centre/edal-java/tree/master/graphics/src/main/resources/styles). When you do that, the placeholders listed here:

https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/06-development.html#styles come from the URL arguments with the same names. For example $numColorBands comes from the NUMCOLORBANDS URL argument.

If this is not sufficient (e.g. you want more placeholder values) then you use SLD_BODY to specify the full SLD document. You can write a complete XML style in the SLD_BODY URL argument. There are no placeholders. You write the XML with the values you want.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Reading-eScience-Centre/ncwms/issues/54#issuecomment-630762773, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYXFJBAE4BEDSGXZ5YASZTRSJVTHANCNFSM4NCZFPOA .