geopandas.GeoDataFrame.to_wkb#

GeoDataFrame.to_wkb(hex=False, **kwargs)[source]#

Encode all geometry columns in the GeoDataFrame to WKB.

Parameters:
hexbool

If true, export the WKB as a hexadecimal string. The default is to return a binary bytes object.

kwargs

Additional keyword args will be passed to shapely.to_wkb().

Returns:
DataFrame

geometry columns are encoded to WKB

Notes

The Well-Known Binary (WKB) specification does not support all variations of geometry types that GeoPandas does, and some geometries may not be serialised without information loss. Notably:

  • LinearRing will be converted to LineString

  • Empty Points will be converted to Points with NaN as coordinates (but will be read by from_wkb() as empty Points).