/usr/lib/python2.7/dist-packages/owslib/gm03.py is in python-owslib 0.10.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | # -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2015 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
#
# Contact email: tomkralidis@gmail.com
# =============================================================================
"""GM03 Core metadata parser http://www.geocat.ch/internet/geocat/en/home/documentation/gm03.html"""
from __future__ import (absolute_import, division, print_function)
from owslib import util
from owslib.etree import etree
from owslib.namespaces import Namespaces
# default variables
def get_namespaces():
n = Namespaces()
ns = n.get_namespaces(["gm03"])
ns[None] = n.get_namespace("gm03")
return ns
namespaces = get_namespaces()
class _GenericObject(object):
"""GM03 generic object type"""
def __init__(self, md):
"""constructor"""
self.tid = None
if md is not None:
self.tid = md.attrib.get('TID')
class _GenericObjectProperty(object):
"""GM03 generic object type"""
def __init__(self, md):
"""constructor"""
self.ref = None
self.bid = None
self.order_post = None
if md is not None:
self.ref = md.attrib.get('REF')
self.bid = md.attrib.get('BID')
self.order_pos = md.attrib.get('ORDER_POS')
class PT_Group(object):
"""PT_Group parser"""
def __init__(self, md):
"""constructor"""
self.language = util.testXMLValue(md.find(util.nspath_eval('gm03:language', namespaces)))
self.country = util.testXMLValue(md.find(util.nspath_eval('gm03:country', namespaces)))
self.character_set_code = util.testXMLValue(md.find(util.nspath_eval('gm03:characterSetCode', namespaces)))
self.plain_text = util.testXMLValue(md.find(util.nspath_eval('gm03:plainText', namespaces)))
self.plain_url = util.testXMLValue(md.find(util.nspath_eval('gm03:plainURL', namespaces)))
class PT_FreeText(object):
"""PT_FreeText parser"""
def __init__(self, md):
"""constructor"""
pt_groups = []
for pt_group in md.findall(util.nspath_eval('gm03:GM03_2_1Core.Core.PT_FreeText/gm03:textGroup/gm03:GM03_2_1Core.Core.PT_Group', namespaces)):
pt_groups.append(PT_Group(pt_group))
self.pt_group = pt_groups
class PT_FreeURL(object):
"""PT_FreeURL parser"""
def __init__(self, md):
"""constructor"""
pt_groups = []
for pt_group in md.findall(util.nspath_eval('gm03:GM03_2_1Core.Core.PT_FreeURL/gm03:URLGroup/gm03:GM03_2_1Core.Core.PT_URLGroup', namespaces)):
pt_groups.append(PT_Group(pt_group))
self.pt_group = pt_groups
class GM03(object):
"""TRANSFER parser"""
def __init__(self, md):
"""constructor"""
if hasattr(md, 'getroot'): # standalone document
self.xml = etree.tostring(md.getroot())
else: # part of a larger document
self.xml = etree.tostring(md)
self.header = HeaderSection(md)
self.data = DataSection(md)
class HeaderSection(object):
"""HEADERSECTION parser"""
def __init__(self, md):
"""constructor"""
header = None
header = md.find(util.nspath_eval('gm03:HEADERSECTION', namespaces))
if header is None:
return None
self.version = header.attrib.get('VERSION')
self.sender = header.attrib.get('SENDER')
self.models = []
for model in header.findall(util.nspath_eval('gm03:MODELS/gm03:MODEL', namespaces)):
name = util.testXMLValue(model.find(util.nspath_eval('gm03:NAME', namespaces)))
version = util.testXMLValue(model.find(util.nspath_eval('gm03:VERSION', namespaces)))
uri = util.testXMLValue(model.find(util.nspath_eval('gm03:URI', namespaces)))
model_dict = {
'name': name,
'version': version,
'uri': uri
}
self.models.append(model_dict)
self.comment = util.testXMLValue(header.find(util.nspath_eval('gm03:COMMENT', namespaces)))
class DataSection(object):
"""DATASECTION parser"""
def __init__(self, md):
"""constructor"""
section = None
section = md.find(util.nspath_eval('gm03:DATASECTION', namespaces))
if section is None:
return None
mdata = section.find(util.nspath_eval('gm03:GM03_2_1Core.Core', namespaces))
if mdata is not None:
self.core = Core(mdata)
else:
mdata = section.find(util.nspath_eval('gm03:GM03_2_1Comprehensive.Comprehensive', namespaces))
if mdata is not None:
self.comprehensive = Comprehensive(mdata)
class Core(object):
"""Core parser"""
def __init__(self, md):
"""constructor"""
self.bid = md.attrib.get('BID')
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.DQ_DataQuality', namespaces))
if val is not None:
self.data_quality = DQ_DataQuality(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Authority', namespaces))
if val is not None:
self.authority = _GenericObject(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_DigitalTransferOptions', namespaces))
if val is not None:
self.digital_transfer_options = MD_DigitalTransferOptions(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Distribution', namespaces))
if val is not None:
self.distribution = _GenericObject(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_ReferenceSystem', namespaces))
if val is not None:
self.reference_system_identifier = MD_ReferenceSystem(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Thesaurus', namespaces))
if val is not None:
self.thesaurus = MD_Thesaurus(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.SC_VerticalDatum', namespaces))
if val is not None:
self.vertical_datum = SC_VerticalDatum(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Address', namespaces))
if val is not None:
self.address = CI_Address(val)
self.date = []
for cid in md.findall(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Date', namespaces)):
self.date.append(CI_Date(cid))
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Telephone', namespaces))
if val is not None:
self.telephone = CI_Telephone(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.DQ_Scope', namespaces))
if val is not None:
self.scope = DQ_Scope(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_VerticalExtent', namespaces))
if val is not None:
self.vertical_extent = EX_VerticalExtent(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Format', namespaces))
if val is not None:
self.format = MD_Format(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Metadata', namespaces))
if val is not None:
self.metadata = MD_Metadata(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_RepresentativeFraction', namespaces))
if val is not None:
self.representative_fraction = MD_RepresentativeFraction(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Resolution', namespaces))
if val is not None:
self.resolution = MD_Resolution(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_BoundingPolygon', namespaces))
if val is not None:
self.bounding_polygon = EX_BoundingPolygon(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_GeographicBoundingBox', namespaces))
if val is not None:
self.geographic_bounding_box = EX_GeographicBoundingBox(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_GeographicDescription', namespaces))
if val is not None:
self.geographic_description = EX_GeographicDescription(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_TemporalExtent', namespaces))
if val is not None:
self.temporal_extent = EX_TemporalExtent(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_DistributiondistributionFormat', namespaces))
if val is not None:
self.distribution_distribution_format = MD_DistributiondistributionFormat(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.referenceSystemInfoMD_Metadata', namespaces))
if val is not None:
self.reference_system_metadata = referenceSystemInfoMD_Metadata(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Citation', namespaces))
if val is None:
val = md.find(util.nspath_eval('gm03:GM03_2_1Comprehensive.Comprehensive.CI_Citation', namespaces))
if val is not None:
self.citation = CI_Citation(val)
else:
self.citation = CI_Citation(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Contact', namespaces))
if val is not None:
self.contact = CI_Contact(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_OnlineResource', namespaces))
if val is not None:
self.online_resource = CI_OnlineResource(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_ResponsibleParty', namespaces))
if val is not None:
self.responsible_party = CI_ResponsibleParty(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_Extent', namespaces))
if val is not None:
self.extent = EX_Extent(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_SpatialTemporalExtent', namespaces))
if val is not None:
self.spatial_temporal_extent = EX_Extent(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.LI_Lineage', namespaces))
if val is not None:
self.lineage = LI_Lineage(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Identifier', namespaces))
if val is not None:
self.identifier = MD_Identifier(val)
self.keywords = []
for kw in md.findall(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Keywords', namespaces)):
self.keywords.append(MD_Keywords(kw))
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_DataIdentification', namespaces))
if val is None:
val = md.find(util.nspath_eval('gm03:GM03_2_1Comprehensive.Comprehensive.MD_DataIdentification', namespaces))
if val is not None:
self.data_identification = MD_DataIdentification(val)
else:
self.data_identification = MD_DataIdentification(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.RS_Identifier', namespaces))
if val is not None:
self.rs_identifier = RS_Identifier(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_ResponsiblePartyparentinfo', namespaces))
if val is not None:
self.responsible_party_parent_info = CI_ResponsiblePartyparentinfo(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.descriptiveKeywordsMD_Identification', namespaces))
if val is not None:
self.descriptive_keywords_identification = descriptiveKeywordsMD_Identification(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_ExtentgeographicElement', namespaces))
if val is not None:
self.extent_geographic_element = EX_ExtentgeographicElement(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_ExtenttemporalElement', namespaces))
if val is not None:
self.extent_temporal_element = EX_ExtenttemporalElement(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.EX_ExtentverticalElement', namespaces))
if val is not None:
self.extent_vertical_element = EX_ExtenttemporalElement(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_IdentificationpointOfContact', namespaces))
if val is not None:
self.identification_point_of_contact = MD_IdentificationpointOfContact(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Metadatacontact', namespaces))
if val is not None:
self.metadata_point_of_contact = MD_Metadatacontact(val)
val = md.find(util.nspath_eval('gm03:GM03_2_1Core.Core.spatialExtentEX_SpatialTemporalExtent', namespaces))
if val is not None:
self.self.spatial_temporal_extent = spatialExtentEX_SpatialTemporalExtent(val)
@property
def elements(self):
"""helper function to return all properties"""
dict_elements = vars(self)
if 'bid' in dict_elements:
del dict_elements['bid']
return dict_elements
def get_element_by_tid(self, tid):
"""helper function to find values by reference"""
for key, value in self.elements.items():
if hasattr(value, 'tid') and value.tid == tid:
return self.elements[key]
return None
class DQ_DataQuality(_GenericObject):
"""DQ_DataQuality parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:MD_Metadata', namespaces))
self.metadata = _GenericObjectProperty(val)
class MD_Authority(_GenericObject):
"""MD_Authority parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
class MD_ReferenceSystem(_GenericObject):
"""MD_ReferenceSystem parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:referenceSystemIdentifier', namespaces))
self.reference_system_identifier = _GenericObjectProperty(val)
class MD_DigitalTransferOptions(_GenericObject):
"""MD_DigitalTransferOptions parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:MD_Distribution', namespaces))
self.distribution = _GenericObjectProperty(val)
class MD_Thesaurus(_GenericObject):
"""MD_Thesaurus parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:citation', namespaces))
self.citation = _GenericObjectProperty(val)
class SC_VerticalDatum(_GenericObject):
"""SC_VerticalDatum parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:datumID', namespaces))
self.datum_id = _GenericObjectProperty(val)
class CI_Address(_GenericObject):
"""CI_Address parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.street_name = util.testXMLValue(md.find(util.nspath_eval('gm03:streetName', namespaces)))
self.street_number = util.testXMLValue(md.find(util.nspath_eval('gm03:streetNumber', namespaces)))
self.address_line = util.testXMLValue(md.find(util.nspath_eval('gm03:addressLine', namespaces)))
self.post_box = util.testXMLValue(md.find(util.nspath_eval('gm03:postBox', namespaces)))
self.postal_code = util.testXMLValue(md.find(util.nspath_eval('gm03:postalCode', namespaces)))
self.city = util.testXMLValue(md.find(util.nspath_eval('gm03:city', namespaces)))
self.administrative_area = util.testXMLValue(md.find(util.nspath_eval('gm03:administrativeArea', namespaces)))
self.country = util.testXMLValue(md.find(util.nspath_eval('gm03:country', namespaces)))
class CI_Date(_GenericObject):
"""CI_Date parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.date = util.testXMLValue(md.find(util.nspath_eval('gm03:date', namespaces)))
self.date_type = util.testXMLValue(md.find(util.nspath_eval('gm03:dateType', namespaces)))
val = md.find(util.nspath_eval('gm03:CI_Citation', namespaces))
self.citation = _GenericObjectProperty(val)
class CI_Telephone(_GenericObject):
"""CI_Telephone parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.number = util.testXMLValue(md.find(util.nspath_eval('gm03:number', namespaces)))
self.number_type = util.testXMLValue(md.find(util.nspath_eval('gm03:numberType', namespaces)))
val = md.find(util.nspath_eval('gm03:CI_ResponsibleParty', namespaces))
self.responsible_party = _GenericObjectProperty(val)
class DQ_Scope(_GenericObject):
"""DQ_Scope parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.level = util.testXMLValue(md.find(util.nspath_eval('gm03:level', namespaces)))
val = md.find(util.nspath_eval('gm03:DQ_DataQuality', namespaces))
self.data_quality = _GenericObjectProperty(val)
class EX_VerticalExtent(_GenericObject):
"""EX_VerticalExtent parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.minimum_value = util.testXMLValue(md.find(util.nspath_eval('gm03:minimumValue', namespaces)))
self.maximum_value = util.testXMLValue(md.find(util.nspath_eval('gm03:maximumValue', namespaces)))
self.unit_of_measure = util.testXMLValue(md.find(util.nspath_eval('gm03:unitOfMeasure', namespaces)))
val = md.find(util.nspath_eval('gm03:verticalDatum', namespaces))
self.vertical_datum = _GenericObjectProperty(val)
class MD_Format(_GenericObject):
"""MD_Format parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.name = util.testXMLValue(md.find(util.nspath_eval('gm03:name', namespaces)))
self.version = util.testXMLValue(md.find(util.nspath_eval('gm03:version', versionspaces)))
class MD_Metadata(_GenericObject):
"""MD_Metadata parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.file_identifier = util.testXMLValue(md.find(util.nspath_eval('gm03:fileIdentifier', namespaces)))
self.language = util.testXMLValue(md.find(util.nspath_eval('gm03:language', namespaces)))
self.character_set = util.testXMLValue(md.find(util.nspath_eval('gm03:characterSet', namespaces)))
self.date_stamp = util.testXMLValue(md.find(util.nspath_eval('gm03:dateStamp', namespaces)))
self.metadata_standard_name = util.testXMLValue(md.find(util.nspath_eval('gm03:metadataStandardName', namespaces)))
self.metadata_standard_version = util.testXMLValue(md.find(util.nspath_eval('gm03:metadataStandardVersion', namespaces)))
self.dataset_uri = util.testXMLValue(md.find(util.nspath_eval('gm03:dataSetURI', namespaces)))
val = md.find(util.nspath_eval('gm03:hierarchyLevel', namespaces))
if val is not None:
values = []
for value in val.findall(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_ScopeCode_/gm03:value', namespaces)):
values.append(util.testXMLValue(value))
self.hierarchy_level = values
val = md.find(util.nspath_eval('gm03:hierarchyLevelName', namespaces))
if val is not None:
values = []
for value in val.findall(util.nspath_eval('gm03:GM03_2_1Core.Core.CharacterString_/gm03:value', namespaces)):
values.append(util.testXMLValue(value))
self.hierarchy_level_name = values
val = md.find(util.nspath_eval('gm03:distributionInfo', namespaces))
self.distribution_info = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:parentIdentifier', namespaces))
self.parent_identifier = _GenericObjectProperty(val)
class MD_RepresentativeFraction(_GenericObject):
"""MD_RepresentativeFraction parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.denominator = util.testXMLValue(md.find(util.nspath_eval('gm03:denominator', namespaces)))
class MD_Resolution(_GenericObject):
"""MD_Resolution parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.distance = util.testXMLValue(md.find(util.nspath_eval('gm03:distance', namespaces)))
val = md.find(util.nspath_eval('gm03:MD_DataIdentification', namespaces))
self.data_identification = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:equivalentScale', namespaces))
self.equivalent_scale = _GenericObjectProperty(val)
class MD_ScopeDescription(_GenericObject):
"""MD_ScopeDescription parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.attributes = util.testXMLValue(md.find(util.nspath_eval('gm03:attributes', namespaces)))
self.features = util.testXMLValue(md.find(util.nspath_eval('gm03:features', namespaces)))
self.feature_instances = util.testXMLValue(md.find(util.nspath_eval('gm03:featureInstances', namespaces)))
self.attribute_instances = util.testXMLValue(md.find(util.nspath_eval('gm03:attributeInstances', namespaces)))
self.dataset = util.testXMLValue(md.find(util.nspath_eval('gm03:dataset', namespaces)))
self.other = util.testXMLValue(md.find(util.nspath_eval('gm03:other', namespaces)))
val = md.find(util.nspath_eval('gm03:DQ_Scope', namespaces))
self.scope = _GenericObjectProperty(val)
class EX_BoundingPolygon(_GenericObject):
"""EX_BoundingPolygon parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.extent_type_code = util.testXMLValue(md.find(util.nspath_eval('gm03:extentTypeCode', namespaces)))
boundaries = []
for boundary in md.findall(util.nspath_eval('gm03:SURFACE/gm03:BOUNDARY', namespaces)):
polylines = []
for polyline in boundary.findall(util.nspath_eval('gm03:POLYLINE', namespaces)):
coords = []
arcs = []
for coord in polyline.findall(util.nspath_eval('gm03:COORD', namespaces)):
c1 = util.testXMLValue(coord.find(util.nspath_eval('gm03:C1', namespaces)))
c2 = util.testXMLValue(coord.find(util.nspath_eval('gm03:C2', namespaces)))
c3 = util.testXMLValue(coord.find(util.nspath_eval('gm03:C3', namespaces)))
coordvalue = {'c1': c1, 'c2': c2, 'c3': c3}
coords.append(coordvalue)
for arc in polyline.findall(util.nspath_eval('gm03:ARC', namespaces)):
c1 = util.testXMLValue(coord.find(util.nspath_eval('gm03:C1', namespaces)))
c2 = util.testXMLValue(coord.find(util.nspath_eval('gm03:C2', namespaces)))
c3 = util.testXMLValue(coord.find(util.nspath_eval('gm03:C3', namespaces)))
a1 = util.testXMLValue(coord.find(util.nspath_eval('gm03:A1', namespaces)))
a2 = util.testXMLValue(coord.find(util.nspath_eval('gm03:A2', namespaces)))
r = util.testXMLValue(coord.find(util.nspath_eval('gm03:R', namespaces)))
arcpoint = {'c1': c1, 'c2': c2, 'c3': c3, 'a1': a1, 'a2': a2, 'r': r}
arcs.append(arcpoint)
polylines.append(coords)
polylines.append(arcs)
boundaries.append(polylines)
self.boundary = boundaries
class EX_GeographicBoundingBox(_GenericObject):
"""EX_GeographicBoundingBox parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.extent_type_code = util.testXMLValue(md.find(util.nspath_eval('gm03:extentTypeCode', namespaces)))
self.north_bound_latitude = util.testXMLValue(md.find(util.nspath_eval('gm03:northBoundLatitude', namespaces)))
self.south_bound_latitude = util.testXMLValue(md.find(util.nspath_eval('gm03:southBoundLatitude', namespaces)))
self.east_bound_longitude = util.testXMLValue(md.find(util.nspath_eval('gm03:eastBoundLongitude', namespaces)))
self.west_bound_longitude = util.testXMLValue(md.find(util.nspath_eval('gm03:westBoundLongitude', namespaces)))
class EX_GeographicDescription(_GenericObject):
"""EX_GeographicDescription parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.extent_type_code = util.testXMLValue(md.find(util.nspath_eval('gm03:extentTypeCode', namespaces)))
val = md.find(util.nspath_eval('gm03:geographicIdentifier', namespaces))
self.geographic_identifier = _GenericObjectProperty(val)
class EX_TemporalExtent(_GenericObject):
"""EX_TemporalExtent parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
begin = util.testXMLValue(md.find(util.nspath_eval('gm03:extent/gm03:GM03_2_1Core.Core.TM_Primitive/begin', namespaces)))
end = util.testXMLValue(md.find(util.nspath_eval('gm03:extent/gm03:GM03_2_1Core.Core.TM_Primitive/end', namespaces)))
self.extent = {'begin': begin, 'end': end}
class MD_DistributiondistributionFormat(object):
"""MD_DistributiondistributionFormat parser"""
def __init__(self, md):
"""constructor"""
val = md.find(util.nspath_eval('gm03:MD_Distribution', namespaces))
self.distribution = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:distributionFormat', namespaces))
self.distribution_format = _GenericObjectProperty(val)
class referenceSystemInfoMD_Metadata(object):
"""referenceSystemInfoMD_Metadata parser"""
def __init__(self, md):
"""constructor"""
val = md.find(util.nspath_eval('gm03:referenceSystemInfo', namespaces))
self.reference_system_info = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:MD_Metadata', namespaces))
self.metadata = _GenericObjectProperty(val)
class CI_Citation(_GenericObject):
"""CI_Citation parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:title', namespaces))
if val is not None:
self.title = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:MD_Authority', namespaces))
self.authority = _GenericObjectProperty(val)
class CI_Contact(_GenericObject):
"""CI_Contact parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.hours_of_service = util.testXMLValue(md.find(util.nspath_eval('gm03:hoursOfService', namespaces)))
val = md.find(util.nspath_eval('gm03:contactInstructions', namespaces))
if val is not None:
self.contact_instructions = PT_FreeText(val)
class CI_OnlineResource(_GenericObject):
"""CI_OnlineResource parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.protocol = util.testXMLValue(md.find(util.nspath_eval('gm03:protocol', namespaces)))
self.application_profile = util.testXMLValue(md.find(util.nspath_eval('gm03:applicationProfile', namespaces)))
self.function = util.testXMLValue(md.find(util.nspath_eval('gm03:function', namespaces)))
val = md.find(util.nspath_eval('gm03:description', namespaces))
if val is not None:
self.description = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:name', namespaces))
if val is not None:
self.name = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:linkage', namespaces))
if val is not None:
self.linkage = PT_FreeURL(val)
val = md.find(util.nspath_eval('gm03:MD_DigitalTransferOptions', namespaces))
self.digital_transfer_options = _GenericObjectProperty(val)
class CI_ResponsibleParty(_GenericObject):
"""CI_ResponsibleParty parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.individual_first_name = util.testXMLValue(md.find(util.nspath_eval('gm03:individualFirstName', namespaces)))
self.individual_last_name = util.testXMLValue(md.find(util.nspath_eval('gm03:individualLastName', namespaces)))
val = md.find(util.nspath_eval('gm03:electronicalMailAddress', namespaces))
if val is not None:
self.electronical_mail_address = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.URL_/gm03:value', namespaces)))
val = md.find(util.nspath_eval('gm03:organisationName', namespaces))
if val is not None:
self.organisation_name = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:positionName', namespaces))
if val is not None:
self.position_name = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:organisationAcronym', namespaces))
if val is not None:
self.organisation_acronym = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:linkage', namespaces))
if val is not None:
self.linkage = PT_FreeURL(val)
val = md.find(util.nspath_eval('gm03:address', namespaces))
self.address = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:contactInfo', namespaces))
self.contact_info = _GenericObjectProperty(val)
class EX_Extent(_GenericObject):
"""EX_Extent parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:description', namespaces))
if val is not None:
self.description = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:MD_DataIdentification', namespaces))
self.data_identification = _GenericObjectProperty(val)
class EX_SpatialTemporalExtent(EX_TemporalExtent):
"""EX_SpatialTemporalExtent parser"""
def __init__(self, md):
"""constructor"""
EX_TemporalExtent.__init__(self, md)
class LI_Lineage(_GenericObject):
"""LI_Lineage parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:statement', namespaces))
if val is not None:
self.statement = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:DQ_DataQuality', namespaces))
self.data_quality = _GenericObjectProperty(val)
class MD_Identifier(_GenericObject):
"""MD_Identifier parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:code', namespaces))
if val is not None:
self.code = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:MD_Authority', namespaces))
self.authority = _GenericObjectProperty(val)
class MD_Keywords(_GenericObject):
"""MD_Keywords parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.type = util.testXMLValue(md.find(util.nspath_eval('gm03:type', namespaces)))
val = md.find(util.nspath_eval('gm03:keyword', namespaces))
if val is not None:
self.keyword = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:thesaurus', namespaces))
self.thesaurus = _GenericObjectProperty(val)
class MD_DataIdentification(_GenericObject):
"""MD_DataIdentification parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:status', namespaces))
if val is not None:
self.status = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_ProgressCode_/gm03:value', namespaces)))
val = md.find(util.nspath_eval('gm03:abstract', namespaces))
if val is not None:
self.abstract = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:purpose', namespaces))
if val is not None:
self.purpose = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:MD_Metadata', namespaces))
self.metadata = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:citation', namespaces))
self.citation = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:spatialRepresentationType', namespaces))
if val is not None:
self.spatial_representation_type = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_SpatialRepresentationTypeCode_/gm03:value', namespaces)))
val = md.find(util.nspath_eval('gm03:language', namespaces))
if val is not None:
self.language = util.testXMLValue(val.find(util.nspath_eval('gm03:CodeISO.LanguageCodeISO_/gm03:value', namespaces)))
val = md.find(util.nspath_eval('gm03:characterSet', namespaces))
if val is not None:
self.character_set = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_CharacterSetCode_/gm03:value', namespaces)))
val = md.find(util.nspath_eval('gm03:topicCategory', namespaces))
if val is not None:
self.topic_category = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.MD_TopicCategoryCode_/gm03:value', namespaces)))
class RS_Identifier(_GenericObject):
"""RS_Identifier parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:code', namespaces))
if val is not None:
self.code = PT_FreeText(val)
val = md.find(util.nspath_eval('gm03:MD_Authority', namespaces))
self.authority = _GenericObjectProperty(val)
class CI_ResponsiblePartyparentinfo(_GenericObject):
"""CI_ResponsiblePartyparentinfo parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:parentResponsibleParty', namespaces))
self.parent_responsible_party = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:CI_ResponsibleParty', namespaces))
self.responsible_party = _GenericObjectProperty(val)
class descriptiveKeywordsMD_Identification(_GenericObject):
"""descriptiveKeywordsMD_Identification parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:descriptiveKeywords', namespaces))
self.descriptive_keywords = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:MD_Identification', namespaces))
self.identification = _GenericObjectProperty(val)
class EX_ExtentgeographicElement(_GenericObject):
"""EX_ExtentgeographicElement parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:EX_Extent', namespaces))
self.extent = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:temporalElement', namespaces))
self.temporal_element = _GenericObjectProperty(val)
class EX_ExtentverticalElement(_GenericObject):
"""EX_ExtentverticalElement parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:EX_Extent', namespaces))
self.extent = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:verticalElement', namespaces))
self.vertical_element = _GenericObjectProperty(val)
class EX_ExtentgeographicElement(_GenericObject):
"""EX_ExtentgeographicElement parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:EX_Extent', namespaces))
self.extent = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:geographicElement', namespaces))
self.geographic_element = _GenericObjectProperty(val)
class MD_IdentificationpointOfContact(_GenericObject):
"""MD_IdentificationpointOfContact parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:pointOfContact', namespaces))
self.point_of_contact = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:MD_Identification', namespaces))
self.identification = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:role', namespaces))
if val is not None:
self.role = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_RoleCode_/gm03:value', namespaces)))
class MD_Metadatacontact(_GenericObject):
"""MD_Metadatacontact parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:contact', namespaces))
self.contact = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:MD_Metadata', namespaces))
self.metadata = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:role', namespaces))
if val is not None:
self.role = util.testXMLValue(val.find(util.nspath_eval('gm03:GM03_2_1Core.Core.CI_RoleCode_/gm03:value', namespaces)))
class spatialExtentEX_SpatialTemporalExtent(_GenericObject):
"""spatialExtentEX_SpatialTemporalExtent parser"""
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
val = md.find(util.nspath_eval('gm03:spatialExtent', namespaces))
self.spatial_extent = _GenericObjectProperty(val)
val = md.find(util.nspath_eval('gm03:EX_SpatialTemporalExtent', namespaces))
self.spatial_temporal_extent = _GenericObjectProperty(val)
class Comprehensive(Core):
"""Comprehensive parser"""
def __init__(self, md):
"""constructor"""
Core.__init__(self, md)
|