KML ROIs
ROIs could be stored as .kml
(google-earth) files. Example:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>dummy.kml</name>
<open>1</open>
<Style id="sn_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ffff717c</color>
<width>3</width>
</LineStyle>
</Style>
<StyleMap id="msn_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sn_ylw-pushpin2</styleUrl>
</Pair>
</StyleMap>
<Folder>
<name>Collection of ROIS</name>
<description>Collection description</description>
<Placemark>
<name>Linear feature</name>
<description>Linear feature description</description>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>
110,-35,0 120,-30,0 130,-25,0
</coordinates>
</LineString>
</Placemark>
<Placemark>
<name>Polygon feature</name>
<description>Polygon feature description</description>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<Polygon>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>absolute</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-90,30,0 -30,30,0 -30,0,0 -90,0,0 -90,30,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Folder>
</Document>
</kml>
References: KML documentation
Usage proposal
KmlROIsCollection
should be a ROIsCollectionWithCategories
child:
>>> kml_rois = KmlROIsCollection('dummy.kml', target='Europa')
>>> kml_rois
<KmlROIsCollection> 2 rois | 1 category
>>> kml.categories
<CategoriesCollection> 1 category
- Collection of ROIS
>>> kml.rois
<ROIsCollection> 2 rois
- 1 / Linear feature
- 2 / Polygon feature
Map display should be straightforward:
fig = plt.figure(figsize=(18, 9))
ax = fig.add_subplot(projection=EUROPA)
ax.add_collection(kml_rois);
Multiple files important should be supported and populate the collection with different categories based on the folder name and description:
>>> KmlROIsCollection('dummy.kml', 'foo.kml', 'bar.kml', target='Europa')
<KmlROIsCollection> 25 rois | 3 categories
Note
Support for Linear ROI intersection is not out of the scope of the this issue.
Edited by Benoit Seignovert