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)[source]

Bases: object

Routes as methods of Isogeo API used to manipulate feature attributes into a Metadata.

create(metadata: isogeo_pysdk.models.metadata.Metadata, attribute: isogeo_pysdk.models.feature_attributes.FeatureAttribute) → isogeo_pysdk.models.feature_attributes.FeatureAttribute[source]

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:

FeatureAttribute or tuple

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: isogeo_pysdk.models.feature_attributes.FeatureAttribute, metadata: isogeo_pysdk.models.metadata.Metadata = None)[source]

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: str, attribute_id: str) → isogeo_pysdk.models.feature_attributes.FeatureAttribute[source]

Get details about a specific feature-attribute.

Parameters:
  • metadata_id (str) – metadata UUID
  • attribute_id (str) – feature-attribute UUID
Example:
>>> # 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")
    )
import_from_dataset(metadata_source: isogeo_pysdk.models.metadata.Metadata, metadata_dest: isogeo_pysdk.models.metadata.Metadata, mode: str = 'add') → bool[source]

Import feature-attributes from another vector 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
Raises:
  • TypeError – if one metadata is not a vector
  • 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")
listing(metadata: isogeo_pysdk.models.metadata.Metadata) → list[source]

Get all feature-attributes of a metadata.

Parameters:metadata (Metadata) – metadata (resource)
update(attribute: isogeo_pysdk.models.feature_attributes.FeatureAttribute, metadata: isogeo_pysdk.models.metadata.Metadata = None) → isogeo_pysdk.models.feature_attributes.FeatureAttribute[source]

Update a feature-attribute.

Parameters:
  • attribute (FeatureAttribute) – Feature Attribute model object to update
  • metadata (Metadata) – parent metadata (resource) containing the feature-attribute