isogeo_pysdk.api.routes_format module
Isogeo API v1 - API Routes for Formats entities
See: http://help.isogeo.com/api/complete/index.html
NOTE: format being the name of a Python built-in function (see: https://docs.python.org/3/library/functions.html#format), we use the frmt shorter as replacement.
- class isogeo_pysdk.api.routes_format.ApiFormat(api_client=None)
Bases:
object
Routes as methods of Isogeo API used to manipulate formats.
- create(frmt, check_exists=1)
Add a new format to the Isogeo formats database.
If a format with the same code already exists, the Isogeo API returns a 500 HTTP code. To prevent this error, use the check_exists option or check by yourself before.
- Parameters
- Return type
- Example
format_to_add = Format( code="geojson", name="GeoJSON", type="vectorDataset" ) isogeo.formats.create(format_to_add)
- delete(frmt)
Delete a format from Isogeo database.
- Parameters
frmt (Format) – Format model object to delete
- get(format_code)
Get details about a specific format.
>>> pprint.pprint(isogeo.formats.get("postgis")) { '_id': string (uuid), '_tag': 'format:postgis', 'aliases': [], 'code': 'postgis', 'name': 'PostGIS', 'type': 'dataset', 'versions': [ '2.2', '2.1', '2.0', '1.5', '1.4', '1.3', '1.2', '1.1', '1.0', '0.9', None ] }
- listing(data_type=None, caching=1)
List formats available in Isogeo API.
- Parameters
- Returns
list of dicts
- Return type
- Example
>>> formats = isogeo.formats.listing() >>> # count all formats >>> print(len(formats)) 32 >>> # count formats which are only for vector dataset >>> print(len(isogeo.formats.listing(data_type="vector-dataset"))) 21 >>> # list all unique codes >>> formats_codes = [i.get("code") for i in formats] >>> pprint.pprint(formats_codes) [ 'apic', 'arcsde', 'dgn', 'dwg', 'dxf', ... ]
- nogeo_search(query=None, page_size=10, offset=0)
Search within data formats available in Isogeo API for NON GEOGRAPHICAL DATA ONLY.
- Parameters
- Returns
list of dicts
- Return type
- Example
>>> isogeo.formats.search(query="a", page_size=1, offset=0) [ { 'aliases': [], 'name': 'Adobe PDF', 'versions': [ '7', '1.7', None, None ] } ]
- update(frmt)
Update a format in Isogeo database.
>>> # retrieve format to update >>> fmt_postgis = isogeo.formats.get("postgis") >>> # add new versions locally >>> fmt_postgis.versions.extend(["3.0", "3.1"]) >>> # update online >>> fmt_postgis_updted = isogeo.formats.update(fmt_postgis)