Exporting Geospatial Data in Various Data Formats

Learn how to export geospatial data using GeoPandas and configure it to read or write additional data formats.

Exporting data

It is possible to export geospatial data using GeoPandas and it provides drivers for writing in several file formats. To export geospatial data using GeoPandas, we can use the to_file() method of a GeoDataFrame object. The to_file() method allows us to write the data in a variety of file formats, such as GeoJSON, shapefile, and others.

It can also be used as a tool for converting between file formats. As all the features are stored internally, in memory, as Shapely objects, we can interchange among any supported formats. The supported formats will depend on the FIONA version that is installed on the environment. To get a full list of drivers that are currently supported, we can use the following code snippet that accesses the supported_drivers attribute from FIONA, as shown in the next section.

As an example, let's get the US States and export them to GeoPackage format. The exported file will be available for download in the widget:

Get hands-on with 1200+ tech skills courses.