[OpenLayers-Users] How to change WMS f(time) in several maps?
pascal evano
pascal2833 at gmail.com
Wed Jan 2 12:20:34 PST 2013
Hi,
I need to change WMS layers f(time). To change the time I use the
mergeNewElement function:
update_date= function update_date()
{
var string =
OpenLayers.Util.getElement('year').value + "-" + // ss entendu que get
element by id (year= id ds ce cas).
OpenLayers.Util.getElement('month').value + "-" +
OpenLayers.Util.getElement('day').value + "T" +
OpenLayers.Util.getElement('hour').value + ":" +
OpenLayers.Util.getElement('minute').value + ":00";
wms1.mergeNewParams({'time':string});
wms2.mergeNewParams({'time':string}); }
This function is related with an onchange event in the html part:
<input size="4" type='text' id='year' value="2005"
onchange="update_date()"/>-<input size="2" type="text" id="month"
value="08" onchange="update_date()"/>
... etc
It works but the problem is that I need to put the wms layers in different
maps. So if I change the time, only the last wms (in the last map created)
changes and I need to change all the wms at the same time.
To create the maps and to add the wms, I use this script:
function createmap_S()
{
var imap= -1;
var createmap_B= function()
{
imap= imap+1;
$('body').append('<div class="map"
id="id_map'+imap+'"></div>');
$('body').append('<script
type="text/javascript">createmap("'+imap+'");<\/script>');// Revoir
utilisation des guillemets. <\/script>' = ???
}
return createmap_B;
}
$("#boutton_createmap").click(createmap_S());
$("#boutton_removemap").click(function()
{$(".map:last").remove();});
/////// ADD WMS TO GLOBAL MAP: //////////////
$("#modele1").click(function() {mapelement.addLayer(wms1);});
$("#modele2").click(function() {mapelement.addLayer(wms2);});
So my question is: how can I do to apply each change of time to each wms
present on the screen (i can have 1, 2, 3...). I tried to use JQuery:
$('.olLayerGrid').mergeNewParams but it doesn't work (if I use
$('.olLayerGrid').remove(); it works: it removes all the wms layers but
remove() is a jquery function too!
Any suggestions?
Thanks a lot,
Pascal.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130102/c2f69900/attachment.html>
More information about the Users
mailing list