I am trying to iterate over a list of lists of lists... of list of pair of coordinates in python and I want to sum a value to each of these pair of coordinates but I also want to keep the structure.
I think an example is worth more than a thousand words so:
coordinates = [[[-15.418887, 28.180395], [-15.418887, 28.180395]],
[[-15.794088, 28.018681], [-15.794088, 28.018681]]]
This is a very basic example but is not the real case. In the real each of the list has variables lengths except for the pair of coordinates. So maybe there are 4 lists until the list of list of pair coordinates or it could be 3, it is variable
I want to add 3 (for example) to each of these coordinates but keeping the original structure ( I don't want to flat the list of lists of list ....)
Maybe this is useful for trying to answer the question:
- I have a geojson file and I want to move a feature ( a region) to another place. To do this I am trying to sum a constant value to latitude and longitude to each coordinate of the region
- I think this could be done using recursion but I am not sure how
Any help is appreciated.