Writers#
The writers module provides functions for writing geospatial data to various formats.
- libadalina_core.writers.dataframe_to_geopackage(df: DataFrame | GeoDataFrame | DataFrame, path: str)[source]#
Write a DataFrame to a GeoPackage file. The DataFrame geometry is assumed to use the coordinate reference system specified by libadalina_core.sedona_utils.DEFAULT_EPSG.
- Parameters:
df (pandas.DataFrame or geopandas.GeoDataFrame or pyspark.sql.DataFrame) – The DataFrame to write, which can be a pandas DataFrame, a GeoPandas GeoDataFrame, or a Spark DataFrame.
path (str) – The path to the GeoPackage file where the DataFrame will be saved.
Examples
>>> df = pd.DataFrame({'id': [1, 2], 'geometry': ['POINT(1 1)', 'POINT(2 2)']}) >>> dataframe_to_geopackage(df, 'output.gpkg')