isogeo_pysdk.api.routes_coordinate_systems module

Isogeo API v1 - API Routes to retrieve CoordinateSystems

See: http://help.isogeo.com/api/complete/index.html

class isogeo_pysdk.api.routes_coordinate_systems.ApiCoordinateSystem(api_client=None)

Bases: object

Routes as methods of Isogeo API used to manipulate coordinate-systems.

associate_metadata(metadata, coordinate_system)

Associate a coordinate-system (SRS) to a metadata.

If a coordinate-system is already associated to the metadata, it’ll be oversritten.

Parameters
  • metadata (Metadata) – metadata object to update

  • coordinate_system (CoordinateSystem) – coordinate-system model object to associate

Return type

CoordinateSystem

Example
# retrieve metadata
md = isogeo.metadata.get(
        metadata_id=METADATA_UUID,
        include=()
)
# retrieve one of the SRS selected in the workgroup of the metadata
wg_srs = self.isogeo.coordinate_system.listing(md._creator.get("_id"))
random_srs = CoordinateSystem(**sample(wg_srs, 1)[0])
# associate them
isogeo.coordinateSystem.associate_metadata(
    metadata=md,
    coordinateSystem=random_srs,
)
associate_workgroup(coordinate_system, workgroup=None)

Add a coordinate system to the workgroup selection or/adn edit the SRS custom alias.

Parameters
  • coordinate_system (CoordinateSystem) – EPSG code of the coordinate system to add to the workgroup selection

  • workgroup (Workgroup) – identifier of the owner workgroup.

Return type

CoordinateSystem

Example
# retrieve the SRS
coordsys = isogeo.srs.get("4326")
# add a custom alias
coordsys.alias = "World SRS"
# add it to the workgroup selection
isogeo.srs.associate_workgroup(
    workgroup=isogeo.workgroup.get(WORKGROUP_UUID),
    coordinate_system=coordsys
)
dissociate_metadata(metadata)

Removes the coordinate-system from a metadata.

Parameters

metadata (Metadata) – metadata object to update

Return type

Response

dissociate_workgroup(coordinate_system_code, workgroup_id=None)

Remove a coordinate system from the workgroup selection.

Parameters
  • coordinate_system_code (str) – EPSG code of the coordinate system to reomve from the workgroup selection

  • workgroup_id (str) – identifier of the owner workgroup.

Return type

CoordinateSystem

Example

>>> isogeo.srs.dissociate_workgroup(
    workgroup_id=WORKGROUP_TEST_FIXTURE_UUID,
    coordinate_system_code="2154"
    )
get(coordinate_system_code, workgroup_id=None)

Get details about a specific coordinate_system, from the whole Isogeo database or into a specific workgroup (to get the SRS alias for example).

Parameters
  • workgroup_id (str) – identifier of the owner workgroup. OPTIONNAL: if present, list SRS slected into the workgroup.

  • coordinate_system_code (str) – EPSG code of the coordinate system

Return type

CoordinateSystem

Example

>>> # list all coordinate-systems in the whole Isogeo database
>>> srs = isogeo.srs.listing()
>>> # print details about the first SRS found
>>> pprint.pprint(isogeo.srs.get(srs[0].get("code")))
{
    '_tag': 'coordinate-system:4143',
    'code': 4143,
    'name': 'Abidjan 1987'
}
listing(workgroup_id=None, caching=1)

Get coordinate-systems in the whole Isogeo database or into a specific workgroup.

Parameters
  • workgroup_id (str) – identifier of the owner workgroup. OPTIONNAL: if present, list SRS slected into the workgroup.

  • caching (bool) – option to cache the response

Return type

list

Example

>>> # list all coordinate-systems in the whole Isogeo database
>>> srs = isogeo.srs.listing()
>>> print(len(srs))
4301
>>> # list coordinate-systems which have been selected in a specific workgroup
>>> srs = isogeo.srs.listing(workgroup_id=WORKGROUP_UUID)
>>> print(len(srs))
5