Closed fitoprincipe closed 1 month ago
Hi. I have a kml with a polygon that contains 2 interior rings
I leave it here (for reproduction purposes)
<?xml version="1.0" encoding="utf-8" ?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document id="root_doc"> <Folder><name>test</name> <Placemark> <Polygon> <outerBoundaryIs> <LinearRing><coordinates>-93.7426720226024,57.4519411370713 -93.6051809086549,49.4316261567984 -80.8643376828499,49.5232868994301 -81.2309806533767,57.4519411370713 -81.2309806533767,57.4519411370713 -93.7426720226024,57.4519411370713</coordinates></LinearRing> </outerBoundaryIs> <innerBoundaryIs> <LinearRing><coordinates>-91.8663227028478,56.050879726904 -91.7704563496718,53.9897531336206 -90.1407283456804,54.0856194867966 -90.0927951690924,56.002946550316 -91.8663227028478,56.050879726904</coordinates></LinearRing> </innerBoundaryIs> <innerBoundaryIs> <LinearRing><coordinates>-85.4912102166459,55.90708019714 -85.4912102166459,54.0376863102086 -83.8135490360665,54.0856194867966 -83.9094153892425,55.90708019714 -85.4912102166459,55.90708019714</coordinates></LinearRing> </innerBoundaryIs> </Polygon> </Placemark> </Folder> </Document></kml>
and the code to verify the error:
import fastkml testkml = Path("test.kml") with open(testkml, encoding='utf-8') as f: kml = fastkml.KML.class_from_string(f.read().encode("utf-8")) doc = kml.features[0] folder = doc.features[0] placemark = folder.features[0] pol = placemark.geometry print(len(list(pol.interiors))) # returns 1 when there are clearly 2 interior rings
I'd love to contribute and fix it myself, but I first need to understand how the package works internally and I don't have much time to do that.
Thanks
@fitoprincipe can you pull develop and test again?
Perfect, it works! Thanks @cleder 😃
Hi. I have a kml with a polygon that contains 2 interior rings
I leave it here (for reproduction purposes)
and the code to verify the error:
I'd love to contribute and fix it myself, but I first need to understand how the package works internally and I don't have much time to do that.
Thanks