Custom Layers
Now that we have covered the basics of visualizing geospatial data with built-in layers and methods to change the tile provider, we will now focus on defining our custom layers. Custom layers allow you to create more complex data visualizations. They also help with adding more interactivity and animation to them. Creating a custom layer starts by defining a new class that extends the BaseLayer
class that's provided by geoplotlib. Besides the __init__
method, which initializes the class level variables, we also have to, at the very least, extend the draw
method of the BaseLayer
class already provided.
Depending on the nature of your visualization, you might also want to implement the invalidate
method, which takes care of map projection changes such as zooming into your visualization. Both the draw
and invalidate
methods receive a Projection
object that takes care of the latitude and longitude mapping on our two-dimensional viewport. These mapped points can be...