TileWMS - updateParams Problem with using variable

37 views
Skip to first unread message

GIP ATGERI

unread,
Apr 16, 2021, 7:06:30 AM4/16/21
to OpenLayers Dev

Hello

We want to ask the OpenLayers community about the updateParams method of the TileWMS object.

The problem we have is the following:

 We need to use a variable which contains JSON in the updateParams method.

It seems this method does not allow it.

 Example that does not work:

 (here newObjSourceWMS is an object TileWMS)

 let param="{'test_new_param' : 'value_param'}";

newObjSourceWMS.updateParamsparam);

 

Example that does work:

newObjSourceWMS.updateParams( {'test_new_param': 'value_param'});


Is there a possible solution to this problem?

Or how can we ask for an improvement of this method?


Thanks for helping.



Olivier Guyot

unread,
Apr 19, 2021, 3:26:19 AM4/19/21
to OpenLayers Dev on behalf of GIP ATGERI
Hi,

Your question is actually not related to OpenLayers but to Javascript in general. A string representing a JSON object can easily be transformed into an actual object using `JSON.parse(stringJson)`. This will throw in case of invalid syntax.

Cheers,
--
camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Olivier Guyot
Geospatial Developer


--
You received this message because you are subscribed to the Google Groups "OpenLayers Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlayers-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlayers-dev/00e0b62f-481d-4266-8e9d-56c7818a85afn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages