2

I am trying to parse both the values to the corresponding words to fetch data from GeoServer and return me the value, like this:

route.mergeNewParams({viewparams: "'word1:+source;word2:+target"});

But its not working. In fact no values(source and target) are being assigned to the respective words(word1, word2). I have also tried it to do this way:

route.mergeNewParams({viewparams: "word1:"+source});
route.mergeNewParams({viewparams: "word2:"+target});

But in this case last 2nd call of function is overwriting the 1st call.

1
  • Are source & target string variables? or do you actually want to pass the the string whose value is 'source'? Commented Aug 11, 2014 at 3:46

1 Answer 1

0

You need to understrand that the parameters that you pass to the mergeNewParams function, is infact passed to the OGC Service as a HTTP parameter.

SO whatever parameter you pass, should be a valid HTTP parameters.

I'm assuming that source & target are two string variables that you want to pass. In that case, you can do something like this:

var p="word1:"+source+";word2:"+target;
route.mergeNewParams({"viewparams":encodeURI(p)});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.