Tabular Coordinates: GeoSeries and Geometry Collections
Learn how to transform tabular coordinates into a GeoSeries and how to combine different geometries using Geometry Collections.
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 ...