read_dataframe

Luo_Suppe2026-08-15

gma.gio.read_dataframe

function read_dataframe(df, geom_col = None, crs = "WGS84", encoding = "WKT", gtype = None, **kwargs):

Read pandas DataFrame as gma Layer.

Parameters:

df: DataFrame.

The pandas DataFrame that needs to be read.

Optional:

geom_col = str||None. Default None.

Geometry field name. If None, there is no geometry.

crs = str||int||class. Default 'WGS84'.

The output coordinate system. Can be EPSG, WKT, Proj4, and other types of coordinate characters.

encoding = str. Default 'WKT'.

Type of geometry encoding. Can be Direct/WKT/WKB/PointFromColumns.

If the encoding is "Direct" or not specified, then the field attribute must be set to the name of the source geometry field, if there are multiple source geometry fields. If neither encoding nor field are specified, it is assumed that the name of source geometry field is the value of the name attribute.

If the encoding is "WKT" or "WKB" then the field attribute must be set to the name of the source field containing the WKT or WKB geometry.

If the encoding is "PointFromColumns" then the x, y, z and m attributes must be set to the names of the columns to be used for the X, Y, Z and M coordinates in kwargs. The z and m attributes are optional.

gtype = str||None. Default None.

Output geometry type. Supported geometry type include: 'Point', 'MultiPoint', 'Line', 'MultiLine', 'Polygon', 'MultiPolygon'.

**kwargs:

Other parameters passed to geometry field. For more, see ogr OGRVRTLayer/GeometryField.

(https://gdal.org/en/stable/drivers/vector/vrt.html).

Returns:

Type: Layer.


Last Updated 8/15/2026, 8:42:21 AM