Tabular Coordinates: GeoSeries and Geometry Collections
Explore how to spatialize tabular coordinate data by converting latitude and longitude into GeoSeries and GeoDataFrames using GeoPandas. Understand how to combine different geometries such as points and polygons into GeometryCollections for advanced geospatial analysis and visualization, including filtering and plotting techniques with real-world datasets.
We'll cover the following...
Spatializing tabular coordinates
When working with points, it is common for our data to come in .csv files with geographic coordinates representing simple points. In such scenarios, we need to spatialize these coordinates in GeoPandas to create the corresponding Point geometries. For that, GeoPandas has a handy method called .points_from_xy. Let's see how it works.
We can see that the last two columns, X and Y, are expressed in geographic coordinates (i.e., latitude and longitude, respectively). Now, let’s convert them to a GeoSeries and set it as a geometry in a GeoDataFrame.
The result of the points_from_xy() method is a GeoSeries object. In the next ...