import geopandas as gpd
# Path to the GPKG file
gpkg_path = 'path/to/file.gpkg'
# Load the GPKG into a GeoDataFrame
gdf_gpkg = gpd.read_file(gpkg_path)
# Display the GeoDataFrame
print(gdf_gpkg.head())
import geopandas as gpd
import shutil
from zipfile import ZipFile
# Path to the KMZ file
kmz_path = 'path/to/file.kmz'
kml_path = 'destination/path/file.kml'
# Extract the KML from the KMZ file
with ZipFile(kmz_path, 'r') as kmz:
kmz.extractall('destination/path/')
# Load the KML into a GeoDataFrame
gdf_kmz = gpd.read_file(kml_path)
# Display the GeoDataFrame
print(gdf_kmz.head())
import geopandas as gpd
import json
from topojson import topojson
# Path to the TopoJSON file
topojson_path = 'path/to/file.topojson'
# Load the TopoJSON and convert it to GeoDataFrame
with open(topojson_path, 'r') as f:
topojson_data = json.load(f)
gdf_topojson = gpd.GeoDataFrame.from_features(topojson(topojson_data))
# Display the GeoDataFrame
print(gdf_topojson.head())
import geopandas as gpd
# Path to the GML file
gml_path = 'path/to/file.gml'
# Load the GML into a GeoDataFrame
gdf_gml = gpd.read_file(gml_path)
# Display the GeoDataFrame
print(gdf_gml.head())
For DXF files, you may use the ezdxf library. You can install it using pip install ezdxf
import geopandas as gpd
import ezdxf
# Path to the DXF file
dxf_path = 'path/to/file.dxf'
# Load the DXF into a GeoDataFrame
doc = ezdxf.readfile(dxf_path)
msp = doc.modelspace()
gdf_dxf = gpd.GeoDataFrame(geometry=[entity.geometry for entity in msp.query('LINE')])
# Display the GeoDataFrame
print(gdf_dxf.head())
import geopandas as gpd
# Path to the Geoparquet file
parquet_path = 'path/to/file.parquet'
# Load the Geoparquet into a GeoDataFrame
gdf_geoparquet = gpd.read_parquet(parquet_path)
# Display the GeoDataFrame
print(gdf_geoparquet.head())