GeoAPI examples in Python

GeoAPI provides a set of Java and Python language programming interfaces for geospatial applications. Those interfaces closely follow the abstract models published collaboratively by ISO and OGC. GeoAPI does not provide implementations except bridges between programming languages; implementations must be obtained from other projects.

Contrarily to Java where a standard mechanism exists for discovering implementations at run time, GeoAPI does not provide guidance at this time about how to discover Python implementations. The examples in this page assume that the first step is implementation-specific. After the first line of code, all properties are derived from OGC/ISO specifications.

Get metadata properties
# Following line is implementation-specific.
md = my_implementation.getMetadata()

# Assuming that `md` type is opengis.metadata.base.Metadata,
# all remaining lines below should be implementation-neutral.
# This API uses properties derived from OGC/ISO specifications.

axis0 = md.spatial_representation_info[0].axis_dimension_properties[0]
axis1 = md.spatial_representation_info[0].axis_dimension_properties[1]

print("Resource title:      ", md.identification_info[0].citation.title)
print("Resource scope:      ", md.metadata_scope[0].resource_scope)
print("Name of first axis:  ", axis0.dimension_name)
print("Size of first axis:  ", axis0.dimension_size)
print("Name of second axis: ", axis1.dimension_name)
print("Size of second axis: ", axis1.dimension_size)