Now that we have the basics on how to work with polygons and we know how to represent and store them, we will go back to our app and add the ability to import geospatial files containing polygons. As we did with the points, we will abstract the features into the Python objects and we will also use class inheritance.
First, let's look at the code we already wrote. In the
models.py file, we have the
class PointCollection(object): def __init__(self, file_path=None): """This class represents a group of vector data.""" self.data =  self.epsg = None if file_path: self.import_data(file_path) def __add__(self, other): self.data += other.data return self def import_data(self, file_path): """Opens an vector file ...