QGIS API Documentation 3.99.0-Master (e9821da5c6b)
Loading...
Searching...
No Matches
qgsmetadatautils.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsmetadatautils.cpp
3 -------------------
4 begin : April 2021
5 copyright : (C) 2021 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "qgsmetadatautils.h"
19
20#include "qgslayermetadata.h"
21
22#include <QDomDocument>
23#include <QString>
24#include <QTextDocumentFragment>
25
26using namespace Qt::StringLiterals;
27
29{
30 QgsLayerMetadata metadata;
31 const QDomElement metadataElem = document.firstChildElement( u"metadata"_s );
32
33 const QDomElement esri = metadataElem.firstChildElement( u"Esri"_s );
34 const QDomElement dataProperties = esri.firstChildElement( u"DataProperties"_s );
35 const QDomElement itemProps = dataProperties.firstChildElement( u"itemProps"_s );
36 metadata.setIdentifier( itemProps.firstChildElement( u"itemName"_s ).text() );
37
38 const QDomElement dataIdInfo = metadataElem.firstChildElement( u"dataIdInfo"_s );
39 const QDomElement idInfo = metadataElem.firstChildElement( u"idinfo"_s );
40
41 // title
42 const QDomElement idCitation = dataIdInfo.firstChildElement( u"idCitation"_s );
43 const QString title = idCitation.firstChildElement( u"resTitle"_s ).text();
44 metadata.setTitle( title );
45
46 // if no explicit identifier we use the title
47 if ( metadata.identifier().isEmpty() && !title.isEmpty() )
48 metadata.setIdentifier( title );
49
50 const QDomElement citationDatesElement = idCitation.firstChildElement( u"date"_s ).toElement();
51 if ( !citationDatesElement.isNull() )
52 {
53 {
54 const QDomElement createDateElement = citationDatesElement.firstChildElement( u"createDate"_s ).toElement();
55 if ( !createDateElement.isNull() )
56 {
57 metadata.setDateTime( Qgis::MetadataDateType::Created, QDateTime::fromString( createDateElement.text(), Qt::ISODate ) );
58 }
59 }
60 {
61 const QDomElement pubDateElement = citationDatesElement.firstChildElement( u"pubDate"_s ).toElement();
62 if ( !pubDateElement.isNull() )
63 {
64 metadata.setDateTime( Qgis::MetadataDateType::Published, QDateTime::fromString( pubDateElement.text(), Qt::ISODate ) );
65 }
66 }
67 {
68 const QDomElement reviseDateElement = citationDatesElement.firstChildElement( u"reviseDate"_s ).toElement();
69 if ( !reviseDateElement.isNull() )
70 {
71 metadata.setDateTime( Qgis::MetadataDateType::Revised, QDateTime::fromString( reviseDateElement.text(), Qt::ISODate ) );
72 }
73 }
74 {
75 const QDomElement supersededDateElement = citationDatesElement.firstChildElement( u"supersDate"_s ).toElement();
76 if ( !supersededDateElement.isNull() )
77 {
78 metadata.setDateTime( Qgis::MetadataDateType::Superseded, QDateTime::fromString( supersededDateElement.text(), Qt::ISODate ) );
79 }
80 }
81 }
82
83 // abstract
84 const QDomElement idAbs = dataIdInfo.firstChildElement( u"idAbs"_s );
85 const QString abstractPlainText = QTextDocumentFragment::fromHtml( idAbs.text() ).toPlainText();
86 metadata.setAbstract( abstractPlainText );
87
88 // purpose
89 const QDomElement idPurp = dataIdInfo.firstChildElement( u"idPurp"_s );
90 const QString purposePlainText = QTextDocumentFragment::fromHtml( idPurp.text() ).toPlainText();
91 if ( !metadata.abstract().isEmpty() )
92 metadata.setAbstract( metadata.abstract() + u"\n\n"_s + purposePlainText );
93 else
94 metadata.setAbstract( purposePlainText );
95
96 // older metadata format used "descript" element instead
97 const QDomElement descript = idInfo.firstChildElement( u"descript"_s );
98 if ( !descript.isNull() )
99 {
100 const QDomElement abstract = descript.firstChildElement( u"abstract"_s );
101 const QString abstractPlainText = QTextDocumentFragment::fromHtml( abstract.text() ).toPlainText();
102 if ( !abstractPlainText.isEmpty() )
103 {
104 if ( !metadata.abstract().isEmpty() )
105 metadata.setAbstract( metadata.abstract() + u"\n\n"_s + abstractPlainText );
106 else
107 metadata.setAbstract( abstractPlainText );
108 }
109
110 const QDomElement purpose = descript.firstChildElement( u"purpose"_s );
111 const QString purposePlainText = QTextDocumentFragment::fromHtml( purpose.text() ).toPlainText();
112 if ( !purposePlainText.isEmpty() )
113 {
114 if ( !metadata.abstract().isEmpty() )
115 metadata.setAbstract( metadata.abstract() + u"\n\n"_s + purposePlainText );
116 else
117 metadata.setAbstract( purposePlainText );
118 }
119
120 const QDomElement supplinf = descript.firstChildElement( u"supplinf"_s );
121 const QString supplinfPlainText = QTextDocumentFragment::fromHtml( supplinf.text() ).toPlainText();
122 if ( !supplinfPlainText.isEmpty() )
123 {
124 if ( !metadata.abstract().isEmpty() )
125 metadata.setAbstract( metadata.abstract() + u"\n\n"_s + supplinfPlainText );
126 else
127 metadata.setAbstract( supplinfPlainText );
128 }
129 }
130
131 // supplementary info
132 const QDomElement suppInfo = dataIdInfo.firstChildElement( u"suppInfo"_s );
133 const QString suppInfoPlainText = QTextDocumentFragment::fromHtml( suppInfo.text() ).toPlainText();
134 if ( !suppInfoPlainText.isEmpty() )
135 {
136 if ( !metadata.abstract().isEmpty() )
137 metadata.setAbstract( metadata.abstract() + u"\n\n"_s + suppInfoPlainText );
138 else
139 metadata.setAbstract( suppInfoPlainText );
140 }
141
142 // language
143 const QDomElement dataLang = dataIdInfo.firstChildElement( u"dataLang"_s );
144 const QDomElement languageCode = dataLang.firstChildElement( u"languageCode"_s );
145 const QString language = languageCode.attribute( u"value"_s ).toUpper();
146 metadata.setLanguage( language );
147
148 // keywords
149 QDomElement searchKeys = dataIdInfo.firstChildElement( u"searchKeys"_s );
150 QStringList keywords;
151 while ( !searchKeys.isNull() )
152 {
153 QDomElement keyword = searchKeys.firstChildElement( u"keyword"_s );
154 while ( !keyword.isNull() )
155 {
156 keywords << keyword.text();
157 keyword = keyword.nextSiblingElement( u"keyword"_s );
158 }
159
160 searchKeys = searchKeys.nextSiblingElement( u"searchKeys"_s );
161 }
162
163 // categories
164 QDomElement themeKeys = dataIdInfo.firstChildElement( u"themeKeys"_s );
165 QStringList categories;
166 while ( !themeKeys.isNull() )
167 {
168 const QDomElement thesaName = themeKeys.firstChildElement( u"thesaName"_s );
169 const QString thesaTitle = thesaName.firstChildElement( u"resTitle"_s ).text();
170
171 const bool isSearchKeyWord = thesaTitle.compare( "Common Search Terms"_L1, Qt::CaseInsensitive ) == 0;
172
173 QDomElement themeKeyword = themeKeys.firstChildElement( u"keyword"_s );
174 while ( !themeKeyword.isNull() )
175 {
176 if ( isSearchKeyWord )
177 {
178 keywords.append( themeKeyword.text().split( ',' ) );
179 }
180 else
181 {
182 categories << themeKeyword.text();
183 }
184 themeKeyword = themeKeyword.nextSiblingElement( u"keyword"_s );
185 }
186 themeKeys = themeKeys.nextSiblingElement( u"themeKeys"_s );
187 }
188
189 // older xml format
190 QDomElement keywordsElem = idInfo.firstChildElement( u"keywords"_s );
191 while ( !keywordsElem.isNull() )
192 {
193 QDomElement theme = keywordsElem.firstChildElement( u"theme"_s );
194 while ( !theme.isNull() )
195 {
196 categories << theme.firstChildElement( u"themekey"_s ).text();
197 theme = theme.nextSiblingElement( u"theme"_s );
198 }
199
200 keywordsElem = keywordsElem.nextSiblingElement( u"keywords"_s );
201 }
202
203 if ( !categories.isEmpty() )
204 metadata.setCategories( categories );
205
206 if ( !keywords.empty() )
207 metadata.addKeywords( QObject::tr( "Search keys" ), keywords );
208
210
211 // pubDate
212 const QDomElement date = idCitation.firstChildElement( u"date"_s );
213 const QString pubDate = date.firstChildElement( u"pubDate"_s ).text();
214 const QDateTime publicationDate = QDateTime::fromString( pubDate, Qt::ISODate );
215 if ( publicationDate.isValid() )
216 {
217 extent.setTemporalExtents( { publicationDate, QDateTime() } );
218 }
219 else
220 {
221 // older XML format
222 QDomElement timeperd = idInfo.firstChildElement( u"timeperd"_s );
223 while ( !timeperd.isNull() )
224 {
225 if ( timeperd.firstChildElement( u"current"_s ).text().compare( "publication date"_L1 ) == 0 )
226 {
227 const QDomElement timeinfo = timeperd.firstChildElement( u"timeinfo"_s );
228 const QDomElement sngdate = timeinfo.firstChildElement( u"sngdate"_s );
229 if ( !sngdate.isNull() )
230 {
231 const QDomElement caldate = sngdate.firstChildElement( u"caldate"_s );
232 const QString caldateString = caldate.text();
233 const QDateTime publicationDate = QDateTime::fromString( caldateString, u"MMMM yyyy"_s );
234 if ( publicationDate.isValid() )
235 {
236 extent.setTemporalExtents( { publicationDate, QDateTime() } );
237 break;
238 }
239 }
240 const QDomElement rngdates = timeinfo.firstChildElement( u"rngdates"_s );
241 if ( !rngdates.isNull() )
242 {
243 const QDomElement begdate = rngdates.firstChildElement( u"begdate"_s );
244 const QDomElement enddate = rngdates.firstChildElement( u"enddate"_s );
245 const QString begdateString = begdate.text();
246 const QString enddateString = enddate.text();
247 QDateTime begin;
248 QDateTime end;
249 for ( const QString format : { "yyyy-MM-dd", "dd/MM/yyyy" } )
250 {
251 if ( !begin.isValid() )
252 begin = QDateTime::fromString( begdateString, format );
253 if ( !end.isValid() )
254 end = QDateTime::fromString( enddateString, format );
255 }
256
257 if ( begin.isValid() || end.isValid() )
258 {
259 extent.setTemporalExtents( {QgsDateTimeRange{ begin, end } } );
260 break;
261 }
262 }
263 }
264
265 timeperd = timeperd.nextSiblingElement( u"timeperd"_s );
266 }
267 }
268
269 //crs
271 QDomElement refSysInfo = metadataElem.firstChildElement( u"refSysInfo"_s );
272 while ( !refSysInfo.isNull() )
273 {
274 const QDomElement refSystem = refSysInfo.firstChildElement( u"RefSystem"_s );
275 const QDomElement refSysID = refSystem.firstChildElement( u"refSysID"_s );
276 const QDomElement identAuth = refSysID.firstChildElement( u"identAuth"_s );
277 if ( !identAuth.isNull() )
278 {
279 if ( identAuth.firstChildElement( u"resTitle"_s ).text().compare( "EPSG Geodetic Parameter Dataset"_L1 ) == 0 )
280 {
281 const QString code = refSysID.firstChildElement( u"identCode"_s ).attribute( u"code"_s );
282 crs = QgsCoordinateReferenceSystem( code );
283 }
284 }
285 else
286 {
287 const QString code = refSysID.firstChildElement( u"identCode"_s ).attribute( u"code"_s );
288 const QString auth = refSysID.firstChildElement( u"idCodeSpace"_s ).text();
289 crs = QgsCoordinateReferenceSystem( u"%1:%2"_s.arg( auth, code ) );
290 }
291
292 if ( crs.isValid() )
293 {
294 metadata.setCrs( crs );
295 break;
296 }
297 refSysInfo = refSysInfo.nextSiblingElement( u"refSysInfo"_s );
298 }
299
300 // extent
301 QDomElement dataExt = dataIdInfo.firstChildElement( u"dataExt"_s );
302 while ( !dataExt.isNull() )
303 {
304 const QDomElement geoEle = dataExt.firstChildElement( u"geoEle"_s );
305 if ( !geoEle.isNull() )
306 {
307 const QDomElement geoBndBox = geoEle.firstChildElement( u"GeoBndBox"_s );
308 const double west = geoBndBox.firstChildElement( u"westBL"_s ).text().toDouble();
309 const double east = geoBndBox.firstChildElement( u"eastBL"_s ).text().toDouble();
310 const double south = geoBndBox.firstChildElement( u"northBL"_s ).text().toDouble();
311 const double north = geoBndBox.firstChildElement( u"southBL"_s ).text().toDouble();
312
314 spatialExtent.extentCrs = crs.isValid() ? crs : QgsCoordinateReferenceSystem( u"EPSG:4326"_s );
315 spatialExtent.bounds = QgsBox3D( west, south, 0, east, north, 0 );
316
317 extent.setSpatialExtents( { spatialExtent } );
318 break;
319 }
320 dataExt = dataExt.nextSiblingElement( u"dataExt"_s );
321 }
322
323 metadata.setExtent( extent );
324
325 // licenses, constraints
326 QStringList licenses;
327 QStringList rights;
329 QDomElement resConst = dataIdInfo.firstChildElement( u"resConst"_s );
330 while ( !resConst.isNull() )
331 {
332 QDomElement legConsts = resConst.firstChildElement( u"LegConsts"_s );
333 while ( !legConsts.isNull() )
334 {
335 const QString restrictCd = legConsts.firstChildElement( u"useConsts"_s ).firstChildElement( u"RestrictCd"_s ).attribute( u"value"_s );
336
337 if ( restrictCd.compare( "005"_L1 ) == 0 )
338 {
339 licenses << QTextDocumentFragment::fromHtml( legConsts.firstChildElement( u"useLimit"_s ).text() ).toPlainText();
340 }
341 else if ( restrictCd.compare( "006"_L1 ) == 0 )
342 {
343 rights << QTextDocumentFragment::fromHtml( legConsts.firstChildElement( u"useLimit"_s ).text() ).toPlainText();
344 }
345 legConsts = legConsts.nextSiblingElement( u"LegConsts"_s );
346 }
347
348 QDomElement secConsts = resConst.firstChildElement( u"SecConsts"_s );
349 while ( !secConsts.isNull() )
350 {
352 constraint.type = QObject::tr( "Security constraints" );
353 constraint.constraint = QTextDocumentFragment::fromHtml( secConsts.firstChildElement( u"userNote"_s ).text() ).toPlainText();
354 constraints << constraint;
355 secConsts = secConsts.nextSiblingElement( u"SecConsts"_s );
356 }
357
358 QDomElement consts = resConst.firstChildElement( u"Consts"_s );
359 while ( !consts.isNull() )
360 {
362 constraint.type = QObject::tr( "Limitations of use" );
363 constraint.constraint = QTextDocumentFragment::fromHtml( consts.firstChildElement( u"useLimit"_s ).text() ).toPlainText();
364 constraints << constraint;
365 consts = consts.nextSiblingElement( u"Consts"_s );
366 }
367
368 resConst = resConst.nextSiblingElement( u"resConst"_s );
369 }
370
371 const QDomElement idCredit = dataIdInfo.firstChildElement( u"idCredit"_s );
372 const QString credit = idCredit.text();
373 if ( !credit.isEmpty() )
374 rights << credit;
375
376 // older xml format
377 QDomElement accconst = idInfo.firstChildElement( u"accconst"_s );
378 while ( !accconst.isNull() )
379 {
381 constraint.type = QObject::tr( "Access" );
382 constraint.constraint = QTextDocumentFragment::fromHtml( accconst.text() ).toPlainText();
383 constraints << constraint;
384
385 accconst = accconst.nextSiblingElement( u"accconst"_s );
386 }
387 QDomElement useconst = idInfo.firstChildElement( u"useconst"_s );
388 while ( !useconst.isNull() )
389 {
390 rights << QTextDocumentFragment::fromHtml( useconst.text() ).toPlainText();
391 useconst = useconst.nextSiblingElement( u"useconst"_s );
392 }
393
394 metadata.setLicenses( licenses );
395 metadata.setRights( rights );
396 metadata.setConstraints( constraints );
397
398 // links
399 const QDomElement distInfo = metadataElem.firstChildElement( u"distInfo"_s );
400 const QDomElement distributor = distInfo.firstChildElement( u"distributor"_s );
401
402 QDomElement distorTran = distributor.firstChildElement( u"distorTran"_s );
403 while ( !distorTran.isNull() )
404 {
405 const QDomElement onLineSrc = distorTran.firstChildElement( u"onLineSrc"_s );
406 if ( !onLineSrc.isNull() )
407 {
409 link.url = onLineSrc.firstChildElement( u"linkage"_s ).text();
410
411 const QDomElement distorFormat = distributor.firstChildElement( u"distorFormat"_s );
412 link.name = distorFormat.firstChildElement( u"formatName"_s ).text();
413 link.type = distorFormat.firstChildElement( u"formatSpec"_s ).text();
414
415 if ( link.type.isEmpty() )
416 {
417 // older xml format
418 link.type = onLineSrc.firstChildElement( u"protocol"_s ).text();
419 }
420 metadata.addLink( link );
421 }
422
423 distorTran = distorTran.nextSiblingElement( u"distorTran"_s );
424 }
425
426 // lineage
427 const QDomElement dqInfo = metadataElem.firstChildElement( u"dqInfo"_s );
428 const QDomElement dataLineage = dqInfo.firstChildElement( u"dataLineage"_s );
429 const QString statement = QTextDocumentFragment::fromHtml( dataLineage.firstChildElement( u"statement"_s ).text() ).toPlainText();
430 if ( !statement.isEmpty() )
431 metadata.addHistoryItem( statement );
432
433 QDomElement dataSource = dataLineage.firstChildElement( u"dataSource"_s );
434 while ( !dataSource.isNull() )
435 {
436 metadata.addHistoryItem( QObject::tr( "Data source: %1" ).arg( QTextDocumentFragment::fromHtml( dataSource.firstChildElement( u"srcDesc"_s ).text() ).toPlainText() ) );
437 dataSource = dataSource.nextSiblingElement( u"dataSource"_s );
438 }
439
440 // contacts
441 const QDomElement mdContact = metadataElem.firstChildElement( u"mdContact"_s );
442 if ( !mdContact.isNull() )
443 {
445 contact.name = mdContact.firstChildElement( u"rpIndName"_s ).text();
446 contact.organization = mdContact.firstChildElement( u"rpOrgName"_s ).text();
447 contact.position = mdContact.firstChildElement( u"rpPosName"_s ).text();
448
449 const QString role = mdContact.firstChildElement( u"role"_s ).firstChildElement( u"RoleCd"_s ).attribute( u"value"_s );
450 if ( role == "007"_L1 )
451 contact.role = QObject::tr( "Point of contact" );
452
453 const QDomElement rpCntInfo = mdContact.firstChildElement( u"rpCntInfo"_s );
454 contact.email = rpCntInfo.firstChildElement( u"cntAddress"_s ).firstChildElement( u"eMailAdd"_s ).text();
455 contact.voice = rpCntInfo.firstChildElement( u"cntPhone"_s ).firstChildElement( u"voiceNum"_s ).text();
456
457 QDomElement cntAddress = rpCntInfo.firstChildElement( u"cntAddress"_s );
458 while ( !cntAddress.isNull() )
459 {
461
462 address.type = cntAddress.attribute( u"addressType"_s );
463 address.address = cntAddress.firstChildElement( u"delPoint"_s ).text();
464 address.city = cntAddress.firstChildElement( u"city"_s ).text();
465 address.administrativeArea = cntAddress.firstChildElement( u"adminArea"_s ).text();
466 address.postalCode = cntAddress.firstChildElement( u"postCode"_s ).text();
467 address.country = cntAddress.firstChildElement( u"country"_s ).text();
468
469 contact.addresses.append( address );
470
471 cntAddress = cntAddress.nextSiblingElement( u"cntAddress"_s );
472 }
473
474
475 metadata.addContact( contact );
476 }
477
478 // older xml format
479 const QDomElement ptcontac = idInfo.firstChildElement( u"ptcontac"_s );
480 const QDomElement cntinfo = ptcontac.firstChildElement( u"cntinfo"_s );
481 if ( !cntinfo.isNull() )
482 {
484 const QDomElement cntorgp = cntinfo.firstChildElement( u"cntorgp"_s );
485 const QString org = cntorgp.firstChildElement( u"cntorg"_s ).text();
486
487 contact.name = org;
488 contact.organization = org;
489 contact.role = QObject::tr( "Point of contact" );
490
491 const QDomElement rpCntInfo = mdContact.firstChildElement( u"rpCntInfo"_s );
492 contact.email = cntinfo.firstChildElement( u"cntemail"_s ).text();
493 contact.fax = cntinfo.firstChildElement( u"cntfax"_s ).text();
494 contact.voice = cntinfo.firstChildElement( u"cntvoice"_s ).text();
495
496 QDomElement cntaddr = cntinfo.firstChildElement( u"cntaddr"_s );
497 while ( !cntaddr.isNull() )
498 {
500
501 QDomElement addressElem = cntaddr.firstChildElement( u"address"_s );
502 while ( !addressElem.isNull() )
503 {
504 const QString addressPart = addressElem.text();
505 address.address = address.address.isEmpty() ? addressPart : address.address + '\n' + addressPart;
506 addressElem = addressElem.nextSiblingElement( u"address"_s );
507 }
508 address.type = cntaddr.firstChildElement( u"addrtype"_s ).text();
509 address.city = cntaddr.firstChildElement( u"city"_s ).text();
510 address.administrativeArea = cntaddr.firstChildElement( u"state"_s ).text();
511 address.postalCode = cntaddr.firstChildElement( u"postal"_s ).text();
512 address.country = cntaddr.firstChildElement( u"country"_s ).text();
513
514 contact.addresses.append( address );
515
516 cntaddr = cntaddr.nextSiblingElement( u"cntaddr"_s );
517 }
518
519 metadata.addContact( contact );
520 }
521
522 return metadata;
523}
@ Created
Date created.
Definition qgis.h:4790
@ Published
Date published.
Definition qgis.h:4791
@ Superseded
Date superseded.
Definition qgis.h:4793
@ Revised
Date revised.
Definition qgis.h:4792
void setAbstract(const QString &abstract)
Sets a free-form abstract (description) of the resource.
void addContact(const QgsAbstractMetadataBase::Contact &contact)
Adds an individual contact to the existing contacts.
void setTitle(const QString &title)
Sets the human readable title (name) of the resource, typically displayed in search results.
void setIdentifier(const QString &identifier)
Sets the reference, URI, URL or some other mechanism to identify the resource.
QString abstract() const
Returns a free-form description of the resource.
void setDateTime(Qgis::MetadataDateType type, QDateTime date)
Sets a date value for the specified date type.
void setLanguage(const QString &language)
Sets the human language associated with the resource.
void addKeywords(const QString &vocabulary, const QStringList &keywords)
Adds a list of descriptive keywords for a specified vocabulary.
void addLink(const QgsAbstractMetadataBase::Link &link)
Adds an individual link to the existing links.
QString identifier() const
A reference, URI, URL or some other mechanism to identify the resource.
void setCategories(const QStringList &categories)
Sets categories of the resource.
void addHistoryItem(const QString &text)
Adds a single history text to the end of the existing history list.
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:45
Represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
A structured metadata store for a map layer.
void setConstraints(const QgsLayerMetadata::ConstraintList &constraints)
Sets the list of constraints associated with using the resource.
void setLicenses(const QStringList &licenses)
Sets a list of licenses associated with the resource.
void setRights(const QStringList &rights)
Sets a list of rights (attribution or copyright strings) associated with the resource.
void setExtent(const QgsLayerMetadata::Extent &extent)
Sets the spatial and temporal extents associated with the resource.
QList< QgsLayerMetadata::Constraint > ConstraintList
A list of constraints.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the coordinate reference system for the layer's metadata.
static QgsLayerMetadata convertFromEsri(const QDomDocument &document)
Converts ESRI layer metadata to QgsLayerMetadata.
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
Definition qgsrange.h:764
QString administrativeArea
Administrative area (state, province/territory, etc.).
QString address
Free-form physical address component, e.g.
QString city
City or locality name.
QString country
Free-form country string.
QString postalCode
Postal (or ZIP) code.
QString position
Position/title of contact.
QList< QgsAbstractMetadataBase::Address > addresses
List of addresses associated with this contact.
QString email
Electronic mail address.
QString organization
Organization contact belongs to/represents.
Metadata constraint structure.
QString constraint
Free-form constraint string.
QString type
Constraint type.
Metadata extent structure.
void setSpatialExtents(const QList< QgsLayerMetadata::SpatialExtent > &extents)
Sets the spatial extents of the resource.
void setTemporalExtents(const QList< QgsDateTimeRange > &extents)
Sets the temporal extents of the resource.
Metadata spatial extent structure.
QgsCoordinateReferenceSystem extentCrs
Coordinate reference system for spatial extent.
QgsBox3D bounds
Geospatial extent of the resource.