I'm relatively inexperienced with Openlayers, and I've been trying to figure this out for a while now. Basically I've created a layer on my map from a WMS Call. I have the url set up so that when you click a radio button, it runs a function, and inserts the part of the URL that will link it to the proper file on the server. It's better to explain with code... So layer_type and layer_name change depending on what radio button is selected. I know the variables change, becasue I have checked that with an alert() in my function. Here is the problem, when I insert the alert in the second function, I see the URL does not change in the map variable, therefore it's not changing anything on the map when I select different buttons and the redraw command does its thing. Is it even possible to update the map without having to add a separate map variable for layers for each file? To change part of the WMS query string in OpenLayers, there is a mergeNewParams function, which will update it and re-request all of your tiles, see line 222, http://trac.osgeo.org/openlayers/browser/trunk/openlayers/lib/OpenLayers/Layer/WMS.js. To be clear, this only works on the query string of the request. In your case, it seems you have different layers and layer types as part of the url. You are going to have to call map.removeLayer(Tavg), create your new WMS request url and explicitly re-add the WMS with map.addLayer(Tavg) again. In general, if you have some resource at some scale, which your url suggests you do, ...thredds/wms/sco/synthesis/eval_WICCI_' + layer_type + '_50km.nc?', but with different thematic views, you might be better off handling this using the Layers and Styles parameters of WMS, with just one url, as otherwise you might end up with hundreds of different urls just to show different views of the same tile, which could get quite messy from a server perspective. Also, you will note from the fact that OpenLayers has a mergeNewParams function, that this is the expected way to handle this sort of situation. EDIT: After a further dig through the source code, you might be able to do what you want by explicitly setting the url, with the setURL function following by a call to redraw. Both of these functions are in OpenLayers.Layer.HTTPRequest from which OpenLayers.Layer.WMS inherits some of its methods via OpenLayers.Layer.Grid. Ho, how can i add target='blank' to all links in elements of the openlayers 3.10.x component? -- Rüdiger My polygon bounds are - 1.18915251826175,44.069361365345 1.12048796748053,43.941939265001 1.45900420283204,43.9394671408999 While executing it is pointing to the edges of the polygon.Not the center of polygon.Could anybody suggest me some solutions to solve this. I try to change strategy to strategy: new ol.loadingstrategy.bbox but I get Uncaught TypeError: this.strategy_ is not a function. Most of the examples set bbox strategy and also a BBOX on the url. If I add ....&BBOX='+extent.join(',') at the end of the url I still get the same error. What am I missing? Is it the strategy, the url, the settings? How do I fix this? I'm trying to add WMS tiles in the R leaflet package - not a problem using this example geoserver WMS: However, when I try using WMS from the National Map, I continue to get empty leaflet results despite multiple attempts at trying to set parameters correctly for url and layers: I've not used leaflet before outside the R leaflet package, so this may be a very novice mistake in setting my parameters in leaflet using this type of WMS I'm adding my baselayer along with some overlays coming from WMS on a map and after that adding a polygon. The issue seems to be that the WMS tiles get loaded after my polygon already appears and the tiles obscure the polygon making it hard to see. How can I get my polygon to be the top layer? Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 18, 2016 @ 2:10 am