Performing GIS analysis faster with multiprocessing
Geospatial datasets are very large. Processing them can take time, which can be hours or sometimes even days. But there’s a way you can speed processing up for certain operations. Python’s built-in multiprocessing module can spawn multiple processes on your computer to take advantage of all of the available processors.
One operation that works really well with the multiprocessing module is geocoding. In this example, we’ll geocode a list of cities and split that processing across all of the processors on your machine. We’ll use the same geocoding technique as before, but this time, we’ll add the multiprocessing module to increase the potential for greater speed and scalability. The following code will geocode a list of cities simultaneously across multiple processors:
- First, we import the modules we need:
from geopy.geocoders import Nominatim
- Next, we create our geocoder object, giving...