KML issues on creating new place

Hi all

I am having a problem uploading a kml boundary. I have read through all the topics already on the forum regarding this - I cannot add my issue to any of those topics because they’ve all been closed. And none of the solutions offered work for me.

So here is the code:

<?xml version="1.0" encoding="utf-8" ?> BDC4 Buffelsdrift ff0000ff0 -1 0 -1 21.1336032103734,-33.5608366972388,0 21.1502134595832,-33.5680463687612,0 21.1532638611271,-33.5650194117482,0 21.1581458528527,-33.5649916419242,0 21.1623119907997,-33.5701877829472,0 21.1707262932608,-33.5704890712517,0 21.1845407841117,-33.5647017383325,0 21.1796162590946,-33.554224609808,0 21.1777763687072,-33.5565178007464,0 21.1686859754654,-33.55791386435,0 21.1656791584332,-33.5647722188242,0 21.1582080727413,-33.5626345126673,0 21.158134170121,-33.5648329507152,0 21.1496713944382,-33.5562635158864,0 21.1558947573473,-33.5469124204869,0 21.1550768797171,-33.546032774946,0 21.1555779796947,-33.545401080783,0 21.153649057265,-33.5447109257731,0 21.1536510277255,-33.5434345802305,0 21.1522139640725,-33.5421150684315,0 21.1249671933835,-33.5394807951277,0 21.1195597465095,-33.5402118542917,0 21.1205866556544,-33.5428430137596,0 21.1188536721953,-33.5598986504002,0 21.0937258472405,-33.5656580533478,0 21.0942649247352,-33.5709157934837,0 21.0988075793164,-33.5749213970546,0 21.1140409433443,-33.5787291245186,0 21.1168475872069,-33.5863007347855,0 21.1236628938289,-33.5869835022136,0 21.1267186499335,-33.585373627664,0 21.1286508238309,-33.5826022048186,0 21.1284779937143,-33.5818982220812,0 21.1277885215157,-33.5813048024031,0 21.125922447662,-33.5803944503292,0 21.1227102652623,-33.5798573390528,0 21.1196355118692,-33.579098715417,0 21.1187827766603,-33.5764860202563,0 21.1188405197461,-33.5741312819526,0 21.1197477938474,-33.5711013839421,0 21.1208972417562,-33.5696811044366,0 21.1249020079829,-33.5705606900717,0 21.1255159655679,-33.5665977544155,0 21.1336032103734,-33.5608366972388,0 Other 10000 ff0000ff0 -1 0 -1 21.1499059851301,-33.5457113697876,0 21.1503025906302,-33.546069717614,0 21.1517997388908,-33.5448527046185,0 21.1514788897153,-33.5445597466288,0 21.1499059851301,-33.5457113697876,0 Wim ff0000ff0 -1 0 -1 21.1478111743292,-33.5535428599266,0 21.1493109521018,-33.5511664828095,0 21.148367262012,-33.5499025655784,0 21.1499624468431,-33.5489214481359,0 21.148741728241,-33.5481997657385,0 21.1454870457545,-33.5491992310194,0 21.1448412672878,-33.5490699533828,0 21.1443582822469,-33.5491432354563,0 21.14400353213,-33.54994171498,0 21.1439179912773,-33.5499110588682,0 21.1432263663205,-33.5486697399344,0 21.1422036873219,-33.5478515510698,0 21.1365535348602,-33.5465661416353,0 21.1361137688657,-33.5491015357891,0 21.1405472809073,-33.5486810551707,0 21.1418125275787,-33.5497993535496,0 21.1431663738477,-33.5487418355691,0 21.1438831759008,-33.5499526298096,0 21.1429845107806,-33.5524409178844,0 21.1478111743292,-33.5535428599266,0

And this is what it is supposed to look like:

Could it be the extra polygons in the middle which are not part of the Conservancy area? Perhaps I could just include them, wouldn’t make much difference to the data.

Thank you for your time!

{Edit: it looks like not all the code shows here…?}

So, because I can be a bit impatient ;-) I tried the polygon without any of the inner polygons, and it worked!

https://www.inaturalist.org/places/buffelsdrift-conservancy-ladismith-wc-za

I would still like to know if it is possible to use polygons with inner rings, because I’m sure I (or others) will need to know this.

It is possible to make places with inner rings (see here). But it is not uncommon when drawing that sort of thing to cause “invalid geometries” (at least that is what QGIS calls it).

