gws.plugin.geojson.provider

GeoJSON provider.

Source code: gws.plugin.geojson.provider

Module Contents

class gws.plugin.geojson.provider.Config(*args, **kwargs)

Bases: gws.Config

Access to a GeoJSON file.

path: gws.FilePath

Path to a GeoJSON file.

class gws.plugin.geojson.provider.Object

Bases: gws.Node

GeoJSON file provider.

Reads the features of a GeoJSON file into feature records and selects the records that match a search.

path: str

Path to the GeoJSON file.

cache_hash()

Return a hash that identifies the data of the provider.

Returns:

A hash of the file path.

configure()

Configuration hook.

Called when the node is initialized. Raising an exception here aborts the creation of the node.

get_records(search: gws.SearchQuery) → list[gws.FeatureRecord]

Return the records that match a search.

A record matches if its shape intersects the search shape, extended by the tolerance, or, without a shape, the search bounds; if one of its attribute values contains the keyword, ignoring case; and if its uid is one of the search uids. Criteria not set in the search are ignored.

Parameters:

search – The search query.

Returns:

The matching records.

load_records()

Return all records of the file.

The file is read on the first call.

Returns:

The feature records.