FeatureCollection¶
- class geodesic.stac.FeatureCollection(dataset=None, query=None, **obj)[source]¶
Bases:
geodesic.bases._APIObject
A collection of Features that is represented by a GeoJSON FeatureCollection in accordance with RFC7946 (https://datatracker.ietf.org/doc/html/rfc7946)
- Parameters
dataset – a geodesic.entanglement.Dataset associated with the FeatureCollection.
query – a query, if any, used to initialize this from a request to Spacetime or Boson
**obj – the underyling JSON data of the FeatureCollection to specify
- features¶
(list) - this FeatureCollection’s Feature/Item objects
Descriptor:
_FeatureListDescr
- links¶
(dict) - links associated with this collection
Descriptor:
_ListDescr
- property type¶
the type is always FeatureCollection. This fills in for improperly constructed GeoJSON that doesn’t have the “type” field set.
- property gdf¶
Return a geopandas.GeoDataFrame representation of this FeatureCollection
- Returns
a Geopandas GeoDataFrame of this object
- property df¶
Return a Pandas DataFrame representation of this FeatureCollection
- Returns
a Pandas DataFrame of this object
- property sedf¶
Return an ArcGIS API for Python representation of this feature collection as a spatially enabled Pandas DataFrame
- Returns
a Pandas DataFrame of this object with a arcgis.features.GeoAccessor attached.
- property ogr¶
Return an GDAL Dataset with an OGR Layer for this feature collection
- Returns
a gdal.Dataset for this object
- rasterize(property_name=None, dtype=None, reference_dataset=None, shape=None, geo_transform=None, spatial_reference=None, return_dataset=True)[source]¶
Rasterize this FeatureCollection given requirements on the input image
- Parameters
property_name – the name of the property to rasterize
dtype – the numpy datatype you’d like for the output
reference_dataset – a gdal.Dataset (image) that we would like to use as reference. Output will have the same shape, geo_transform, and spatial_reference
shape – a tuple of ints representing the output shape (if reference_dataset is None)
geo_transform – a tuple of affine transformation (if reference_dataset is None)
spatial_reference – the spatial reference of the output (if reference_dataset is None)
return_dataset – return the gdal.Dataset instead of a numpy array.
- static from_geojson_file(path)[source]¶
loads a geojson file and returns a new FeatureCollection
- Parameters
load (path - path to the file to) –
- static from_shapefile(path)[source]¶
loads a shapefile and returns a new FeatureCollection
This method uses pyshp
- Parameters
load (path - path to the file root/prefix to) –
- static from_file_geodatabase(path, layer, **kwargs)[source]¶
loads a layer from a file geodatabase and returns a new FeatureCollection
- Parameters
geodatabase (path - path to the file) –
load (layer - the name of the layer to) –
fiona.open (**kwargs - additional keywords to pass to) –
- static from_gpx(path, layer, **kwargs)[source]¶
loads a GPX file and returns a new FeatureCollection
- Parameters
file (path - path to the GPX) –
waypoints (layer - which layer to read. One of) – on the file
routes – on the file
tracks – on the file
route_points – on the file
track_points (or) – on the file
depending – on the file
fiona.open (**kwargs - additional keywords to pass to) –
- static from_file(path, layer=None, **kwargs)[source]¶
loads geospatial data using fiona and returns a new FeatureCollection
For more details about what can be read with fiona, see the following docs: https://fiona.readthedocs.io/en/latest/
- Parameters
file (path - path to the) –
load (layer - the name of the layer to) –
fiona.open (**kwargs - additional keywords to pass to) –