I'm working with GPS points and want to count how many of them fall within protected areas of 4 countries in Southern Africa (Eswatini, Zimbabwe, Mozambique and South Africa). I get the shape files for each from here https://www.protectedplanet.net/

The issue is there are 1768 GPS data points but I get a count of 1990 points within the protected areas which should be impossible.

I thought it would work out if I did it separately but no luck. The number of overlapping points are 59 from Eswatini, 819 from Mozambique,154 from Zimbabwe and 958 from South Africa which still sums to 1990.

Then I thought maybe some of the protected areas overlap across countries so some points are counted twice but it doesn't look like that's the case either.

I've carried it out in QGIS using Count points in polygon and in R with st_intersects and get the same result.

Here are the GPS data if you'd like to replicate what I've done https://drive.google.com/file/d/1IXTCQXAmQQehxpTmJn9aB4gfp1Bm2RH2/view?usp=sharing

  • 1
    The overlap may be within a given country (two or more polygons / polygon parts of the same country overlap each others). Beware of multiparts
    – JGH
    Commented Mar 20, 2020 at 19:06
  • ah ok, I didn't think of that. How can I blend the multiparts into one?
    – adkane
    Commented Mar 20, 2020 at 19:13
  • By the way, is it possible that some points are out of (any of) the protected areas? If you are sure that each point somehow lies within some protected area then you probably need to use the shapefile of countries (say from Natural Earth data) not the protected areas.
    – datakeen
    Commented Mar 21, 2020 at 21:36
  • They definitely don't all fall within protected areas so I can't do the Natural Earth option unfortunately
    – adkane
    Commented Mar 22, 2020 at 1:43

2 Answers 2


Main problem is overlapping (self-intersection) but, there also are a few multiparts. Following image presents a critical area in Zimbabwe shapefile. You can also observe that there are 182 features in attributes table.

enter image description here

By using 'Multipart to singlepart' method from Processing Tool Box, you can get following result:

enter image description here

Attributes table confirms multipart presence with 184 features.

For eliminating overlapping (but this will create much more features) it can be used 'Polygon-self intersection' tool of Processing Tool Box. Result is observed as follows:

enter image description here

In attributes table it can be observed 301 features (117 features more than single parts layer). This is the reason of your issue.


As pointed by @xunilk, there is probably a problem with your shapefile. Fixing it is a good way to remove your errors. Another quick way is to change the source of your shape file. From Natural Earth Data, using shapefile ne_10m_admin_0_countries.shp give the results as expected.

enter image description here

  • 1
    He needs a shapefile of protected areas; not of administrative areas of countries.
    – xunilk
    Commented Mar 21, 2020 at 18:59
  • Yes, you are right, I didn't fully comprehend it then. But still, the main idea is to change the source of shapefile if possible.
    – datakeen
    Commented Mar 21, 2020 at 21:38

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.