isogeo_pysdk.api.routes_feature_attributes module
Isogeo API v1 - API Routes for FeatureAttributes entities
See: http://help.isogeo.com/api/complete/index.html
- class isogeo_pysdk.api.routes_feature_attributes.ApiFeatureAttribute(api_client=None)
Bases:
object
Routes as methods of Isogeo API used to manipulate feature attributes into a Metadata.
- create(metadata, attribute)
Add a new feature attribute to a metadata (= resource).
- Parameters
metadata (Metadata) – metadata (resource) to edit
attribute (FeatureAttribute) – feature-attribute object to create
- Returns
409 if an attribute with the same name already exists.
- Return type
- Example
>>> # retrieve metadata >>> md = isogeo.metadata.get(METADATA_UUID) >>> # create the attribute locally >>> new_attribute = FeatureAttribute( alias="Code INSEE de la commune", name="INSEE_COM", description="Une commune nouvelle résultant d’un regroupement de communes " "préexistantes se voit attribuer le code INSEE de l’ancienne commune " "désignée comme chef-lieu par l’arrêté préfectoral qui l’institue. " "En conséquence une commune change de code INSEE si un arrêté " "préfectoral modifie son chef-lieu.", dataType="CharacterString (5)", language="fr", ) >>> # add it to the metadata >>> isogeo.metadata.attributes.create(md, new_attribute)
- delete(attribute, metadata=None)
Delete a feature-attribute from a metadata.
- Parameters
attribute (FeatureAttribute) – FeatureAttribute model object to delete
metadata (Metadata) – parent metadata (resource) containing the feature-attribute
- get(metadata_id, attribute_id)
Get details about a specific feature-attribute.
>>> # get a metadata >>> md = isogeo.metadata.get(METADATA_UUID) >>> # list all og its attributes >>> md_attributes = isogeo.metadata.attributes.listing(md) >>> # get the first attribute >>> attribute = isogeo.metadata.attributes.get( metadata_id=md._id, attribute_id=md_attributes[0].get("_id") )
- Return type
- import_from_dataset(metadata_source, metadata_dest, mode='add', case_sensitive_matching=True)
Import feature-attributes from another vector (or DTNG) metadata.
- Parameters
metadata_source (Metadata) – metadata from which to import the attributes
metadata_dest (Metadata) – metadata where to import the attributes
mode (str) –
mode of import, defaults to ‘add’:
’add’: add the attributes except those with a duplicated name
’update’: update only the attributes with the same name
’update_or_add’: update the attributes with the same name or create
: param bool case_sensitive_matching: False to make featureattributes’s name matching case-insensitive when mode == “update”
- Raises
TypeError – if one metadata is not a vector or DTNG
ValueError – if mode is not one of accepted value
- Example
# get the metadata objects md_source = isogeo.metadata.get(METADATA_UUID_SOURCE) md_dest = isogeo.metadata.get(METADATA_UUID_DEST) # launch import isogeo.metadata.attributes.import_from_dataset(md_source, md_dest, "add")
- Return type
- listing(metadata)
Get all feature-attributes of a metadata.
- update(attribute, metadata=None)
Update a feature-attribute.
- Parameters
attribute (FeatureAttribute) – Feature Attribute model object to update
metadata (Metadata) – parent metadata (resource) containing the feature-attribute
- Return type