dataiter.GeoJSON

__init__() read() to_data_frame() write()

class dataiter.GeoJSON(*args, **kwargs)[source]

A class for GeoJSON data.

GeoJSON is a simple wrapper class that reads GeoJSON features into a DataFrame. Any operations on the data are thus done with methods provided by the data frame class. Geometry is available in the “geometry” column, but no special geometric operations are supported.

All other data is available in the “metadata” attribute as an attd.AttributeDict.

__init__(*args, **kwargs)[source]

Return a new GeoJSON object.

args and kwargs are like for dict.

https://docs.python.org/3/library/stdtypes.html#dict

classmethod read(path, *, encoding='utf-8', columns=[], strings_as_object=inf, dtypes={}, **kwargs)[source]

Return data from GeoJSON file path.

Will automatically decompress if path ends in .bz2|.gz|.xz.

columns is an optional list of columns to limit to.

strings_as_object is a cutoff point. If any row has more characters than that, the whole column will use the object data type. This is intended to help limit memory use as NumPy strings are fixed-length and can take a huge amount of memory if even a single row is long. If set, dtypes overrides this.

dtypes is an optional dict mapping column names to NumPy datatypes.

kwargs are passed to json.load.

to_data_frame(drop_geometry=False)[source]

Return GeoJSON converted to a regular data frame.

write(path, *, encoding='utf-8', **kwargs)[source]

Write data to GeoJSON file path.

Will automatically compress if path ends in .bz2|.gz|.xz.

kwargs are passed to json.dump.