Skip to content

Commit

Permalink
write metadata with XML
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Sep 12, 2017
1 parent 32dee44 commit 814ef78
Show file tree
Hide file tree
Showing 7 changed files with 577 additions and 11 deletions.
26 changes: 26 additions & 0 deletions python/core/metadata/qgslayermetadata.sip
Expand Up @@ -382,6 +382,13 @@ class QgsLayerMetadata
:rtype: QgsLayerMetadata.ConstraintList
%End

void addConstraint( const QgsLayerMetadata::Constraint &constraint );
%Docstring
Adds an individual constraint to the existing constraints.
.. seealso:: constraints()
.. seealso:: setConstraints()
%End

void setConstraints( const QgsLayerMetadata::ConstraintList &constraints );
%Docstring
Sets the list of ``constraints`` associated with using the resource.
Expand Down Expand Up @@ -641,6 +648,25 @@ class QgsLayerMetadata
.. seealso:: saveToLayer()
%End

bool readMetadataXml( const QDomElement &metadataElement );
%Docstring
Sets state from Dom document
\param metadataElement The Dom element corresponding to ``resourceMetadata'' tag

:return: true if successful
:rtype: bool
%End

bool writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const;
%Docstring
Stores state in Dom node
\param metadataElement is a Dom element corresponding to ``resourceMetadata'' tag
\param document is a the dom document being written

:return: true if successful
:rtype: bool
%End

};


Expand Down
10 changes: 10 additions & 0 deletions resources/qgis-resource-metadata.xml
Expand Up @@ -15,13 +15,21 @@
</keywords>
<fees>None</fees>
<constraints type="access">None</constraints>
<constraints type="other">None</constraints>
<rights>Copyright foo 2017</rights>
<license>License 1</license>
<license>License 2</license>
<encoding>utf-8</encoding>
<crs>EPSG:4326</crs>
<extent>
<spatial dimensions="2" crs="EPSG:4326" minx="-180" miny="-90" maxx="180" maxy="90"/>
<spatial dimensions="2" crs="EPSG:4326" minx="-180" miny="-90" maxx="180" maxy="90" minz="10" maxz="50"/>
<temporal>
<instant>2001-12-17T09:30:47Z</instant>
<period>
<start>2001-12-17T09:30:47Z</start>
<end>2020-12-17T09:30:47Z</end>
</period>
</temporal>
</extent>
<contact>
Expand All @@ -46,4 +54,6 @@
<link name="geonode:roads" type="OGC:WFS" description="my GeoNode road layer" url="http://example.org/wfs"/>
<link name="roads" type="WWW:LINK" description="full dataset download" url="http://example.org/roads.tgz" format="ESRI Shapefile" mimeType="application/gzip" size="283676"/>
</links>
<history>Buffering</history>
<history>Reprojecting</history>
</ResourceMetadata>
12 changes: 6 additions & 6 deletions resources/qgis-resource-metadata.xsd
Expand Up @@ -84,7 +84,7 @@
<xs:element name="license" type="xs:string" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>License associated with a given resource (examples: http://opendefinition.org/licenses/).</xs:documentation>
</xs:annotation>
</xs:annotation>
</xs:element>
<xs:element name="encoding" type="xs:string" minOccurs="0">
<xs:annotation>
Expand Down Expand Up @@ -122,7 +122,7 @@
<xs:annotation>
<xs:documentation>Freeform description of the history or lineage of the resource.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:element>
</xs:sequence>
<xs:attribute name="version" use="required" fixed="1.0">
<xs:annotation>
Expand Down Expand Up @@ -339,11 +339,11 @@
<xs:attributeGroup ref="rm:linkAttrs"/>
</xs:complexType>
<xs:attributeGroup name="linkAttrs">
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="description" type="xs:string" use="optional"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="url" type="xs:anyURI" use="required"/>
<xs:attribute name="format" type="xs:string" use="optional"/>
<xs:attribute name="description" type="xs:string" use="optional"/>
<xs:attribute name="format" type="xs:string" use="optional"/>
<xs:attribute name="mimeType" type="xs:string" use="optional"/>
<xs:attribute name="size" type="xs:string" use="optional"/>
</xs:attributeGroup>
Expand Down

0 comments on commit 814ef78

Please sign in to comment.