geodesymiami / rsmas_insar

RSMAS InSAR code
https://rsmas-insar.readthedocs.io/
GNU General Public License v3.0
58 stars 22 forks source link

Need `get_boundingBox_from_kml.py` #508

Closed falkamelung closed 2 years ago

falkamelung commented 2 years ago

Hi @ranneylxr , Can I ask you one more thing? In Tibet I get failures of dem.py for large areas (segmentation fault because of memory issues). I therefore need to use smaller DEMs with the size as needed. The coordinates can be determined from the frame edge coordinates in the ssara*.km file.

We need a script

get_boundingBox_from_kml.py   ssara_search_20211019042049.kml —delta_lat 0.5 —delta_lon 1.2

which reads the *kml file and outputs lat_min, lat_mx, lon_min, lon_max so that I can populate the field:

topsStack.boundingBox               = 29.8 42.2 83.0 101.0    

For that it needs to read the edge coordinates of each scene from the kml file for all scenes (example see below) and find the minima and maxima (delta_lat and delta_lon will be added/substracted from the maxima/minima. Then round to one decimal so that get e.g. 29.8

grep coordinate ssara_search_20211019042049.kml | head
                <LineString><tessellate>1</tessellate><coordinates>85.640167,29.636723,0 85.957916,31.258827,0 88.541267,30.859928,0 88.179314,29.235296,0 85.640167,29.636723,0 </coordinates></LineString>
                <LineString><tessellate>1</tessellate><coordinates>85.939568,31.129709,0 86.259186,32.751427,0 88.891426,32.353722,0 88.524109,30.729675,0 85.939568,31.129709,0 </coordinates></LineString>
                <LineString><tessellate>1</tessellate><coordinates>86.229782,32.62389,0 86.55146,34.2453,0 89.228081,33.850132,0 88.855125,32.226585,0 86.229782,32.62389,0 </coordinates></LineString>
                <LineString><tessellate>1</tessellate><coordinates>86.529373,34.117035,0 86.853577,35.737755,0 89.583588,35.343887,0 89.204178,33.721252,0 86.529373,34.117035,0 </coordinates></LineString>
                <LineString><tessellate>1</tessellate><coordinates>86.825974,35.610241,0 87.164429,37.286438,0 89.950035,36.894432,0 89.550102,35.216492,0 86.825974,35.610241,0 </coordinates></LineString>
                <LineString><tessellate>1</tessellate><coordinates>87.146637,37.150719,0 87.512848,38.942448,0 90.37133,38.550575,0 89.933876,36.757309,0 87.146637,37.150719,0 </coordinates></LineString>