xyzspaces.tools module¶
This is a preliminary collection of little tools that use XYZ.
- xyzspaces.tools.subset_geojson(gj, config=None, bbox=None, tile_type=None, tile_id=None, clip=False, lat=None, lon=None, radius=None)[source]¶
Return a subset of the GeoJSON object inside some bbox or map tile or radius.
This will create a temporary space, add the provided GeoJSON object, perform the bbox or tile subsetting and return the resulting GeoJSON object after deleting the temporary space again.
- Parameters
config (Optional[xyzspaces.config.default.XYZConfig]) – An object of class:XYZConfig, If not provied
XYZ_TOKEN
will be used from environment variable and other configurations will be used as defined indefault_config
.gj (dict) – The GeoJSON data object.
bbox (Optional[List[float]]) – The bounding box described as a list of four numbers (its West, South, East, and North margins).
tile_type (Optional[str]) – The tile type, for now one of: …
tile_id (Optional[str]) – The tile ID, a string composed of digits to identify the tile according to the specified tile type.
clip (Optional[bool]) – A Boolean to indicate if the features should be clipped at the tile or bbox.
lat (Optional[float]) – A float to represent latitude.
lon (Optional[float]) – A float to represent longitude.
radius (Optional[int]) – An int in meter which defines the diameter of the search request. Should be provided with
lat
andlon
for spatial search.
- Returns
A GeoJSON object covering the desired tile or bbox subset of the original GeoJSON object.
- Raises
ValueError – If the wrong combination of
bbox
,tile_type
andtile_id
,lat
andlon
was provided.- Return type
dict