Thanks, De Waal!

I tried with the original created on goog (by someone else) and that wouldn’t upload. So I tried saving it again from Q (making no changes). This certainly cleaned up the code!! But it still wouldn’t work :-(

In QGIS you can run an algorithm called “fix geometries” which sometimes does the trick…

I do it all the time, without issue, using Google My Maps. I’ve heard the inner polygons referred to as ‘donut holes’.

Consider loading your file into MyMaps - hit refresh & export. Maybe it handles it differently?

I downloaded your place KML file and added three crudely shaped donut holes using Google My Maps, then uploaded it back into iNaturalist - https://www.inaturalist.org/places/buffelsdrif

https://www.inaturalist.org/observations?place_id=217035&subview=map.

To answer your question - yes, you can absolutely upload places with donut holes.

you need to format that text as preformatted text, or else the forum will try to interpret it as Markdown.

based on the text of the KML that is visible, however, the issue seems to be that the KML is not formatted properly for the purposes of iNat, which is expecting your file to contain a single feature that is either a polygon or multipolygon. your KML text doesn’t have the proper tags that would define that polygon feature. so just whatever process you used to create that first version of the KML file is not producing output that iNat expects.

Thank you all very much! What a wonderful and generous community.

My power and wifi might be charitably called “iffy” this morning. I will work with all the info you’ve given me when things are a bit more reliable. Assuming the sun comes out today ;-D

I sent you a message with a link that may be of interest.

Right, so this is where I’m at:

  • Tried @pdwhugo 's suggestion of “Fix geometries” in QGIS. No such menu item (supposed to be Vector → Geometry tools, but it aint there. Maybe coz I’m on Linux?)
  • So tried the next best thing Vector → Geometry tools → Check validity… No errors or invalid geometries were found.
  • @pisum please would you let me know where the errors are in this coding? Will try to paste it here as preformatted text.
<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="root_doc">
<Schema name="BDC4" id="BDC4">
	<SimpleField name="timestamp" type="string"></SimpleField>
	<SimpleField name="begin" type="string"></SimpleField>
	<SimpleField name="end" type="string"></SimpleField>
	<SimpleField name="altitudeMode" type="string"></SimpleField>
	<SimpleField name="tessellate" type="int"></SimpleField>
	<SimpleField name="extrude" type="int"></SimpleField>
	<SimpleField name="visibility" type="int"></SimpleField>
	<SimpleField name="drawOrder" type="int"></SimpleField>
	<SimpleField name="icon" type="string"></SimpleField>
</Schema>
<Folder><name>BDC4</name>
  <Placemark>
	<name>Buffelsdrift</name>
	<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
	<ExtendedData><SchemaData schemaUrl="#BDC4">
		<SimpleData name="tessellate">-1</SimpleData>
		<SimpleData name="extrude">0</SimpleData>
		<SimpleData name="visibility">-1</SimpleData>
	</SchemaData></ExtendedData>
      <Polygon><outerBoundaryIs><LinearRing><coordinates>21.1336032103734,-33.5608366972388,0 21.1502134595832,-33.5680463687612,0 21.1532638611271,-33.5650194117482,0 21.1581458528527,-33.5649916419242,0 21.1623119907997,-33.5701877829472,0 21.1707262932608,-33.5704890712517,0 21.1845407841117,-33.5647017383325,0 21.1796162590946,-33.554224609808,0 21.1777763687072,-33.5565178007464,0 21.1686859754654,-33.55791386435,0 21.1656791584332,-33.5647722188242,0 21.1582080727413,-33.5626345126673,0 21.158134170121,-33.5648329507152,0 21.1496713944382,-33.5562635158864,0 21.1558947573473,-33.5469124204869,0 21.1550768797171,-33.546032774946,0 21.1555779796947,-33.545401080783,0 21.153649057265,-33.5447109257731,0 21.1536510277255,-33.5434345802305,0 21.1522139640725,-33.5421150684315,0 21.1249671933835,-33.5394807951277,0 21.1195597465095,-33.5402118542917,0 21.1205866556544,-33.5428430137596,0 21.1188536721953,-33.5598986504002,0 21.0937258472405,-33.5656580533478,0 21.0942649247352,-33.5709157934837,0 21.0988075793164,-33.5749213970546,0 21.1140409433443,-33.5787291245186,0 21.1168475872069,-33.5863007347855,0 21.1236628938289,-33.5869835022136,0 21.1267186499335,-33.585373627664,0 21.1286508238309,-33.5826022048186,0 21.1284779937143,-33.5818982220812,0 21.1277885215157,-33.5813048024031,0 21.125922447662,-33.5803944503292,0 21.1227102652623,-33.5798573390528,0 21.1196355118692,-33.579098715417,0 21.1187827766603,-33.5764860202563,0 21.1188405197461,-33.5741312819526,0 21.1197477938474,-33.5711013839421,0 21.1208972417562,-33.5696811044366,0 21.1249020079829,-33.5705606900717,0 21.1255159655679,-33.5665977544155,0 21.1336032103734,-33.5608366972388,0</coordinates></LinearRing></outerBoundaryIs></Polygon>
  </Placemark>
  <Placemark>
	<name>Other 10000</name>
	<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
	<ExtendedData><SchemaData schemaUrl="#BDC4">
		<SimpleData name="tessellate">-1</SimpleData>
		<SimpleData name="extrude">0</SimpleData>
		<SimpleData name="visibility">-1</SimpleData>
	</SchemaData></ExtendedData>
      <Polygon><outerBoundaryIs><LinearRing><coordinates>21.1499059851301,-33.5457113697876,0 21.1503025906302,-33.546069717614,0 21.1517997388908,-33.5448527046185,0 21.1514788897153,-33.5445597466288,0 21.1499059851301,-33.5457113697876,0</coordinates></LinearRing></outerBoundaryIs></Polygon>
  </Placemark>
  <Placemark>
	<name>Wim</name>
	<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
	<ExtendedData><SchemaData schemaUrl="#BDC4">
		<SimpleData name="tessellate">-1</SimpleData>
		<SimpleData name="extrude">0</SimpleData>
		<SimpleData name="visibility">-1</SimpleData>
	</SchemaData></ExtendedData>
      <Polygon><outerBoundaryIs><LinearRing><coordinates>21.1478111743292,-33.5535428599266,0 21.1493109521018,-33.5511664828095,0 21.148367262012,-33.5499025655784,0 21.1499624468431,-33.5489214481359,0 21.148741728241,-33.5481997657385,0 21.1454870457545,-33.5491992310194,0 21.1448412672878,-33.5490699533828,0 21.1443582822469,-33.5491432354563,0 21.14400353213,-33.54994171498,0 21.1439179912773,-33.5499110588682,0 21.1432263663205,-33.5486697399344,0 21.1422036873219,-33.5478515510698,0 21.1365535348602,-33.5465661416353,0 21.1361137688657,-33.5491015357891,0 21.1405472809073,-33.5486810551707,0 21.1418125275787,-33.5497993535496,0 21.1431663738477,-33.5487418355691,0 21.1438831759008,-33.5499526298096,0 21.1429845107806,-33.5524409178844,0 21.1478111743292,-33.5535428599266,0</coordinates></LinearRing></outerBoundaryIs></Polygon>
  </Placemark>
</Folder>
</Document></kml>

Thank you for all your help and suggestions, @sc_beetles ! I will come back to you if I am unable to clean up the code with @pisum 's help.

your KML file defines 3 individual polygon features rather than 1 polygon feature with inner rings. (each <Placemark></Placemark> tag defines a separate feature, and you have 3 of these.)

the correct feature looks like this:

  <Placemark>
	<name>Buffelsdrift</name>
	<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
	<ExtendedData><SchemaData schemaUrl="#BDC4">
		<SimpleData name="tessellate">-1</SimpleData>
		<SimpleData name="extrude">0</SimpleData>
		<SimpleData name="visibility">-1</SimpleData>
	</SchemaData></ExtendedData>
      <MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>21.1255159655679,-33.5665977544155,0 21.1249020079829,-33.5705606900717,0 21.1208972417562,-33.5696811044366,0 21.1197477938474,-33.5711013839421,0 21.1188405197461,-33.5741312819526,0 21.1187827766603,-33.5764860202563,0 21.1196355118692,-33.579098715417,0 21.1227102652623,-33.5798573390528,0 21.125922447662,-33.5803944503292,0 21.1277885215157,-33.5813048024031,0 21.1284779937143,-33.5818982220812,0 21.1286508238309,-33.5826022048186,0 21.1267186499335,-33.585373627664,0 21.1236628938289,-33.5869835022136,0 21.1168475872069,-33.5863007347855,0 21.1140409433443,-33.5787291245186,0 21.0988075793164,-33.5749213970546,0 21.0942649247352,-33.5709157934837,0 21.0937258472405,-33.5656580533478,0 21.1188536721953,-33.5598986504002,0 21.1205866556544,-33.5428430137596,0 21.1195597465095,-33.5402118542917,0 21.1249671933835,-33.5394807951277,0 21.1522139640725,-33.5421150684315,0 21.1536510277255,-33.5434345802305,0 21.153649057265,-33.5447109257731,0 21.1555779796947,-33.545401080783,0 21.1550768797171,-33.546032774946,0 21.1558947573473,-33.5469124204869,0 21.1496713944382,-33.5562635158864,0 21.158134170121,-33.5648329507152,0 21.1582080727413,-33.5626345126673,0 21.1656791584332,-33.5647722188242,0 21.1686859754654,-33.55791386435,0 21.1777763687072,-33.5565178007464,0 21.1796162590946,-33.554224609808,0 21.1845407841117,-33.5647017383325,0 21.1707262932608,-33.5704890712517,0 21.1623119907997,-33.5701877829472,0 21.1581458528527,-33.5649916419242,0 21.1532638611271,-33.5650194117482,0 21.1502134595832,-33.5680463687612,0 21.1336032103734,-33.5608366972388,0 21.1255159655679,-33.5665977544155,0</coordinates></LinearRing></outerBoundaryIs><innerBoundaryIs><LinearRing><coordinates>21.1478111743292,-33.5535428599266,0 21.1493109521018,-33.5511664828095,0 21.148367262012,-33.5499025655784,0 21.1499624468431,-33.5489214481359,0 21.148741728241,-33.5481997657385,0 21.1454870457545,-33.5491992310194,0 21.1448412672878,-33.5490699533828,0 21.1443582822469,-33.5491432354563,0 21.14400353213,-33.54994171498,0 21.1439179912773,-33.5499110588682,0 21.1432263663205,-33.5486697399344,0 21.1422036873219,-33.5478515510698,0 21.1365535348602,-33.5465661416353,0 21.1361137688657,-33.5491015357891,0 21.1405472809073,-33.5486810551707,0 21.1418125275787,-33.5497993535496,0 21.1431663738477,-33.5487418355691,0 21.1438831759008,-33.5499526298096,0 21.1429845107806,-33.5524409178844,0 21.1478111743292,-33.5535428599266,0</coordinates></LinearRing></innerBoundaryIs><innerBoundaryIs><LinearRing><coordinates>21.1499059851301,-33.5457113697876,0 21.1503025906302,-33.546069717614,0 21.1517997388908,-33.5448527046185,0 21.1514788897153,-33.5445597466288,0 21.1499059851301,-33.5457113697876,0</coordinates></LinearRing></innerBoundaryIs></Polygon></MultiGeometry>
  </Placemark>

it has one polygon with one outer ring and two inner rings defined.

so you can either replace your placemarks with mine in a text editor, subtract the 2 small features from the large feature in your GIS tool, or redraw the inner rings correctly as inner rings rather than as separate polygons.

1 Like

Thank you :folded_hands:

I inherited the original polygons and did not draw them myself. I am also not that clued up on GIS. You have now given me the tools to go ahead and conquer a new frontier! I am forever grateful!

Will let you know how it goes…

While I’m here - how does one find the id number of a project? It is pretty easy to find the id number of a place but I’m struggling to find it for projects so that I can use your project widget code.

The fastest way I know of is to add .json to the end of the project URL.

Oh, you are all so incredibly talented and generous, thank you!

  • @Pisum 's code works perfectly, so I have updated the Place.
  • @sc_beetles thank you for all your suggestions. You can now delete the Buffelsdrif place you created.
  • @bouteloua thank you, I found the project ID using your json hack.

And I have learnt a whole new suite of useful things! Feeling very accomplished ;-)

A sparkly day to you all :-)

3 Likes

This was created using Google My Maps - I started with a rectangle and edited it. It’s still shown as a single polygon and it took me less than 5 minutes. For the average user, this is probably a better solution. It’s free and reasonably intuitive. I can easily draw donut holes, islands and chips off the old block (my terms) & 𝗻𝗼 𝗰𝗼𝗱𝗶𝗻𝗴 𝗿𝗲𝗾𝘂𝗶𝗿𝗲𝗱!

1 Like