I need to form a set of variables according to the following pattern:
var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg'; var imageBounds = [[40.712216, -74.22655], [46.773941, -79.12544]]; All the data I need is in a variable in the form of arrays of objects:
[Object, Object, Object, Object, Object]
This is how I iterate over them:
rasters_previews_list.forEach(function(item) { console.log(item.imageUrl); console.log(item.imageBounds); }); The coordinates in the array are stored in my form:
POLYGON((12.562 14.603,8.416 13.653,9.156 9.205,13.294 10.094,12.562 14.603))
I also need just such a format as above.
[40.712216, -74.22655], [46.773941, -79.12544]
Ie the first group, the second is missing and the third group. It should be:
[12.562 14.603], [9.156 9.205]
Those. as a result of traversing a group of objects, I should receive pairs:
imageUrl imageBounds
Each of these pairs I will pass to the function:
L.imageOverlay(imageUrl, imageBounds).addTo(Window.map)
The problem is that I can’t understand how to write an iteration on item.imageBounds to select only the first or third value from there and convert it to the specified form.