Reading-eScience-Centre / ncwms

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

Adding other base layers to Godiva3 #17

Closed marceloandrioni closed 6 years ago

marceloandrioni commented 6 years ago

Hello, I am not sure this it the correct place to ask this, but I was wondering if it is possible to add other layers to the Godiva3 viewer. In the old Godiva2 I managed to do that simply editing the godiva2.js file. The reason I am asking this is that I am behind a proxy and using a layer hosted on a internal geoserver would avoid a lot of problems. Thank you.

guygriffiths commented 6 years ago

This is the correct place to ask, but currently this is not possible in Godiva3. I believe that the best way for this to work would be to provide the base layer details in the godiva3.properties file within the .ncWMS2 config directory, and have them picked up automatically on load. I might get some time this week to implement something like that, I'll let you know.

marceloandrioni commented 6 years ago

Thank you for the reply, I am glad I asked at the right place. I didn't mention this in my question, but just to be clear, besides adding Base layers it would also be very useful to add Overlay layers. I imagine this could be also controlled by the godiva3.properties as you said. Something that could be a problem with overlay layers would be controlling the ZIndex, so that the layer would be draw above the ncWMS layer, the getfeature would only return values from the ncWMS layer and the popup windows with ncWMS values would still be below the Overlay layer and closeable. Previously I managed that issuing setZIndex(X) in the godiva2.js until I figured out the correct values, now I not sure what to do. Thank you.

guygriffiths commented 6 years ago

@marceloandrioni - I'm not sure about "...and the popup windows with ncWMS values would still be below the Overlay layer and closeable". The popup windows are not part of the map layers, and should be on top of everything else. I don't think it would be feasible for the popup window to be below the overlay layers (at least not in a workable fashion).

Aside from that, everything else is perfectly feasible, I might even have time to do it this afternoon. Are you comfortable building from source, or would you prefer I drop a temporary WAR file somewhere for you to be my test subject? ;)

marceloandrioni commented 6 years ago

Sorry, I wrote that incorrectly, what I meant was "and the popup windows with ncWMS values would still be ABOVE the Overlay layer and closeable". If the popup windows is always above the other layers there is no problem. I never built a war from souce, if it is just running "mvn package" I think I can do it. Again thank you very much.

guygriffiths commented 6 years ago

Building is pretty simple, but actually if you wouldn't mind giving it a test now, that'd be great (I haven't pushed the commits yet). You can get it from www.personal.rdg.ac.uk/~qx901922/ncWMS2.war

You need to add something like the following to your godiva3.properties:

# First we define a layer with ID "meso"
# The URL of the WMS.  MANDATORY
mesoURL=https://mesonet.agron.iastate.edu/cgi-bin/wms/goes/conus_vis.cgi?
# The Title for the layer switcher. Defaults to the ID (i.e. "meso" in this case)
mesoTitle=Some random WMS
# The layer(s) to plot.  MANDATORY
mesoLayers=conus_vis_4km
# The projection to use.  Defaults to "CRS:84"
mesoProjection=EPSG:4326
# The WMS version to use.  Defaults to "1.1.1"
mesoVersion=1.3.0
# The image format to use.  Defaults to "image/png"
mesoFormat=image/png
# Whether to use as an overlay (as opposed to a base map).  Defaults to false
mesoIsOverlay=false

This particular WMS is just the first one I found with Google. It only has imagery for the USA, but you should try with your own layers. Let me know how you get on.

marceloandrioni commented 6 years ago

I deployed the v2.2.11-snaphot and it worked perfectly as show in the attached image. It displays my layers as a basemap and as a overlay. If I may make only one more suggestion would be to allow in the godiva3.properties the extra layers to be select by default if base layer (map.setBaseLayer(mybaselayer);) and turned on if overlay (mylayer.setVisibility(true);). Again, thank you very much for this new version. screenshot_godiva3

guygriffiths commented 6 years ago

Great, glad it's working. I'll add a couple of options to allow the base layer to be the default, and to turn on various overlays on load, add the configuration to the docs, and push the commits. It will then make it to the next release.

marceloandrioni commented 6 years ago

Thank you for all the modification. I will be waiting the new version then and closing this Issue. Thanks again.

guygriffiths commented 6 years ago

FYI, I did a release with these changes yesterday

marceloandrioni commented 6 years ago

Thanks for the heads up, already using the 2.2.11 version. The extra parameter OnByDefault it is also working fine for base and overlay layers. I noticed a small problem when using the "Export to PNG", but I will open another issue on the EDAL repository to discuss it.