GeoJSONVectorSource#
- class GeoJSONVectorSource[source]#
Bases:
VectorSourceA
VectorSourcefor reading GeoJSON files.Attributes
- __init__(uris: Union[str, List[str]], crs_transformer: CRSTransformer, vector_transformers: List[VectorTransformer] = [], ignore_crs_field: bool = False, bbox: Optional[Box] = None)[source]#
Constructor.
- Parameters
uris (Union[str, List[str]]) – URI(s) of the GeoJSON file(s).
crs_transformer (CRSTransformer) – A
CRSTransformerto convert between map and pixel coords. Normally this is obtained from aRasterSource.vector_transformers (List[VectorTransformer]) –
VectorTransformersfor transforming geometries. Defaults to[].ignore_crs_field (bool) – Ignore the CRS specified in the file and assume WGS84 (EPSG:4326) coords. Only WGS84 is supported currently. If False, and the file contains a CRS, will throw an exception on read. Defaults to False.
bbox (Optional[Box]) – User-specified crop of the extent. If None, the full extent available in the source file is used.
Methods
__init__(uris, crs_transformer[, ...])Constructor.
get_dataframe([window, to_map_coords])Return geometries as a
GeoDataFrame.get_geojson([window, to_map_coords])Return transformed GeoJSON.
get_geoms([window, to_map_coords])Returns all geometries in the transformed GeoJSON as Shapely geoms.
- __init__(uris: Union[str, List[str]], crs_transformer: CRSTransformer, vector_transformers: List[VectorTransformer] = [], ignore_crs_field: bool = False, bbox: Optional[Box] = None)[source]#
Constructor.
- Parameters
uris (Union[str, List[str]]) – URI(s) of the GeoJSON file(s).
crs_transformer (CRSTransformer) – A
CRSTransformerto convert between map and pixel coords. Normally this is obtained from aRasterSource.vector_transformers (List[VectorTransformer]) –
VectorTransformersfor transforming geometries. Defaults to[].ignore_crs_field (bool) – Ignore the CRS specified in the file and assume WGS84 (EPSG:4326) coords. Only WGS84 is supported currently. If False, and the file contains a CRS, will throw an exception on read. Defaults to False.
bbox (Optional[Box]) – User-specified crop of the extent. If None, the full extent available in the source file is used.
- get_dataframe(window: Optional[Box] = None, to_map_coords: bool = False) geopandas.GeoDataFrame#
Return geometries as a
GeoDataFrame.- Parameters
- Return type
- get_geojson(window: Optional[Box] = None, to_map_coords: bool = False) dict#
Return transformed GeoJSON.
This makes the following transformations to the raw geojson:
converts to pixels coords (by default)
removes empty features
splits apart multi-geoms and geom collections into single geometries
buffers lines and points into Polygons
Additionally, the transformations specified by all the VectorTransformers in vector_transformers are also applied.