Trying to read naturalearthdatas shapefile vers. 4 "ne_110m_admin_0_countries.shp" with the python-ogr.modul I encounter a problem. inspecting the file with the following code-snippet:
counter = 0
for in_feat in in_lyr:
counter += 1
print("Kopiere Geometrie Nr.", counter)
geom = in_feat.geometry()
print(geom)
if ((geom.GetGeometryCount() > 1) and (geom.GetGeometryName() == "POLYGON")):
errortext = "FEHLER"
else:
errortext =""
print(anzahl ,":", geom.GetGeometryName(), " Anzahl der Ringe:", geom.GetGeometryCount(),errortext)
I am getting one shape, which looks strange to me . the object nr 26 looks like this:
POLYGON ((16.3449768408952 -28.5767050106977,16.8240173682409 -28.0821615536645,17.2189286638154 -28.3559432919468,17.3874971859515 -28.7835140927298,17.8361519711095 -28.8563778622613,18.4648991228048 -29.0454619280173,19.0021273129111 -28.9724431291889,19.8947343278886 -28.4611048316608,19.8957678565344 -24.7677902157606,20.1657255388272 -24.9179619280008,20.7586092465118 -25.8681364885514,20.6664701677354 -26.4774533017049,20.8896090023717 -26.8285429826959,21.6058960303694 -26.7265337053518,22.1059688656579 -26.2802560360791,22.5795316911806 -25.9794475237081,22.8242712745149 -25.5004586727948,23.3120967953502 -25.2686898739657,23.7335697771227 -25.3901294898516,24.2112667172288 -25.6702157528736,25.0251705258258 -25.7196700985769,25.6646663754377 -25.4868160946697,25.7658488298652 -25.1748454729237,25.9416520525222 -24.6963733863332,26.4857532081233 -24.6163265927131,26.7864066911974 -24.2406906063835,27.1194096208862 -23.5743230119798,28.0172359555253 -22.8277535946591,29.432188348109 -22.0913127580676,29.839036899543 -22.1022164852812,30.3228833350918 -22.2716118303339,30.6598653500671 -22.1515674781199,31.1914091326213 -22.2515096981724,31.6703979835347 -23.6589690080739,31.9305888201243 -24.3694165992225,31.7524084815819 -25.4842839494874,31.8377779477281 -25.8433318010513,31.3331575863979 -25.660190525009,31.0440796241571 -25.7314523251394,30.9496667823599 -26.0226490211042,30.6766085141296 -26.3980783017046,30.6859619483745 -26.7438453101695,31.2827730649133 -27.285879408479,31.8680603370511 -27.1779273414213,32.0716654802811 -26.7338200823049,32.8301204770289 -26.7421916643362,32.5802649268977 -27.4701575660318,32.4621326026785 -28.3010112444206,32.203388706193 -28.7524048804901,31.5210014177789 -29.2573869768463,31.325561150851 -29.4019776343989,30.9017627296253 -29.909956963828,30.6228133481138 -30.4237757301061,30.0557161801428 -31.140269463833,28.9255526059195 -32.1720411109725,28.2197558936771 -32.7719528134489,27.464608188596 -33.2269637997788,26.4194523454928 -33.6149504534262,25.9096643409335 -33.6670402971764,25.7806282895007 -33.9446460914483,25.172861769316 -33.7968514950936,24.6778532243921 -33.9871757952246,23.5940434099346 -33.7944743792082,22.9881889177447 -33.916430759417,22.5741573422222 -33.8640825335053,21.542799106541 -34.2588387997829,20.689052768647 -34.4171753883252,20.0712610205976 -34.795136814108,19.6164050635646 -34.8191663551237,19.1932784359587 -34.4625989723098,18.8553145687699 -34.4443055152785,18.4246431820494 -33.997872816709,18.3774109229346 -34.1365206845481,18.2444991390799 -33.867751560198,18.2500801937674 -33.2814307594144,17.9251904639484 -32.6112907854534,18.2479097836112 -32.4291313616246,18.2217615088715 -31.6616329892257,17.5669177588689 -30.7257211239875,17.0644161312627 -29.8786410458592,17.0629175147262 -29.87595387138,16.3449768408952 -28.5767050106977),(28.9782625668572 -28.9555966122617,28.5417000668555 -28.6475017229376,28.0743384132078 -28.8514686011936,27.5325110206275 -29.2427108700754,26.9992619158076 -29.87595387138,27.7493970069565 -30.6451058896122,28.1072046241454 -30.545732110315,28.2910693702399 -30.2262167294543,28.8483996925077 -30.0700505510683,29.018415154748 -29.7437655575774,29.3251664568326 -29.2573869768463,28.9782625668572 -28.9555966122617))
it is a POLYGON but has TWO rings ?? It's South Africa by the way.
Strange enough the shapefile is valid, when I check it in QGIS.
Does the Shapefile-format allow POLYGONS with more than one ring? I thought only MULTIPOLYGONS are allowed to have more than one ring.