Exports¶
Related to the Exports API
-
class
koordinates.exports.
ExportManager
(client)¶ Accessor for querying and creating Exports.
Access via the
exports
property of akoordinates.client.Client
instance.-
create
(export)¶ Create and start processing a new Export.
Parameters: export (Export) – The Export to create. Return type: Export
-
croplayers
¶ Returns a manager for querying and listing CropLayer models
Return type: CropLayerManager
-
expand
(*args, **kwargs)¶ Returns an expanded Query view of the model objects. Equivalent to calling
.list().expand()
. Using expansions may have significant performance implications for some API requests. Seekoordinates.base.Query.expand()
.
-
filter
(*args, **kwargs)¶ Returns a filtered Query view of the model objects. Equivalent to calling
.list().filter(...)
. Seekoordinates.base.Query.filter()
.
-
get
(id, expand=[])¶ Fetches a Model instance determined by the value of id.
Parameters: id – numeric ID for the Model.
-
get_formats
()¶ Returns a dictionary of format options keyed by data kind.
{ "vector": { "application/x-ogc-gpkg": "GeoPackage", "application/x-zipped-shp": "Shapefile", #... }, "table": { "text/csv": "CSV (text/csv)", "application/x-ogc-gpkg": "GeoPackage", #... }, "raster": { "image/jpeg": "JPEG", "image/jp2": "JPEG2000", #... }, "grid": { "application/x-ogc-aaigrid": "ASCII Grid", "image/tiff;subtype=geotiff": "GeoTIFF", #... }, "rat": { "application/x-erdas-hfa": "ERDAS Imagine", #... } }
Return type: dict
-
list
()¶ Fetches a set of model objects
Return type: koordinates.base.Query
-
model
¶ alias of
Export
-
order_by
(*args, **kwargs)¶ Returns an ordered Query view of the model objects. Equivalent to calling
.list().order_by(...)
. Seekoordinates.base.Query.order_by()
.
-
validate
(export)¶ Validates an Export.
Parameters: export (Export) – Return type: ExportValidationResponse
-
-
class
koordinates.exports.
Export
(**kwargs)¶ An export is a request to extract data from a Koordinates site into an archive for downloading
Example: >>> export = koordinates.Export() >>> export.crs = "ESPG:4326" >>> export.formats = { "vector": "application/x-zipped-shp" } >>> export.add_item(layer) >>> client.exports.create(export)
-
add_item
(item, **options)¶ Add a layer or table item to the export.
Parameters: item (Layer|Table) – The Layer or Table to add Return type: self
-
cancel
()¶ Cancel the export processing
-
download
(path, progress_callback=None, chunk_size=1048576)¶ Download the export archive.
Warning
If you pass this function an open file-like object as the
path
parameter, the function will not close that file for you.If a
path
parameter is a directory, this function will use the Export name to determine the name of the file (returned). If the calculated download file path already exists, this function will raise a DownloadError.You can also specify the filename as a string. This will be passed to the built-in
open()
and we will read the content into the file.Instead, if you want to manage the file object yourself, you need to provide either a
io.BytesIO
object or a file opened with the ‘b’ flag. See the two examples below for more details.Parameters: - path – Either a string with the path to the location to save the response content, or a file-like object expecting bytes.
- progress_callback (function) – An optional callback function which receives upload progress notifications. The function should take two arguments: the number of bytes recieved, and the total number of bytes to recieve.
- chunk_size (int) – Chunk size in bytes for streaming large downloads and progress reporting. 1MB by default
:returns The name of the automatic filename that would be used. :rtype: str
-
refresh
()¶ Refresh this model from the server.
Updates attributes with the server-defined values. This is useful where the Model instance came from a partial response (eg. a list query) and additional details are required.
Existing attribute values will be overwritten.
-
-
class
koordinates.exports.
ExportValidationResponse
(**kwargs)¶ Repsonse returned by Export validation requests.
-
class
koordinates.exports.
CropLayerManager
(client)¶ Bases:
koordinates.base.Manager
Accessor for querying Crop Layers.
Access via the
exports.croplayers
property of akoordinates.client.Client
instance.-
expand
(*args, **kwargs)¶ Returns an expanded Query view of the model objects. Equivalent to calling
.list().expand()
. Using expansions may have significant performance implications for some API requests. Seekoordinates.base.Query.expand()
.
-
filter
(*args, **kwargs)¶ Returns a filtered Query view of the model objects. Equivalent to calling
.list().filter(...)
. Seekoordinates.base.Query.filter()
.
-
get
(id, expand=[])¶ Fetches a Model instance determined by the value of id.
Parameters: id – numeric ID for the Model.
-
get_feature
(croplayer_id, cropfeature_id)¶ Gets a crop feature
Parameters: - croplayer_id (int) – ID of a cropping layer
- cropfeature_id (int) – ID of a cropping feature
Return type:
-
list
()¶ Fetches a set of model objects
Return type: koordinates.base.Query
-
model
¶ alias of
CropLayer
-
order_by
(*args, **kwargs)¶ Returns an ordered Query view of the model objects. Equivalent to calling
.list().order_by(...)
. Seekoordinates.base.Query.order_by()
.
-
-
class
koordinates.exports.
CropLayer
(**kwargs)¶ A crop layer provides features that can be used to crop exports to a geographic extent.
-
get_feature
(cropfeature_id)¶ Gets a crop feature
Parameters: cropfeature_id (int) – ID of a cropping feature Return type: CropFeature
-
refresh
()¶ Refresh this model from the server.
Updates attributes with the server-defined values. This is useful where the Model instance came from a partial response (eg. a list query) and additional details are required.
Existing attribute values will be overwritten.
-
-
class
koordinates.exports.
CropFeatureManager
(client)¶ Accessor for querying Crop Features.
-
expand
(*args, **kwargs)¶ Returns an expanded Query view of the model objects. Equivalent to calling
.list().expand()
. Using expansions may have significant performance implications for some API requests. Seekoordinates.base.Query.expand()
.
-
filter
(*args, **kwargs)¶ Returns a filtered Query view of the model objects. Equivalent to calling
.list().filter(...)
. Seekoordinates.base.Query.filter()
.
-
get
(id, expand=[])¶ Fetches a Model instance determined by the value of id.
Parameters: id – numeric ID for the Model.
-
list
()¶ Fetches a set of model objects
Return type: koordinates.base.Query
-
model
¶ alias of
CropFeature
-
order_by
(*args, **kwargs)¶ Returns an ordered Query view of the model objects. Equivalent to calling
.list().order_by(...)
. Seekoordinates.base.Query.order_by()
.
-
-
class
koordinates.exports.
CropFeature
(**kwargs)¶ A crop feature provides complex pre-defined geographic extents for cropping and clipping Exports.
-
refresh
()¶ Refresh this model from the server.
Updates attributes with the server-defined values. This is useful where the Model instance came from a partial response (eg. a list query) and additional details are required.
Existing attribute values will be overwritten.
-