Skip to content

Commit 814ef78

Browse files
committed
write metadata with XML
1 parent 32dee44 commit 814ef78

File tree

7 files changed

+577
-11
lines changed

7 files changed

+577
-11
lines changed

python/core/metadata/qgslayermetadata.sip

+26
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,13 @@ class QgsLayerMetadata
382382
:rtype: QgsLayerMetadata.ConstraintList
383383
%End
384384

385+
void addConstraint( const QgsLayerMetadata::Constraint &constraint );
386+
%Docstring
387+
Adds an individual constraint to the existing constraints.
388+
.. seealso:: constraints()
389+
.. seealso:: setConstraints()
390+
%End
391+
385392
void setConstraints( const QgsLayerMetadata::ConstraintList &constraints );
386393
%Docstring
387394
Sets the list of ``constraints`` associated with using the resource.
@@ -641,6 +648,25 @@ class QgsLayerMetadata
641648
.. seealso:: saveToLayer()
642649
%End
643650

651+
bool readMetadataXml( const QDomElement &metadataElement );
652+
%Docstring
653+
Sets state from Dom document
654+
\param metadataElement The Dom element corresponding to ``resourceMetadata'' tag
655+
656+
:return: true if successful
657+
:rtype: bool
658+
%End
659+
660+
bool writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const;
661+
%Docstring
662+
Stores state in Dom node
663+
\param metadataElement is a Dom element corresponding to ``resourceMetadata'' tag
664+
\param document is a the dom document being written
665+
666+
:return: true if successful
667+
:rtype: bool
668+
%End
669+
644670
};
645671

646672

resources/qgis-resource-metadata.xml

+10
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@
1515
</keywords>
1616
<fees>None</fees>
1717
<constraints type="access">None</constraints>
18+
<constraints type="other">None</constraints>
1819
<rights>Copyright foo 2017</rights>
20+
<license>License 1</license>
21+
<license>License 2</license>
1922
<encoding>utf-8</encoding>
2023
<crs>EPSG:4326</crs>
2124
<extent>
2225
<spatial dimensions="2" crs="EPSG:4326" minx="-180" miny="-90" maxx="180" maxy="90"/>
26+
<spatial dimensions="2" crs="EPSG:4326" minx="-180" miny="-90" maxx="180" maxy="90" minz="10" maxz="50"/>
2327
<temporal>
2428
<instant>2001-12-17T09:30:47Z</instant>
29+
<period>
30+
<start>2001-12-17T09:30:47Z</start>
31+
<end>2020-12-17T09:30:47Z</end>
32+
</period>
2533
</temporal>
2634
</extent>
2735
<contact>
@@ -46,4 +54,6 @@
4654
<link name="geonode:roads" type="OGC:WFS" description="my GeoNode road layer" url="http://example.org/wfs"/>
4755
<link name="roads" type="WWW:LINK" description="full dataset download" url="http://example.org/roads.tgz" format="ESRI Shapefile" mimeType="application/gzip" size="283676"/>
4856
</links>
57+
<history>Buffering</history>
58+
<history>Reprojecting</history>
4959
</ResourceMetadata>

resources/qgis-resource-metadata.xsd

+6-6
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<xs:element name="license" type="xs:string" minOccurs="1" maxOccurs="unbounded">
8585
<xs:annotation>
8686
<xs:documentation>License associated with a given resource (examples: http://opendefinition.org/licenses/).</xs:documentation>
87-
</xs:annotation>
87+
</xs:annotation>
8888
</xs:element>
8989
<xs:element name="encoding" type="xs:string" minOccurs="0">
9090
<xs:annotation>
@@ -122,7 +122,7 @@
122122
<xs:annotation>
123123
<xs:documentation>Freeform description of the history or lineage of the resource.</xs:documentation>
124124
</xs:annotation>
125-
</xs:element>
125+
</xs:element>
126126
</xs:sequence>
127127
<xs:attribute name="version" use="required" fixed="1.0">
128128
<xs:annotation>
@@ -339,11 +339,11 @@
339339
<xs:attributeGroup ref="rm:linkAttrs"/>
340340
</xs:complexType>
341341
<xs:attributeGroup name="linkAttrs">
342-
<xs:attribute name="name" type="xs:string"/>
343-
<xs:attribute name="type" type="xs:string"/>
344-
<xs:attribute name="description" type="xs:string" use="optional"/>
342+
<xs:attribute name="name" type="xs:string" use="required"/>
343+
<xs:attribute name="type" type="xs:string" use="required"/>
345344
<xs:attribute name="url" type="xs:anyURI" use="required"/>
346-
<xs:attribute name="format" type="xs:string" use="optional"/>
345+
<xs:attribute name="description" type="xs:string" use="optional"/>
346+
<xs:attribute name="format" type="xs:string" use="optional"/>
347347
<xs:attribute name="mimeType" type="xs:string" use="optional"/>
348348
<xs:attribute name="size" type="xs:string" use="optional"/>
349349
</xs:attributeGroup>

0 commit comments

Comments
 (0)