Get startedGet started for free

Buffer around a point

Consider the city of Goma, the capital of the North Kivu province of Congo, close to the border with Rwanda. Its coordinates are 1.66°S 29.22°E (the Point is already provided in UTM coordinates as the goma variable).

How many mining sites are located within 50 km of Goma? And how much area of national park? Let's determine that using the buffer operation. Remember that distances should be expressed in the unit of the CRS (i.e. in meter in this case).

Note: if you have a boolean Series (for example as result of a spatial relationship method), then you can calculate how many True values (ie. how many geometries passed the check) by taking the sum of those booleans because in that case the True and False values will be seen as ones and zeros.

This exercise is part of the course

Working with Geospatial Data in Python

View Course

Exercise instructions

  • Create a buffer of 50 km around goma, and assign it to a variable goma_buffer.
  • Check which of the points of mining_sites are located within this buffer (and call this mask). Count those sites by taking the sum of the boolean mask, and print this result.
  • Calculate the intersections of the national parks with the buffer. Take the sum of the area of those intersections, and print the result in km².

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# goma is a Point
print(type(goma))

# Create a buffer of 50km around Goma
goma_buffer = ____

# The buffer is a polygon
print(type(goma_buffer))

# Check how many sites are located within the buffer
mask = ____
print(____)

# Calculate the area of national park within the buffer
print(national_parks.____ / (1000**2))
Edit and Run Code