I have multiple kml files, each containing hundreds of placemarks. I suspect that I accidentally deleted a few placemarks. Since there are too many placemarks, it's not possible form me to count them altogether. So, is there any way to know the number of placemarks in a kml file?

2 Answers 2


Try using Notepad++, a powerful text editor. I use it for a lot of my KML editing, and it has some powerful find/replace tools. These include a "count" function that will let you count the instances of a certain string (eg: "<Placemark"). The Find dialog also includes a "Find in Files" tab, which will allow you to find a string across all files in a directory. While that doesn't have a "count" button, its output includes a count of the total number of instances across all files.

Notepad++ is Windows only, so if you're on another platform you can find similar functionality in something like jEdit, or another advanced text editor.


Since you did not specify which program you want to use, here is a solution using QGIS:

Load the files in QGIS and then right-click on each layer in the Layers Panel and activate the option "Show Feature Count". Now the total number of features in each layer is shown in brackets behind the layer name.

  • R and Python both works for me. May 23, 2017 at 6:49
  • So there is the need to automate that process for you? Then it should be not a big problem to write a small script with the knowledge of @Christiaan Adams answer. However I personally would not write a script, if this is a one time task with only a couple of KML files, since just loading them in QGIS is probably faster. May 23, 2017 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.