How can I create a custom shape (polygon) using Json object with coordinates after OnClick event in Javascript?
I've tried the following but I'm getting an error: Uncaught TypeError: a3.slice is not a function
function initialize(sender, eventArgs) {{
var shapeData = {{
""type"": ""GeometryCollection"",
""geometries"": [
{{
""type"": ""LineString"",
""coordinates"": [
[
12.47633,
41.9106979
],
[
12.4764271,
41.9060326
],
[
12.4664,
41.90369
],
[
12.4535074,
41.90665
],
[
12.47633,
41.9106979
]
]
}}
]
}};
var originalOptions = eventArgs.get_options();
originalOptions.layers[1].dataSource = {{ data: shapeData }};
eventArgs.set_options(originalOptions);
}}