GeoJSON utilities.
Class |
|
Exporter for image or video datasets whose location data and labels are stored in GeoJSON format. |
Class |
|
Importer for image or video datasets whose location data and labels are stored in GeoJSON format. |
Function | extract |
Extracts the coordinates from all geometries in the GeoJSON dictionary. |
Function | geo |
Creates a MongoDB query expression that tests whether the given location field is contained within the specified boundary shape. |
Function | load |
Loads geolocation data for the given samples from the given GeoJSON data. |
Function | parse |
Parses the point into GeoJSON dict representation. |
Function | parse |
Parses the polygon or multi-polygon into GeoJSON dict representation. |
Function | to |
Returns a GeoJSON geometry dict representation for the given location. |
Variable | logger |
Undocumented |
Function | _ensure |
Undocumented |
Function | _make |
Undocumented |
Function | _parse |
Undocumented |
Function | _to |
Undocumented |
Function | _to |
Undocumented |
Function | _to |
Undocumented |
Extracts the coordinates from all geometries in the GeoJSON dictionary.
The dict can have any type supported by the GeoJSON spec, including Feature, FeatureCollection, GeometryCollection, and primitive geometries Point, LineString, Polygon, MultiPoint, MultiLineString, or MultiPolygon.
Parameters | |
d | a GeoJSON dict |
Returns | |
a tuple of |
|
Creates a MongoDB query expression that tests whether the given location field is contained within the specified boundary shape.
Parameters | |
location | the embedded field containing GeoJSON data |
boundary | a fiftyone.core.labels.GeoLocation ,
fiftyone.core.labels.GeoLocations , GeoJSON dict, or
list of coordinates that define a Polygon or
MultiPolygon to search within |
strict:True | whether documents must exist entirely within (True) or intersect (False) the boundary |
Returns | |
a MongoDB query dict |
Loads geolocation data for the given samples from the given GeoJSON data.
The GeoJSON data must be a FeatureCollection whose features have their filename properties populated, which are used to match the provided samples.
Example GeoJSON data:
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -73.99496451958454, 40.66338032487842 ] }, "properties": { "filename": "b1c66a42-6f7d68ca.jpg" } }, { "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [ -73.80992143421788, 40.65611832778962 ], [ -74.02930609818584, 40.60505054722865 ] ] }, "properties": { "filename": "/path/to/b1c81faa-3df17267.jpg" } }, ] }
Parameters | |
samples | a fiftyone.core.collections.SampleCollection |
geojson | a GeoJSON FeatureCollection dict or the path to one on disk |
locationNone | the name of the location field in which to store
the location data, which can be either a
fiftyone.core.labels.GeoLocation or
fiftyone.core.labels.GeoLocations field. If not specified,
then, if there is an existing
fiftyone.core.labels.GeoLocation field, that field is
used, else a new "location" field is created |
skipTrue | whether to skip GeoJSON features with no filename properties (True) or raise an error (False) |
progress:None | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
Parses the point into GeoJSON dict representation.
Parameters | |
arg | Undocumented |
point | a point specified in any of the following formats:
|
Returns | |
a GeoJSON dict of type Point |
Parses the polygon or multi-polygon into GeoJSON dict representation.
Parameters | |
arg | a fiftyone.core.labels.GeoLocation ,
fiftyone.core.labels.GeoLocations , GeoJSON dict, or list
of coordinates that define a Polygon or MultiPolygon to
search within |
Returns | |
a GeoJSON dict of type Polygon or MultiPolygon |
Returns a GeoJSON geometry dict representation for the given location.
Parameters | |
label | a fiftyone.core.labels.GeoLocation o
fiftyone.core.labels.GeoLocations instance |
Returns | |
a GeoJSON dict |