geonode-pycsw 3.0.0b2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geonode_pycsw-3.0.0b2.dist-info/METADATA +73 -0
- geonode_pycsw-3.0.0b2.dist-info/RECORD +382 -0
- geonode_pycsw-3.0.0b2.dist-info/WHEEL +5 -0
- geonode_pycsw-3.0.0b2.dist-info/entry_points.txt +2 -0
- geonode_pycsw-3.0.0b2.dist-info/licenses/LICENSE.txt +26 -0
- geonode_pycsw-3.0.0b2.dist-info/top_level.txt +1 -0
- pycsw/__init__.py +33 -0
- pycsw/core/__init__.py +29 -0
- pycsw/core/admin.py +703 -0
- pycsw/core/config.py +621 -0
- pycsw/core/etree.py +43 -0
- pycsw/core/formats/__init__.py +29 -0
- pycsw/core/formats/fmt_json.py +69 -0
- pycsw/core/log.py +71 -0
- pycsw/core/metadata.py +1996 -0
- pycsw/core/pygeofilter_evaluate.py +83 -0
- pycsw/core/repository.py +941 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/_wrapper.xsd +14 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswAll.xsd +33 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswCommon.xsd +71 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswGetCapabilities.xsd +80 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswGetDomain.xsd +146 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswGetRecordById.xsd +58 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswGetRecords.xsd +391 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswHarvest.xsd +95 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswTransaction.xsd +187 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/cswUnHarvest.xsd +77 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/rec-dcmes.xsd +245 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/rec-dcterms.xsd +101 -0
- pycsw/core/schemas/ogc/cat/csw/3.0/record.xsd +170 -0
- pycsw/core/schemas/ogc/csw/2.0.2/CSW-discovery.xsd +494 -0
- pycsw/core/schemas/ogc/csw/2.0.2/CSW-publication.xsd +242 -0
- pycsw/core/schemas/ogc/csw/2.0.2/rec-dcmes.xsd +199 -0
- pycsw/core/schemas/ogc/csw/2.0.2/rec-dcterms.xsd +94 -0
- pycsw/core/schemas/ogc/csw/2.0.2/record.xsd +138 -0
- pycsw/core/schemas/ogc/filter/1.1.0/expr.xsd +67 -0
- pycsw/core/schemas/ogc/filter/1.1.0/filter.xsd +265 -0
- pycsw/core/schemas/ogc/filter/1.1.0/filterCapabilities.xsd +171 -0
- pycsw/core/schemas/ogc/filter/1.1.0/sort.xsd +46 -0
- pycsw/core/schemas/ogc/filter/2.0/_wrapper.xsd +5 -0
- pycsw/core/schemas/ogc/filter/2.0/expr.xsd +44 -0
- pycsw/core/schemas/ogc/filter/2.0/filter.xsd +396 -0
- pycsw/core/schemas/ogc/filter/2.0/filterAll.xsd +23 -0
- pycsw/core/schemas/ogc/filter/2.0/filterCapabilities.xsd +286 -0
- pycsw/core/schemas/ogc/filter/2.0/query.xsd +70 -0
- pycsw/core/schemas/ogc/filter/2.0/sort.xsd +49 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/basicTypes.xsd +278 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/coordinateOperations.xsd +789 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/coordinateReferenceSystems.xsd +429 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/coordinateSystems.xsd +408 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/coverage.xsd +451 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/dataQuality.xsd +129 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/datums.xsd +484 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/defaultStyle.xsd +454 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/dictionary.xsd +137 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/direction.xsd +72 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/dynamicFeature.xsd +115 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/feature.xsd +199 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/geometryAggregates.xsd +430 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/geometryBasic0d1d.xsd +602 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/geometryBasic2d.xsd +213 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/geometryComplexes.xsd +141 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/geometryPrimitives.xsd +1609 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/gml.xsd +22 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/gmlBase.xsd +294 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/grids.xsd +76 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/measures.xsd +200 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/observation.xsd +96 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/referenceSystems.xsd +211 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/temporal.xsd +332 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/temporalReferenceSystems.xsd +251 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/temporalTopology.xsd +186 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/topology.xsd +459 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/units.xsd +170 -0
- pycsw/core/schemas/ogc/gml/3.1.1/base/valueObjects.xsd +361 -0
- pycsw/core/schemas/ogc/gml/3.1.1/smil/smil20-language.xsd +117 -0
- pycsw/core/schemas/ogc/gml/3.1.1/smil/smil20.xsd +234 -0
- pycsw/core/schemas/ogc/gml/3.2.1/basicTypes.xsd +268 -0
- pycsw/core/schemas/ogc/gml/3.2.1/coordinateOperations.xsd +525 -0
- pycsw/core/schemas/ogc/gml/3.2.1/coordinateReferenceSystems.xsd +373 -0
- pycsw/core/schemas/ogc/gml/3.2.1/coordinateSystems.xsd +297 -0
- pycsw/core/schemas/ogc/gml/3.2.1/coverage.xsd +292 -0
- pycsw/core/schemas/ogc/gml/3.2.1/datums.xsd +287 -0
- pycsw/core/schemas/ogc/gml/3.2.1/defaultStyle.xsd +453 -0
- pycsw/core/schemas/ogc/gml/3.2.1/deprecatedTypes.xsd +1133 -0
- pycsw/core/schemas/ogc/gml/3.2.1/dictionary.xsd +90 -0
- pycsw/core/schemas/ogc/gml/3.2.1/direction.xsd +84 -0
- pycsw/core/schemas/ogc/gml/3.2.1/dynamicFeature.xsd +109 -0
- pycsw/core/schemas/ogc/gml/3.2.1/feature.xsd +94 -0
- pycsw/core/schemas/ogc/gml/3.2.1/geometryAggregates.xsd +197 -0
- pycsw/core/schemas/ogc/gml/3.2.1/geometryBasic0d1d.xsd +277 -0
- pycsw/core/schemas/ogc/gml/3.2.1/geometryBasic2d.xsd +124 -0
- pycsw/core/schemas/ogc/gml/3.2.1/geometryComplexes.xsd +95 -0
- pycsw/core/schemas/ogc/gml/3.2.1/geometryPrimitives.xsd +846 -0
- pycsw/core/schemas/ogc/gml/3.2.1/gml.xsd +20 -0
- pycsw/core/schemas/ogc/gml/3.2.1/gmlBase.xsd +185 -0
- pycsw/core/schemas/ogc/gml/3.2.1/grids.xsd +64 -0
- pycsw/core/schemas/ogc/gml/3.2.1/measures.xsd +68 -0
- pycsw/core/schemas/ogc/gml/3.2.1/observation.xsd +95 -0
- pycsw/core/schemas/ogc/gml/3.2.1/referenceSystems.xsd +70 -0
- pycsw/core/schemas/ogc/gml/3.2.1/temporal.xsd +269 -0
- pycsw/core/schemas/ogc/gml/3.2.1/temporalReferenceSystems.xsd +189 -0
- pycsw/core/schemas/ogc/gml/3.2.1/temporalTopology.xsd +119 -0
- pycsw/core/schemas/ogc/gml/3.2.1/topology.xsd +386 -0
- pycsw/core/schemas/ogc/gml/3.2.1/units.xsd +162 -0
- pycsw/core/schemas/ogc/gml/3.2.1/valueObjects.xsd +205 -0
- pycsw/core/schemas/ogc/ogcapi/records/part1/1.0/ogcapi-records-1.yaml +932 -0
- pycsw/core/schemas/ogc/ows/1.0.0/ows19115subset.xsd +222 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsAll.xsd +20 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsCommon.xsd +155 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsDataIdentification.xsd +112 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsExceptionReport.xsd +67 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsGetCapabilities.xsd +108 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsOperationsMetadata.xsd +161 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsServiceIdentification.xsd +55 -0
- pycsw/core/schemas/ogc/ows/1.0.0/owsServiceProvider.xsd +46 -0
- pycsw/core/schemas/ogc/ows/1.1.0/ows19115subset.xsd +236 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsAll.xsd +23 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsCommon.xsd +158 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsContents.xsd +87 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsDataIdentification.xsd +128 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsDomainType.xsd +280 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsExceptionReport.xsd +77 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsGetCapabilities.xsd +113 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsGetResourceByID.xsd +52 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsInputOutputData.xsd +60 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsManifest.xsd +125 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsOperationsMetadata.xsd +141 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsServiceIdentification.xsd +61 -0
- pycsw/core/schemas/ogc/ows/1.1.0/owsServiceProvider.xsd +48 -0
- pycsw/core/schemas/ogc/ows/2.0/ows19115subset.xsd +364 -0
- pycsw/core/schemas/ogc/ows/2.0/owsAdditionalParameters.xsd +114 -0
- pycsw/core/schemas/ogc/ows/2.0/owsAll.xsd +29 -0
- pycsw/core/schemas/ogc/ows/2.0/owsCommon.xsd +275 -0
- pycsw/core/schemas/ogc/ows/2.0/owsContents.xsd +163 -0
- pycsw/core/schemas/ogc/ows/2.0/owsDataIdentification.xsd +202 -0
- pycsw/core/schemas/ogc/ows/2.0/owsDomainType.xsd +388 -0
- pycsw/core/schemas/ogc/ows/2.0/owsExceptionReport.xsd +126 -0
- pycsw/core/schemas/ogc/ows/2.0/owsGetCapabilities.xsd +220 -0
- pycsw/core/schemas/ogc/ows/2.0/owsGetResourceByID.xsd +83 -0
- pycsw/core/schemas/ogc/ows/2.0/owsInputOutputData.xsd +98 -0
- pycsw/core/schemas/ogc/ows/2.0/owsManifest.xsd +181 -0
- pycsw/core/schemas/ogc/ows/2.0/owsOperationsMetadata.xsd +234 -0
- pycsw/core/schemas/ogc/ows/2.0/owsServiceIdentification.xsd +98 -0
- pycsw/core/schemas/ogc/ows/2.0/owsServiceProvider.xsd +64 -0
- pycsw/core/schemas/w3c/1999/xlink.xsd +271 -0
- pycsw/core/schemas/w3c/2001/xml.xsd +287 -0
- pycsw/core/util.py +552 -0
- pycsw/oaipmh.py +311 -0
- pycsw/ogc/__init__.py +29 -0
- pycsw/ogc/api/__init__.py +28 -0
- pycsw/ogc/api/oapi.py +558 -0
- pycsw/ogc/api/records.py +1414 -0
- pycsw/ogc/api/templates/_base.html +76 -0
- pycsw/ogc/api/templates/collection.html +44 -0
- pycsw/ogc/api/templates/collections.html +45 -0
- pycsw/ogc/api/templates/conformance.html +21 -0
- pycsw/ogc/api/templates/exception.html +8 -0
- pycsw/ogc/api/templates/item.html +228 -0
- pycsw/ogc/api/templates/items.html +337 -0
- pycsw/ogc/api/templates/landing_page.html +27 -0
- pycsw/ogc/api/templates/openapi.html +58 -0
- pycsw/ogc/api/templates/queryables.html +50 -0
- pycsw/ogc/api/templates/stac_items.html +173 -0
- pycsw/ogc/api/templates/static/favicon.ico +0 -0
- pycsw/ogc/api/templates/static/logo-horizontal.png +0 -0
- pycsw/ogc/api/templates/static/logo-vertical-darkbg.png +0 -0
- pycsw/ogc/api/util.py +252 -0
- pycsw/ogc/csw/__init__.py +29 -0
- pycsw/ogc/csw/cql.py +133 -0
- pycsw/ogc/csw/csw2.py +2042 -0
- pycsw/ogc/csw/csw3.py +2193 -0
- pycsw/ogc/fes/__init__.py +29 -0
- pycsw/ogc/fes/fes1.py +433 -0
- pycsw/ogc/fes/fes2.py +451 -0
- pycsw/ogc/gml/__init__.py +29 -0
- pycsw/ogc/gml/gml3.py +240 -0
- pycsw/ogc/gml/gml32.py +243 -0
- pycsw/opensearch.py +857 -0
- pycsw/plugins/__init__.py +29 -0
- pycsw/plugins/outputschemas/__init__.py +31 -0
- pycsw/plugins/outputschemas/atom.py +143 -0
- pycsw/plugins/outputschemas/datacite.py +375 -0
- pycsw/plugins/outputschemas/dif.py +213 -0
- pycsw/plugins/outputschemas/fgdc.py +180 -0
- pycsw/plugins/outputschemas/gm03.py +240 -0
- pycsw/plugins/profiles/__init__.py +29 -0
- pycsw/plugins/profiles/apiso/__init__.py +29 -0
- pycsw/plugins/profiles/apiso/apiso.py +757 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd +13 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gco/basicTypes.xsd +429 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gco/gco.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gco/gcoBase.xsd +61 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/applicationSchema.xsd +42 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/citation.xsd +275 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/constraints.xsd +106 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/content.xsd +188 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/dataQuality.xsd +554 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/distribution.xsd +202 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/extent.xsd +205 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/freeText.xsd +122 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/gmd.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/identification.xsd +348 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/maintenance.xsd +86 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/metadataApplication.xsd +175 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/metadataEntity.xsd +70 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/metadataExtension.xsd +99 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/portrayalCatalogue.xsd +36 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/referenceSystem.xsd +100 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmd/spatialRepresentation.xsd +237 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/basicTypes.xsd +267 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/coordinateOperations.xsd +639 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/coordinateReferenceSystems.xsd +526 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/coordinateSystems.xsd +401 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/coverage.xsd +462 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/datums.xsd +342 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/dictionary.xsd +129 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/direction.xsd +80 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/dynamicFeature.xsd +142 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/feature.xsd +215 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/geometryAggregates.xsd +216 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/geometryBasic0d1d.xsd +304 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/geometryBasic2d.xsd +123 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/geometryComplexes.xsd +89 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/geometryPrimitives.xsd +892 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/gml.xsd +14 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/gmlBase.xsd +305 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/grids.xsd +58 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/measures.xsd +167 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/observation.xsd +90 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/referenceSystems.xsd +69 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/temporal.xsd +263 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/temporalReferenceSystems.xsd +183 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/temporalTopology.xsd +124 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/topology.xsd +372 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/units.xsd +156 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gml/valueObjects.xsd +212 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmx/catalogues.xsd +112 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmx/codelistItem.xsd +168 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmx/crsItem.xsd +1030 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmx/extendedTypes.xsd +75 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmx/gmx.xsd +2 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmx/gmxUsage.xsd +127 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gmx/uomItem.xsd +162 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gsr/gsr.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gsr/spatialReferencing.xsd +24 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gss/geometry.xsd +35 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gss/gss.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gts/gts.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/gts/temporalObjects.xsd +34 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/srv/serviceMetadata.xsd +197 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/srv/serviceModel.xsd +220 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20060504/srv/srv.xsd +13 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gco/basicTypes.xsd +431 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gco/gco.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gco/gcoBase.xsd +63 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/applicationSchema.xsd +43 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/citation.xsd +276 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/constraints.xsd +107 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/content.xsd +190 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/dataQuality.xsd +556 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/distribution.xsd +203 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/extent.xsd +206 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/freeText.xsd +123 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/gmd.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/identification.xsd +349 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/maintenance.xsd +87 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/metadataApplication.xsd +176 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/metadataEntity.xsd +71 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/metadataExtension.xsd +100 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/portrayalCatalogue.xsd +37 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/referenceSystem.xsd +101 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmd/spatialRepresentation.xsd +238 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmx/catalogues.xsd +113 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmx/codelistItem.xsd +169 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmx/crsItem.xsd +1031 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmx/extendedTypes.xsd +76 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmx/gmx.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmx/gmxUsage.xsd +128 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gmx/uomItem.xsd +163 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gsr/gsr.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gsr/spatialReferencing.xsd +25 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gss/geometry.xsd +36 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gss/gss.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gts/gts.xsd +12 -0
- pycsw/plugins/profiles/apiso/schemas/ogc/iso/19139/20070417/gts/temporalObjects.xsd +35 -0
- pycsw/plugins/profiles/ebrim/__init__.py +29 -0
- pycsw/plugins/profiles/ebrim/ebrim.py +174 -0
- pycsw/plugins/profiles/ebrim/schemas/ogc/csw/2.0.2/profiles/ebrim/1.0/csw-ebrim-iri.xsd +146 -0
- pycsw/plugins/profiles/ebrim/schemas/ogc/csw/2.0.2/profiles/ebrim/1.0/csw-ebrim.xsd +104 -0
- pycsw/plugins/profiles/iso19115p3/__init__.py +29 -0
- pycsw/plugins/profiles/iso19115p3/iso19115p3.py +854 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cat/1.0/cat.xsd +13 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cat/1.0/catalogues.xsd +53 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cat/1.0/codelistItem.xsd +54 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cat/1.0/crsItem.xsd +181 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cat/1.0/uomItem.xsd +38 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cit/1.0/cit.xsd +7 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cit/1.0/citation.xsd +514 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cit/2.0/cit.xsd +10 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/cit/2.0/citation.xsd +523 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gco/1.0/baseTypes2014.xsd +530 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gco/1.0/gco.xsd +16 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gcx/1.0/extendedTypes.xsd +92 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gcx/1.0/extendedTypes_autoFromShapeChange.xsd +60 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gcx/1.0/gcx.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gex/1.0/extent.xsd +241 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gex/1.0/gex.xsd +9 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gmw/1.0/gmlWrapperTypes2014.xsd +159 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/gmw/1.0/gmw.xsd +14 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/lan/1.0/lan.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/lan/1.0/language.xsd +140 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mac/1.0/acquisitionInformationImagery.xsd +622 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mac/1.0/mac.xsd +11 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mac/2.0/acquisitionInformationImagery.xsd +590 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mac/2.0/event.xsd +108 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mac/2.0/mac.xsd +10 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mas/1.0/applicationSchema.xsd +61 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mas/1.0/mas.xsd +9 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mcc/1.0/AbstractCommonClasses.xsd +358 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mcc/1.0/commonClasses.xsd +220 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mcc/1.0/mcc.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mco/1.0/constraints.xsd +188 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mco/1.0/mco.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/md1/1.0/md1.xsd +9 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/md1/1.0/metadataWExtendedType.xsd +4 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/md2/1.0/md2.xsd +15 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/md2/1.0/metadataWithExtensions.xsd +4 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mda/1.0/mda.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mda/1.0/metadataApplication.xsd +200 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mdb/1.0/mdb.xsd +14 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mdb/1.0/metadataBase.xsd +98 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mdb/2.0/mdb.xsd +20 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mdb/2.0/metadataBase.xsd +102 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mds/1.0/mds.xsd +22 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mds/1.0/metadataDataServices.xsd +4 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mdt/1.0/mdt.xsd +13 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mdt/1.0/metadataTransfer.xsd +111 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mex/1.0/metadataExtension.xsd +156 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mex/1.0/mex.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mmi/1.0/maintenance.xsd +76 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mmi/1.0/mmi.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mpc/1.0/mpc.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mpc/1.0/portrayalCatalogue.xsd +31 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrc/1.0/content.xsd +416 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrc/1.0/contentInformationImagery.xsd +185 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrc/1.0/mrc.xsd +11 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrc/2.0/content.xsd +419 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrc/2.0/contentInformationImagery.xsd +171 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrc/2.0/mrc.xsd +11 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrd/1.0/distribution.xsd +267 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrd/1.0/mrd.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mri/1.0/identification.xsd +517 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mri/1.0/mri.xsd +9 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrl/1.0/lineage.xsd +147 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrl/1.0/lineageImagery.xsd +236 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrl/1.0/mrl.xsd +9 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrl/2.0/lineage.xsd +147 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrl/2.0/lineageImagery.xsd +312 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrl/2.0/mrl.xsd +11 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrs/1.0/mrs.xsd +8 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/mrs/1.0/referenceSystem.xsd +47 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/msr/1.0/msr.xsd +10 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/msr/1.0/spatialRepresentation.xsd +375 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/msr/1.0/spatialRepresentationImagery.xsd +119 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/msr/2.0/msr.xsd +15 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/msr/2.0/spatialRepresentation.xsd +381 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/msr/2.0/spatialRepresentationImagery.xsd +120 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/srv/2.0/serviceInformation.xsd +272 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/srv/2.0/srv.xsd +6 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/srv/2.1/serviceInformation.xsd +278 -0
- pycsw/plugins/profiles/iso19115p3/schemas/ogc/iso/iso19115-3/srv/2.1/srv.xsd +6 -0
- pycsw/plugins/profiles/profile.py +141 -0
- pycsw/plugins/repository/__init__.py +29 -0
- pycsw/plugins/repository/odc/__init__.py +29 -0
- pycsw/plugins/repository/odc/odc.py +153 -0
- pycsw/server.py +938 -0
- pycsw/sru.py +217 -0
- pycsw/stac/__init__.py +29 -0
- pycsw/stac/api.py +571 -0
- pycsw/wsgi.py +233 -0
- pycsw/wsgi_flask.py +345 -0
pycsw/opensearch.py
ADDED
|
@@ -0,0 +1,857 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# =================================================================
|
|
3
|
+
#
|
|
4
|
+
# Authors: Tom Kralidis <tomkralidis@gmail.com>
|
|
5
|
+
# Angelos Tzotsos <tzotsos@gmail.com>
|
|
6
|
+
#
|
|
7
|
+
# Copyright (c) 2024 Tom Kralidis
|
|
8
|
+
# Copyright (c) 2015 Angelos Tzotsos
|
|
9
|
+
#
|
|
10
|
+
# Permission is hereby granted, free of charge, to any person
|
|
11
|
+
# obtaining a copy of this software and associated documentation
|
|
12
|
+
# files (the "Software"), to deal in the Software without
|
|
13
|
+
# restriction, including without limitation the rights to use,
|
|
14
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
# copies of the Software, and to permit persons to whom the
|
|
16
|
+
# Software is furnished to do so, subject to the following
|
|
17
|
+
# conditions:
|
|
18
|
+
#
|
|
19
|
+
# The above copyright notice and this permission notice shall be
|
|
20
|
+
# included in all copies or substantial portions of the Software.
|
|
21
|
+
#
|
|
22
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
23
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
24
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
25
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
27
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
28
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
29
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
#
|
|
31
|
+
# =================================================================
|
|
32
|
+
|
|
33
|
+
import logging
|
|
34
|
+
|
|
35
|
+
from pycsw.core import util
|
|
36
|
+
from pycsw.core.etree import etree
|
|
37
|
+
|
|
38
|
+
LOGGER = logging.getLogger(__name__)
|
|
39
|
+
|
|
40
|
+
QUERY_PARAMETERS = [
|
|
41
|
+
'q',
|
|
42
|
+
'bbox',
|
|
43
|
+
'time',
|
|
44
|
+
'start',
|
|
45
|
+
'stop',
|
|
46
|
+
'eo:parentidentifier',
|
|
47
|
+
'eo:processinglevel',
|
|
48
|
+
'eo:producttype',
|
|
49
|
+
'eo:platform',
|
|
50
|
+
'eo:instrument',
|
|
51
|
+
'eo:sensortype',
|
|
52
|
+
'eo:cloudcover',
|
|
53
|
+
'eo:snowcover',
|
|
54
|
+
'eo:spectralrange',
|
|
55
|
+
'eo:bands',
|
|
56
|
+
'eo:orbitnumber',
|
|
57
|
+
'eo:orbitdirection'
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class OpenSearch(object):
|
|
62
|
+
"""OpenSearch wrapper class"""
|
|
63
|
+
|
|
64
|
+
def __init__(self, context):
|
|
65
|
+
"""initialize"""
|
|
66
|
+
|
|
67
|
+
self.namespaces = {
|
|
68
|
+
'atom': 'http://www.w3.org/2005/Atom',
|
|
69
|
+
'eo': 'http://a9.com/-/opensearch/extensions/eo/1.0/',
|
|
70
|
+
'geo': 'http://a9.com/-/opensearch/extensions/geo/1.0/',
|
|
71
|
+
'os': 'http://a9.com/-/spec/opensearch/1.1/',
|
|
72
|
+
'time': 'http://a9.com/-/opensearch/extensions/time/1.0/',
|
|
73
|
+
# 'georss': 'http://www.georss.org/georss'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
self.context = context
|
|
77
|
+
self.context.namespaces.update(self.namespaces)
|
|
78
|
+
self.context.keep_ns_prefixes.append('geo')
|
|
79
|
+
self.context.keep_ns_prefixes.append('eo')
|
|
80
|
+
self.context.keep_ns_prefixes.append('time')
|
|
81
|
+
|
|
82
|
+
def response_csw2opensearch(self, element, cfg):
|
|
83
|
+
"""transform a CSW response into an OpenSearch response"""
|
|
84
|
+
|
|
85
|
+
root_tag = etree.QName(element).localname
|
|
86
|
+
if root_tag == 'ExceptionReport':
|
|
87
|
+
return element
|
|
88
|
+
|
|
89
|
+
LOGGER.debug('RESPONSE: %s', root_tag)
|
|
90
|
+
try:
|
|
91
|
+
version = element.xpath('//@version')[0]
|
|
92
|
+
except Exception as err:
|
|
93
|
+
version = '3.0.0'
|
|
94
|
+
|
|
95
|
+
self.exml = element
|
|
96
|
+
self.cfg = cfg
|
|
97
|
+
self.bind_url = util.bind_url(self.cfg['server'].get('url'))
|
|
98
|
+
if self.bind_url.endswith(('/opensearch', '/opensearch?')):
|
|
99
|
+
self.bind_url = self.bind_url.replace('/opensearch', '/csw')
|
|
100
|
+
|
|
101
|
+
if version == '2.0.2':
|
|
102
|
+
return self._csw2_2_os()
|
|
103
|
+
elif version == '3.0.0':
|
|
104
|
+
return self._csw3_2_os()
|
|
105
|
+
|
|
106
|
+
def _csw2_2_os(self):
|
|
107
|
+
"""CSW 2.0.2 Capabilities to OpenSearch Description"""
|
|
108
|
+
|
|
109
|
+
operation_name = etree.QName(self.exml).localname
|
|
110
|
+
if operation_name == 'GetRecordsResponse':
|
|
111
|
+
|
|
112
|
+
startindex = int(self.exml.xpath('//@nextRecord')[0]) - int(
|
|
113
|
+
self.exml.xpath('//@numberOfRecordsReturned')[0])
|
|
114
|
+
if startindex < 1:
|
|
115
|
+
startindex = 1
|
|
116
|
+
|
|
117
|
+
node = etree.Element(util.nspath_eval('atom:feed',
|
|
118
|
+
self.context.namespaces), nsmap=self.namespaces)
|
|
119
|
+
etree.SubElement(node, util.nspath_eval('atom:id',
|
|
120
|
+
self.context.namespaces)).text = self.cfg['server'].get('url')
|
|
121
|
+
etree.SubElement(node, util.nspath_eval('atom:title',
|
|
122
|
+
self.context.namespaces)).text = self.cfg['metadata']['identification']['title']
|
|
123
|
+
#etree.SubElement(node, util.nspath_eval('atom:updated',
|
|
124
|
+
# self.context.namespaces)).text = self.exml.xpath('//@timestamp')[0]
|
|
125
|
+
|
|
126
|
+
etree.SubElement(node, util.nspath_eval('os:totalResults',
|
|
127
|
+
self.context.namespaces)).text = self.exml.xpath(
|
|
128
|
+
'//@numberOfRecordsMatched')[0]
|
|
129
|
+
etree.SubElement(node, util.nspath_eval('os:startIndex',
|
|
130
|
+
self.context.namespaces)).text = str(startindex)
|
|
131
|
+
etree.SubElement(node, util.nspath_eval('os:itemsPerPage',
|
|
132
|
+
self.context.namespaces)).text = self.exml.xpath(
|
|
133
|
+
'//@numberOfRecordsReturned')[0]
|
|
134
|
+
|
|
135
|
+
for rec in self.exml.xpath('//atom:entry',
|
|
136
|
+
namespaces=self.context.namespaces):
|
|
137
|
+
LOGGER.debug('Adding Atom entry')
|
|
138
|
+
node.append(rec)
|
|
139
|
+
for rec in self.exml.xpath('//csw:Record|//csw:BriefRecord|//csw:SummaryRecord',
|
|
140
|
+
namespaces=self.context.namespaces):
|
|
141
|
+
LOGGER.debug('Converting CSW Record to Atom entry')
|
|
142
|
+
node.append(self.cswrecord2atom(rec))
|
|
143
|
+
elif operation_name == 'Capabilities':
|
|
144
|
+
node = etree.Element(util.nspath_eval('os:OpenSearchDescription', self.namespaces), nsmap=self.namespaces)
|
|
145
|
+
etree.SubElement(node, util.nspath_eval('os:ShortName', self.namespaces)).text = self.exml.xpath('//ows:Title', namespaces=self.context.namespaces)[0].text
|
|
146
|
+
etree.SubElement(node, util.nspath_eval('os:LongName', self.namespaces)).text = self.exml.xpath('//ows:Title', namespaces=self.context.namespaces)[0].text
|
|
147
|
+
etree.SubElement(node, util.nspath_eval('os:Description', self.namespaces)).text = self.exml.xpath('//ows:Abstract', namespaces=self.context.namespaces)[0].text
|
|
148
|
+
etree.SubElement(node, util.nspath_eval('os:Tags', self.namespaces)).text = ' '.join(x.text for x in self.exml.xpath('//ows:Keyword', namespaces=self.context.namespaces))
|
|
149
|
+
|
|
150
|
+
node1 = etree.SubElement(node, util.nspath_eval('os:Url', self.namespaces))
|
|
151
|
+
node1.set('type', 'application/atom+xml')
|
|
152
|
+
node1.set('method', 'get')
|
|
153
|
+
|
|
154
|
+
kvps = {
|
|
155
|
+
'mode': 'opensearch',
|
|
156
|
+
'service': 'CSW',
|
|
157
|
+
'version': '2.0.2',
|
|
158
|
+
'request': 'GetRecords',
|
|
159
|
+
'elementsetname': 'full',
|
|
160
|
+
'typenames': 'csw:Record',
|
|
161
|
+
'resulttype': 'results',
|
|
162
|
+
'q': '{searchTerms?}',
|
|
163
|
+
'bbox': '{geo:box?}',
|
|
164
|
+
'time': '{time:start?}/{time:end?}',
|
|
165
|
+
'start': '{time:start?}',
|
|
166
|
+
'stop': '{time:end?}',
|
|
167
|
+
'startposition': '{startIndex?}',
|
|
168
|
+
'maxrecords': '{count?}',
|
|
169
|
+
'eo:cloudCover': '{eo:cloudCover?}',
|
|
170
|
+
'eo:instrument': '{eo:instrument?}',
|
|
171
|
+
'eo:orbitDirection': '{eo:orbitDirection?}',
|
|
172
|
+
'eo:orbitNumber': '{eo:orbitNumber?}',
|
|
173
|
+
'eo:parentIdentifier': '{eo:parentIdentifier?}',
|
|
174
|
+
'eo:platform': '{eo:platform?}',
|
|
175
|
+
'eo:processingLevel': '{eo:processingLevel?}',
|
|
176
|
+
'eo:productType': '{eo:productType?}',
|
|
177
|
+
'eo:sensorType': '{eo:sensorType?}',
|
|
178
|
+
'eo:snowCover': '{eo:snowCover?}',
|
|
179
|
+
'eo:spectralRange': '{eo:spectralRange?}'
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
node1.set('template', '%s%s' % (self.bind_url,
|
|
183
|
+
'&'.join([f'{k}={v}' for k, v in kvps.items()]))
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
#node1.set('template', '%smode=opensearch&service=CSW&version=2.0.2&request=GetRecords&elementsetname=full&typenames=csw:Record&resulttype=results&q={searchTerms?}&bbox={geo:box?}&time={time:start?}/{time:end?}&start={time:start?}&stop={time:end?}&startposition={startIndex?}&maxrecords={count?}' % self.bind_url)
|
|
187
|
+
|
|
188
|
+
node1 = etree.SubElement(node, util.nspath_eval('os:Image', self.namespaces))
|
|
189
|
+
node1.set('type', 'image/vnd.microsoft.icon')
|
|
190
|
+
node1.set('width', '16')
|
|
191
|
+
node1.set('height', '16')
|
|
192
|
+
node1.text = 'https://pycsw.org/img/favicon.ico'
|
|
193
|
+
|
|
194
|
+
etree.SubElement(node, util.nspath_eval('os:Developer', self.namespaces)).text = self.exml.xpath('//ows:IndividualName', namespaces=self.context.namespaces)[0].text
|
|
195
|
+
etree.SubElement(node, util.nspath_eval('os:Context', self.namespaces)).text = self.exml.xpath('//ows:ElectronicMailAddress', namespaces=self.context.namespaces)[0].text
|
|
196
|
+
etree.SubElement(node, util.nspath_eval('os:Attribution', self.namespaces)).text = self.exml.xpath('//ows:ProviderName', namespaces=self.context.namespaces)[0].text
|
|
197
|
+
elif operation_name == 'ExceptionReport':
|
|
198
|
+
node = self.exml
|
|
199
|
+
else: # return Description document
|
|
200
|
+
node = etree.Element(util.nspath_eval('os:Description', self.context.namespaces))
|
|
201
|
+
|
|
202
|
+
return node
|
|
203
|
+
|
|
204
|
+
def _csw3_2_os(self):
|
|
205
|
+
"""CSW 3.0.0 Capabilities to OpenSearch Description"""
|
|
206
|
+
|
|
207
|
+
response_name = etree.QName(self.exml).localname
|
|
208
|
+
if response_name == 'GetRecordsResponse':
|
|
209
|
+
|
|
210
|
+
startindex = int(self.exml.xpath('//@nextRecord')[0]) - int(
|
|
211
|
+
self.exml.xpath('//@numberOfRecordsReturned')[0])
|
|
212
|
+
if startindex < 1:
|
|
213
|
+
startindex = 1
|
|
214
|
+
|
|
215
|
+
node = etree.Element(util.nspath_eval('atom:feed',
|
|
216
|
+
self.context.namespaces), nsmap=self.namespaces)
|
|
217
|
+
etree.SubElement(node, util.nspath_eval('atom:id',
|
|
218
|
+
self.context.namespaces)).text = self.cfg['server'].get('url')
|
|
219
|
+
etree.SubElement(node, util.nspath_eval('atom:title',
|
|
220
|
+
self.context.namespaces)).text = self.cfg['metadata']['identification']['title']
|
|
221
|
+
author = etree.SubElement(node, util.nspath_eval('atom:author', self.context.namespaces))
|
|
222
|
+
etree.SubElement(author, util.nspath_eval('atom:name', self.context.namespaces)).text = self.cfg['metadata']['provider']['name']
|
|
223
|
+
etree.SubElement(node, util.nspath_eval('atom:link',
|
|
224
|
+
self.context.namespaces), rel='search',
|
|
225
|
+
type='application/opensearchdescription+xml',
|
|
226
|
+
href='%smode=opensearch&service=CSW&version=3.0.0&request=GetCapabilities' % self.bind_url)
|
|
227
|
+
|
|
228
|
+
etree.SubElement(node, util.nspath_eval('atom:updated',
|
|
229
|
+
self.context.namespaces)).text = self.exml.xpath('//@timestamp')[0]
|
|
230
|
+
|
|
231
|
+
etree.SubElement(node, util.nspath_eval('os:Query', self.context.namespaces), role='request')
|
|
232
|
+
|
|
233
|
+
matched = sum(int(x) for x in self.exml.xpath('//@numberOfRecordsMatched'))
|
|
234
|
+
|
|
235
|
+
etree.SubElement(node, util.nspath_eval('os:totalResults', self.context.namespaces)).text = str(matched)
|
|
236
|
+
|
|
237
|
+
etree.SubElement(node, util.nspath_eval('os:startIndex',
|
|
238
|
+
self.context.namespaces)).text = str(startindex)
|
|
239
|
+
|
|
240
|
+
returned = sum(int(x) for x in self.exml.xpath('//@numberOfRecordsReturned'))
|
|
241
|
+
|
|
242
|
+
etree.SubElement(node, util.nspath_eval('os:itemsPerPage', self.context.namespaces)).text = str(returned)
|
|
243
|
+
|
|
244
|
+
for rec in self.exml.xpath('//atom:entry', namespaces=self.context.namespaces):
|
|
245
|
+
LOGGER.debug('Adding Atom entry')
|
|
246
|
+
node.append(rec)
|
|
247
|
+
|
|
248
|
+
for rec in self.exml.xpath('//csw30:Record|//csw30:BriefRecord|//csw30:SummaryRecord', namespaces=self.context.namespaces):
|
|
249
|
+
LOGGER.debug('Converting CSW Record to Atom entry')
|
|
250
|
+
node.append(self.cswrecord2atom(rec))
|
|
251
|
+
|
|
252
|
+
elif response_name == 'Capabilities':
|
|
253
|
+
node = etree.Element(util.nspath_eval('os:OpenSearchDescription', self.namespaces), nsmap=self.namespaces)
|
|
254
|
+
etree.SubElement(node, util.nspath_eval('os:ShortName', self.namespaces)).text = self.exml.xpath('//ows20:Title', namespaces=self.context.namespaces)[0].text[:16]
|
|
255
|
+
etree.SubElement(node, util.nspath_eval('os:LongName', self.namespaces)).text = self.exml.xpath('//ows20:Title', namespaces=self.context.namespaces)[0].text
|
|
256
|
+
etree.SubElement(node, util.nspath_eval('os:Description', self.namespaces)).text = self.exml.xpath('//ows20:Abstract', namespaces=self.context.namespaces)[0].text
|
|
257
|
+
etree.SubElement(node, util.nspath_eval('os:Tags', self.namespaces)).text = ' '.join(x.text for x in self.exml.xpath('//ows20:Keyword', namespaces=self.context.namespaces))
|
|
258
|
+
|
|
259
|
+
# Requirement-022
|
|
260
|
+
node1 = etree.SubElement(node, util.nspath_eval('os:Url', self.namespaces))
|
|
261
|
+
node1.set('type', 'application/xml')
|
|
262
|
+
|
|
263
|
+
kvps = {
|
|
264
|
+
'service': 'CSW',
|
|
265
|
+
'version': '3.0.0',
|
|
266
|
+
'request': 'GetRecords',
|
|
267
|
+
'elementsetname': 'full',
|
|
268
|
+
'typenames': 'csw:Record',
|
|
269
|
+
'outputformat': 'application/xml',
|
|
270
|
+
'outputschema': 'http://www.opengis.net/cat/csw/3.0',
|
|
271
|
+
'recordids': '{geo:uid?}',
|
|
272
|
+
'q': '{searchTerms?}',
|
|
273
|
+
'bbox': '{geo:box?}',
|
|
274
|
+
'time': '{time:start?}/{time:end?}',
|
|
275
|
+
'start': '{time:start?}',
|
|
276
|
+
'stop': '{time:end?}',
|
|
277
|
+
'startposition': '{startIndex?}',
|
|
278
|
+
'maxrecords': '{count?}',
|
|
279
|
+
'eo:cloudCover': '{eo:cloudCover?}',
|
|
280
|
+
'eo:instrument': '{eo:instrument?}',
|
|
281
|
+
'eo:orbitDirection': '{eo:orbitDirection?}',
|
|
282
|
+
'eo:orbitNumber': '{eo:orbitNumber?}',
|
|
283
|
+
'eo:parentIdentifier': '{eo:parentIdentifier?}',
|
|
284
|
+
'eo:platform': '{eo:platform?}',
|
|
285
|
+
'eo:processingLevel': '{eo:processingLevel?}',
|
|
286
|
+
'eo:productType': '{eo:productType?}',
|
|
287
|
+
'eo:sensorType': '{eo:sensorType?}',
|
|
288
|
+
'eo:snowCover': '{eo:snowCover?}',
|
|
289
|
+
'eo:spectralRange': '{eo:spectralRange?}'
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
node1.set('template', '%s%s' % (self.bind_url,
|
|
293
|
+
'&'.join(f'{k}={v}' for k, v in kvps.items())))
|
|
294
|
+
|
|
295
|
+
# Requirement-023
|
|
296
|
+
node1 = etree.SubElement(node, util.nspath_eval('os:Url', self.namespaces))
|
|
297
|
+
node1.set('type', 'application/atom+xml')
|
|
298
|
+
|
|
299
|
+
kvps['outputformat'] = r'application%2Fatom%2Bxml'
|
|
300
|
+
kvps['mode'] = 'opensearch'
|
|
301
|
+
|
|
302
|
+
node1.set('template', '%s%s' % (self.bind_url,
|
|
303
|
+
'&'.join(f'{k}={v}' for k, v in kvps.items())))
|
|
304
|
+
|
|
305
|
+
node1 = etree.SubElement(node, util.nspath_eval('os:Image', self.namespaces))
|
|
306
|
+
node1.set('type', 'image/vnd.microsoft.icon')
|
|
307
|
+
node1.set('width', '16')
|
|
308
|
+
node1.set('height', '16')
|
|
309
|
+
node1.text = 'https://pycsw.org/img/favicon.ico'
|
|
310
|
+
|
|
311
|
+
os_query = etree.SubElement(node, util.nspath_eval('os:Query', self.namespaces), role='example', searchTerms='cat')
|
|
312
|
+
|
|
313
|
+
etree.SubElement(node, util.nspath_eval('os:Developer', self.namespaces)).text = self.exml.xpath('//ows20:IndividualName', namespaces=self.context.namespaces)[0].text
|
|
314
|
+
etree.SubElement(node, util.nspath_eval('os:Contact', self.namespaces)).text = self.exml.xpath('//ows20:ElectronicMailAddress', namespaces=self.context.namespaces)[0].text
|
|
315
|
+
etree.SubElement(node, util.nspath_eval('os:Attribution', self.namespaces)).text = self.exml.xpath('//ows20:ProviderName', namespaces=self.context.namespaces)[0].text
|
|
316
|
+
elif response_name == 'ExceptionReport':
|
|
317
|
+
node = self.exml
|
|
318
|
+
else: # GetRecordById output
|
|
319
|
+
node = etree.Element(util.nspath_eval('atom:feed',
|
|
320
|
+
self.context.namespaces), nsmap=self.namespaces)
|
|
321
|
+
etree.SubElement(node, util.nspath_eval('atom:id',
|
|
322
|
+
self.context.namespaces)).text = self.cfg['server'].get('url')
|
|
323
|
+
etree.SubElement(node, util.nspath_eval('atom:title',
|
|
324
|
+
self.context.namespaces)).text = self.cfg['metadata']['identification']['title']
|
|
325
|
+
#etree.SubElement(node, util.nspath_eval('atom:updated',
|
|
326
|
+
# self.context.namespaces)).text = self.exml.xpath('//@timestamp')[0]
|
|
327
|
+
|
|
328
|
+
etree.SubElement(node, util.nspath_eval('os:totalResults',
|
|
329
|
+
self.context.namespaces)).text = '1'
|
|
330
|
+
etree.SubElement(node, util.nspath_eval('os:startIndex',
|
|
331
|
+
self.context.namespaces)).text = '1'
|
|
332
|
+
etree.SubElement(node, util.nspath_eval('os:itemsPerPage',
|
|
333
|
+
self.context.namespaces)).text = '1'
|
|
334
|
+
|
|
335
|
+
for rec in self.exml.xpath('//atom:entry', namespaces=self.context.namespaces):
|
|
336
|
+
#node.append(rec)
|
|
337
|
+
node = rec
|
|
338
|
+
return node
|
|
339
|
+
|
|
340
|
+
def cswrecord2atom(self, rec):
|
|
341
|
+
entry = etree.Element(util.nspath_eval('atom:entry', self.namespaces))
|
|
342
|
+
|
|
343
|
+
etree.SubElement(entry, util.nspath_eval('atom:id', self.context.namespaces)).text = rec.xpath('dc:identifier', namespaces=self.context.namespaces)[0].text
|
|
344
|
+
etree.SubElement(entry, util.nspath_eval('dc:identifier', self.context.namespaces)).text = rec.xpath('dc:identifier', namespaces=self.context.namespaces)[0].text
|
|
345
|
+
etree.SubElement(entry, util.nspath_eval('atom:title', self.context.namespaces)).text = rec.xpath('dc:title', namespaces=self.context.namespaces)[0].text
|
|
346
|
+
|
|
347
|
+
dc_date = rec.xpath('dc:date', namespaces=self.context.namespaces)
|
|
348
|
+
if dc_date:
|
|
349
|
+
etree.SubElement(entry, util.nspath_eval('atom:updated', self.context.namespaces)).text = dc_date[0].text
|
|
350
|
+
|
|
351
|
+
for s in rec.xpath('dc:subject', namespaces=self.context.namespaces):
|
|
352
|
+
etree.SubElement(entry, util.nspath_eval('atom:category', self.context.namespaces), term=s.text)
|
|
353
|
+
|
|
354
|
+
for d in rec.xpath('dct:references', namespaces=self.context.namespaces):
|
|
355
|
+
link = etree.SubElement(entry, util.nspath_eval('atom:link', self.context.namespaces))
|
|
356
|
+
link.attrib['href'] = d.text
|
|
357
|
+
|
|
358
|
+
scheme = d.attrib.get('scheme')
|
|
359
|
+
if scheme is not None:
|
|
360
|
+
if scheme == 'enclosure':
|
|
361
|
+
link.attrib['rel'] = scheme
|
|
362
|
+
link.attrib['type'] = 'application/octet-stream'
|
|
363
|
+
else:
|
|
364
|
+
link.attrib['type'] = scheme
|
|
365
|
+
|
|
366
|
+
bbox = rec.xpath('ows:BoundingBox|ows20:BoundingBox', namespaces=self.context.namespaces)
|
|
367
|
+
if bbox:
|
|
368
|
+
where = etree.SubElement(entry, util.nspath_eval('georss:where', {'georss': 'http://www.georss.org/georss'}))
|
|
369
|
+
envelope = etree.SubElement(where, util.nspath_eval('gml:Envelope', self.context.namespaces))
|
|
370
|
+
envelope.attrib['srsName'] = bbox[0].attrib.get('crs')
|
|
371
|
+
etree.SubElement(envelope, util.nspath_eval('gml:lowerCorner', self.context.namespaces)).text = bbox[0].xpath('ows:LowerCorner|ows20:LowerCorner', namespaces=self.context.namespaces)[0].text
|
|
372
|
+
etree.SubElement(envelope, util.nspath_eval('gml:upperCorner', self.context.namespaces)).text = bbox[0].xpath('ows:UpperCorner|ows20:UpperCorner', namespaces=self.context.namespaces)[0].text
|
|
373
|
+
|
|
374
|
+
return entry
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def kvp2filterxml(kvp, context, profiles, fes_version='1.0'):
|
|
378
|
+
''' transform kvp to filter XML string '''
|
|
379
|
+
|
|
380
|
+
bbox_element = None
|
|
381
|
+
time_element = None
|
|
382
|
+
anytext_elements = []
|
|
383
|
+
query_temporal_by_iso = False
|
|
384
|
+
start_stop_elements_only = False
|
|
385
|
+
|
|
386
|
+
eo_parentidentifier_element = None
|
|
387
|
+
eo_bands_element = None
|
|
388
|
+
eo_cloudcover_element = None
|
|
389
|
+
eo_instrument_element = None
|
|
390
|
+
eo_orbitdirection_element = None
|
|
391
|
+
eo_orbitnumber_element = None
|
|
392
|
+
eo_platform_element = None
|
|
393
|
+
eo_processinglevel_element = None
|
|
394
|
+
eo_producttype_element = None
|
|
395
|
+
eo_sensortype_element = None
|
|
396
|
+
eo_snowcover_element = None
|
|
397
|
+
|
|
398
|
+
if profiles is not None and 'plugins' in profiles and 'APISO' in profiles['plugins']:
|
|
399
|
+
query_temporal_by_iso = True
|
|
400
|
+
|
|
401
|
+
# Count parameters
|
|
402
|
+
par_count = 0
|
|
403
|
+
for p in ['q','bbox','time']:
|
|
404
|
+
if p in kvp and kvp[p] != '':
|
|
405
|
+
par_count += 1
|
|
406
|
+
|
|
407
|
+
# Create root element for FilterXML
|
|
408
|
+
root = etree.Element(util.nspath_eval('ogc:Filter', context.namespaces))
|
|
409
|
+
|
|
410
|
+
# bbox to FilterXML
|
|
411
|
+
if 'bbox' in kvp and kvp['bbox'] != '':
|
|
412
|
+
LOGGER.debug('Detected bbox parameter')
|
|
413
|
+
bbox_list = [x.strip() for x in kvp['bbox'].split(',')]
|
|
414
|
+
bbox_element = etree.Element(util.nspath_eval('ogc:BBOX',
|
|
415
|
+
context.namespaces))
|
|
416
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyName',
|
|
417
|
+
context.namespaces))
|
|
418
|
+
el.text = 'ows:BoundingBox'
|
|
419
|
+
bbox_element.append(el)
|
|
420
|
+
env = etree.Element(util.nspath_eval('gml:Envelope',
|
|
421
|
+
context.namespaces))
|
|
422
|
+
el = etree.Element(util.nspath_eval('gml:lowerCorner',
|
|
423
|
+
context.namespaces))
|
|
424
|
+
|
|
425
|
+
if len(bbox_list) == 5: # add srsName
|
|
426
|
+
LOGGER.debug('Found CRS')
|
|
427
|
+
env.attrib['srsName'] = bbox_list[4]
|
|
428
|
+
else:
|
|
429
|
+
LOGGER.debug('Assuming 4326')
|
|
430
|
+
env.attrib['srsName'] = 'urn:ogc:def:crs:OGC:1.3:CRS84'
|
|
431
|
+
if not validate_4326(bbox_list):
|
|
432
|
+
msg = '4326 coordinates out of range: %s' % bbox_list
|
|
433
|
+
LOGGER.error(msg)
|
|
434
|
+
raise RuntimeError(msg)
|
|
435
|
+
|
|
436
|
+
try:
|
|
437
|
+
el.text = "%s %s" % (bbox_list[0], bbox_list[1])
|
|
438
|
+
except Exception as err:
|
|
439
|
+
errortext = 'Exception: OpenSearch bbox not valid.\nError: %s.' % str(err)
|
|
440
|
+
LOGGER.exception(errortext)
|
|
441
|
+
env.append(el)
|
|
442
|
+
el = etree.Element(util.nspath_eval('gml:upperCorner',
|
|
443
|
+
context.namespaces))
|
|
444
|
+
try:
|
|
445
|
+
el.text = "%s %s" % (bbox_list[2], bbox_list[3])
|
|
446
|
+
except Exception as err:
|
|
447
|
+
errortext = 'Exception: OpenSearch bbox not valid.\nError: %s.' % str(err)
|
|
448
|
+
LOGGER.exception(errortext)
|
|
449
|
+
env.append(el)
|
|
450
|
+
bbox_element.append(env)
|
|
451
|
+
|
|
452
|
+
# q to FilterXML
|
|
453
|
+
if 'q' in kvp and kvp['q'] != '':
|
|
454
|
+
LOGGER.debug('Detected q parameter')
|
|
455
|
+
qvals = kvp['q'].split()
|
|
456
|
+
LOGGER.debug(qvals)
|
|
457
|
+
if len(qvals) > 1:
|
|
458
|
+
par_count += 1
|
|
459
|
+
for qval in qvals:
|
|
460
|
+
LOGGER.debug('processing q token')
|
|
461
|
+
anytext_element = etree.Element(util.nspath_eval('ogc:PropertyIsEqualTo',
|
|
462
|
+
context.namespaces))
|
|
463
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyName',
|
|
464
|
+
context.namespaces))
|
|
465
|
+
el.text = 'csw:AnyText'
|
|
466
|
+
anytext_element.append(el)
|
|
467
|
+
el = etree.Element(util.nspath_eval('ogc:Literal',
|
|
468
|
+
context.namespaces))
|
|
469
|
+
el.text = qval
|
|
470
|
+
anytext_element.append(el)
|
|
471
|
+
anytext_elements.append(anytext_element)
|
|
472
|
+
|
|
473
|
+
if ('start' in kvp or 'stop' in kvp) and 'time' not in kvp:
|
|
474
|
+
start_stop_elements_only = True
|
|
475
|
+
LOGGER.debug('Detected start/stop in KVP')
|
|
476
|
+
kvp['time'] = ''
|
|
477
|
+
if 'start' in kvp and kvp['start'] != '':
|
|
478
|
+
kvp['time'] = kvp['start'] + '/'
|
|
479
|
+
if 'stop' in kvp and kvp['stop'] != '':
|
|
480
|
+
if len(kvp['time']) > 0:
|
|
481
|
+
kvp['time'] += kvp['stop']
|
|
482
|
+
else:
|
|
483
|
+
kvp['time'] = '/' + kvp['stop']
|
|
484
|
+
LOGGER.debug(f'new KVP time: {kvp["time"]}')
|
|
485
|
+
|
|
486
|
+
# time to FilterXML
|
|
487
|
+
if 'time' in kvp and kvp['time'] != '':
|
|
488
|
+
LOGGER.debug('Detected time parameter %s', kvp['time'])
|
|
489
|
+
time_list = kvp['time'].split("/")
|
|
490
|
+
|
|
491
|
+
LOGGER.debug('TIMELIST: %s', time_list)
|
|
492
|
+
|
|
493
|
+
if len(time_list) == 2:
|
|
494
|
+
if '' not in time_list: # both dates present
|
|
495
|
+
LOGGER.debug('Both dates present')
|
|
496
|
+
if query_temporal_by_iso:
|
|
497
|
+
LOGGER.debug('Querying by ISO data extent')
|
|
498
|
+
time_element = etree.Element(util.nspath_eval('ogc:And',
|
|
499
|
+
context.namespaces))
|
|
500
|
+
|
|
501
|
+
begin_element = etree.Element(util.nspath_eval('ogc:PropertyIsGreaterThanOrEqualTo',
|
|
502
|
+
context.namespaces))
|
|
503
|
+
etree.SubElement(begin_element, util.nspath_eval('ogc:PropertyName',
|
|
504
|
+
context.namespaces)).text = 'apiso:TempExtent_begin'
|
|
505
|
+
etree.SubElement(begin_element, util.nspath_eval('ogc:Literal',
|
|
506
|
+
context.namespaces)).text = time_list[0]
|
|
507
|
+
|
|
508
|
+
end_element = etree.Element(util.nspath_eval('ogc:PropertyIsLessThanOrEqualTo',
|
|
509
|
+
context.namespaces))
|
|
510
|
+
etree.SubElement(end_element, util.nspath_eval('ogc:PropertyName',
|
|
511
|
+
context.namespaces)).text = 'apiso:TempExtent_end'
|
|
512
|
+
etree.SubElement(end_element, util.nspath_eval('ogc:Literal',
|
|
513
|
+
context.namespaces)).text = time_list[1]
|
|
514
|
+
|
|
515
|
+
time_element.append(begin_element)
|
|
516
|
+
time_element.append(end_element)
|
|
517
|
+
|
|
518
|
+
else:
|
|
519
|
+
LOGGER.debug('Querying by DC date')
|
|
520
|
+
time_element = etree.Element(util.nspath_eval('ogc:PropertyIsBetween',
|
|
521
|
+
context.namespaces))
|
|
522
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyName',
|
|
523
|
+
context.namespaces))
|
|
524
|
+
el.text = 'dc:date'
|
|
525
|
+
time_element.append(el)
|
|
526
|
+
el = etree.Element(util.nspath_eval('ogc:LowerBoundary',
|
|
527
|
+
context.namespaces))
|
|
528
|
+
el2 = etree.Element(util.nspath_eval('ogc:Literal',
|
|
529
|
+
context.namespaces))
|
|
530
|
+
el2.text = time_list[0]
|
|
531
|
+
el.append(el2)
|
|
532
|
+
time_element.append(el)
|
|
533
|
+
el = etree.Element(util.nspath_eval('ogc:UpperBoundary',
|
|
534
|
+
context.namespaces))
|
|
535
|
+
el2 = etree.Element(util.nspath_eval('ogc:Literal',
|
|
536
|
+
context.namespaces))
|
|
537
|
+
el2.text = time_list[1]
|
|
538
|
+
el.append(el2)
|
|
539
|
+
time_element.append(el)
|
|
540
|
+
|
|
541
|
+
else: # one is empty
|
|
542
|
+
LOGGER.debug('Querying by open-ended date')
|
|
543
|
+
if time_list == ['', '']:
|
|
544
|
+
par_count -= 1
|
|
545
|
+
# One of two is empty
|
|
546
|
+
elif time_list[1] == '': # start datetime but no end datetime
|
|
547
|
+
time_element = etree.Element(util.nspath_eval('ogc:PropertyIsGreaterThanOrEqualTo',
|
|
548
|
+
context.namespaces))
|
|
549
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyName',
|
|
550
|
+
context.namespaces))
|
|
551
|
+
if query_temporal_by_iso:
|
|
552
|
+
el.text = 'apiso:TempExtent_begin'
|
|
553
|
+
else:
|
|
554
|
+
el.text = 'dc:date'
|
|
555
|
+
time_element.append(el)
|
|
556
|
+
el = etree.Element(util.nspath_eval('ogc:Literal',
|
|
557
|
+
context.namespaces))
|
|
558
|
+
el.text = time_list[0]
|
|
559
|
+
time_element.append(el)
|
|
560
|
+
else: # end datetime but no start datetime
|
|
561
|
+
time_element = etree.Element(util.nspath_eval('ogc:PropertyIsLessThanOrEqualTo',
|
|
562
|
+
context.namespaces))
|
|
563
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyName',
|
|
564
|
+
context.namespaces))
|
|
565
|
+
if query_temporal_by_iso:
|
|
566
|
+
el.text = 'apiso:TempExtent_end'
|
|
567
|
+
else:
|
|
568
|
+
el.text = 'dc:date'
|
|
569
|
+
time_element.append(el)
|
|
570
|
+
el = etree.Element(util.nspath_eval('ogc:Literal',
|
|
571
|
+
context.namespaces))
|
|
572
|
+
el.text = time_list[1]
|
|
573
|
+
time_element.append(el)
|
|
574
|
+
elif ((len(time_list) == 1) and ('' not in time_list)):
|
|
575
|
+
LOGGER.debug('Querying time instant via dc:date')
|
|
576
|
+
# This is an equal request
|
|
577
|
+
time_element = etree.Element(util.nspath_eval('ogc:PropertyIsEqualTo',
|
|
578
|
+
context.namespaces))
|
|
579
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyName',
|
|
580
|
+
context.namespaces))
|
|
581
|
+
el.text = 'dc:date'
|
|
582
|
+
time_element.append(el)
|
|
583
|
+
el = etree.Element(util.nspath_eval('ogc:Literal',
|
|
584
|
+
context.namespaces))
|
|
585
|
+
el.text = time_list[0]
|
|
586
|
+
time_element.append(el)
|
|
587
|
+
else:
|
|
588
|
+
# Error
|
|
589
|
+
errortext = 'Exception: OpenSearch time not valid: %s.' % str(kvp['time'])
|
|
590
|
+
LOGGER.error(errortext)
|
|
591
|
+
|
|
592
|
+
if time_element is not None and start_stop_elements_only:
|
|
593
|
+
par_count += 1
|
|
594
|
+
|
|
595
|
+
LOGGER.debug('Processing EO queryables')
|
|
596
|
+
if not util.is_none_or_empty(kvp.get('eo:parentidentifier')):
|
|
597
|
+
par_count += 1
|
|
598
|
+
eo_parentidentifier_element = etree.Element(util.nspath_eval('ogc:PropertyIsEqualTo', context.namespaces))
|
|
599
|
+
etree.SubElement(eo_parentidentifier_element,
|
|
600
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:ParentIdentifier'
|
|
601
|
+
etree.SubElement(eo_parentidentifier_element, util.nspath_eval(
|
|
602
|
+
'ogc:Literal', context.namespaces)).text = kvp['eo:parentidentifier']
|
|
603
|
+
|
|
604
|
+
if not util.is_none_or_empty(kvp.get('eo:producttype')):
|
|
605
|
+
par_count += 1
|
|
606
|
+
eo_producttype_element = etree.Element(util.nspath_eval('ogc:PropertyIsLike', context.namespaces),
|
|
607
|
+
matchCase='false', wildCard='*', singleChar='?', escapeChar='\\')
|
|
608
|
+
etree.SubElement(eo_producttype_element,
|
|
609
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Subject'
|
|
610
|
+
etree.SubElement(eo_producttype_element, util.nspath_eval(
|
|
611
|
+
'ogc:Literal', context.namespaces)).text = '*eo:productType:%s*' % kvp['eo:producttype']
|
|
612
|
+
|
|
613
|
+
if not util.is_none_or_empty(kvp.get('eo:platform')):
|
|
614
|
+
par_count += 1
|
|
615
|
+
eo_platform_element = etree.Element(util.nspath_eval('ogc:PropertyIsEqualTo', context.namespaces))
|
|
616
|
+
etree.SubElement(eo_platform_element,
|
|
617
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Platform'
|
|
618
|
+
etree.SubElement(eo_platform_element, util.nspath_eval(
|
|
619
|
+
'ogc:Literal', context.namespaces)).text = kvp['eo:platform']
|
|
620
|
+
|
|
621
|
+
if not util.is_none_or_empty(kvp.get('eo:processinglevel')):
|
|
622
|
+
par_count += 1
|
|
623
|
+
eo_processinglevel_element = etree.Element(util.nspath_eval('ogc:PropertyIsLike', context.namespaces),
|
|
624
|
+
matchCase='false', wildCard='*', singleChar='?', escapeChar='\\')
|
|
625
|
+
etree.SubElement(eo_processinglevel_element,
|
|
626
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Subject'
|
|
627
|
+
etree.SubElement(eo_processinglevel_element, util.nspath_eval(
|
|
628
|
+
'ogc:Literal', context.namespaces)).text = '*eo:processingLevel:%s*' % kvp['eo:processinglevel']
|
|
629
|
+
|
|
630
|
+
if not util.is_none_or_empty(kvp.get('eo:instrument')):
|
|
631
|
+
par_count += 1
|
|
632
|
+
eo_instrument_element = etree.Element(util.nspath_eval('ogc:PropertyIsEqualTo', context.namespaces))
|
|
633
|
+
etree.SubElement(eo_instrument_element,
|
|
634
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Instrument'
|
|
635
|
+
etree.SubElement(eo_instrument_element, util.nspath_eval(
|
|
636
|
+
'ogc:Literal', context.namespaces)).text = kvp['eo:instrument']
|
|
637
|
+
|
|
638
|
+
if not util.is_none_or_empty(kvp.get('eo:sensortype')):
|
|
639
|
+
par_count += 1
|
|
640
|
+
eo_sensortype_element = etree.Element(util.nspath_eval('ogc:PropertyIsEqualTo', context.namespaces))
|
|
641
|
+
etree.SubElement(eo_sensortype_element,
|
|
642
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:SensorType'
|
|
643
|
+
etree.SubElement(eo_sensortype_element, util.nspath_eval(
|
|
644
|
+
'ogc:Literal', context.namespaces)).text = kvp['eo:sensortype']
|
|
645
|
+
|
|
646
|
+
if not util.is_none_or_empty(kvp.get('eo:cloudcover')):
|
|
647
|
+
par_count += 1
|
|
648
|
+
eo_cloudcover_element = evaluate_literal(context, 'apiso:CloudCover', kvp['eo:cloudcover'])
|
|
649
|
+
|
|
650
|
+
if not util.is_none_or_empty(kvp.get('eo:snowcover')):
|
|
651
|
+
par_count += 1
|
|
652
|
+
eo_snowcover_element = etree.Element(util.nspath_eval('ogc:PropertyIsLike', context.namespaces),
|
|
653
|
+
matchCase='false', wildCard='*', singleChar='?', escapeChar='\\')
|
|
654
|
+
etree.SubElement(eo_snowcover_element,
|
|
655
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Subject'
|
|
656
|
+
etree.SubElement(eo_snowcover_element, util.nspath_eval(
|
|
657
|
+
'ogc:Literal', context.namespaces)).text = '*eo:snowCover:%s*' % kvp['eo:snowcover']
|
|
658
|
+
|
|
659
|
+
if not util.is_none_or_empty(kvp.get('eo:spectralrange')):
|
|
660
|
+
par_count += 1
|
|
661
|
+
eo_bands_element = etree.Element(util.nspath_eval('ogc:PropertyIsLike', context.namespaces),
|
|
662
|
+
matchCase='false', wildCard='*', singleChar='?', escapeChar='\\')
|
|
663
|
+
etree.SubElement(eo_bands_element,
|
|
664
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Bands'
|
|
665
|
+
etree.SubElement(eo_bands_element, util.nspath_eval(
|
|
666
|
+
'ogc:Literal', context.namespaces)).text = '*%s*' % kvp['eo:spectralrange']
|
|
667
|
+
|
|
668
|
+
if not util.is_none_or_empty(kvp.get('eo:orbitnumber')):
|
|
669
|
+
par_count += 1
|
|
670
|
+
eo_orbitnumber_element = etree.Element(util.nspath_eval('ogc:PropertyIsLike', context.namespaces),
|
|
671
|
+
matchCase='false', wildCard='*', singleChar='?', escapeChar='\\')
|
|
672
|
+
etree.SubElement(eo_orbitnumber_element,
|
|
673
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Subject'
|
|
674
|
+
etree.SubElement(eo_orbitnumber_element, util.nspath_eval(
|
|
675
|
+
'ogc:Literal', context.namespaces)).text = '*eo:orbitNumber:%s*' % kvp['eo:orbitnumber']
|
|
676
|
+
|
|
677
|
+
if not util.is_none_or_empty(kvp.get('eo:orbitdirection')):
|
|
678
|
+
par_count += 1
|
|
679
|
+
eo_orbitdirection_element = etree.Element(util.nspath_eval('ogc:PropertyIsLike', context.namespaces),
|
|
680
|
+
matchCase='false', wildCard='*', singleChar='?', escapeChar='\\')
|
|
681
|
+
etree.SubElement(eo_orbitdirection_element,
|
|
682
|
+
util.nspath_eval('ogc:PropertyName', context.namespaces)).text = 'apiso:Subject'
|
|
683
|
+
etree.SubElement(eo_orbitdirection_element, util.nspath_eval(
|
|
684
|
+
'ogc:Literal', context.namespaces)).text = '*eo:orbitDirection:%s*' % kvp['eo:orbitdirection']
|
|
685
|
+
|
|
686
|
+
LOGGER.info('Query parameter count: %s', par_count)
|
|
687
|
+
if par_count == 0:
|
|
688
|
+
return ''
|
|
689
|
+
elif par_count == 1:
|
|
690
|
+
LOGGER.debug('Single predicate filter')
|
|
691
|
+
# Only one OpenSearch parameter exists
|
|
692
|
+
if 'bbox' in kvp and kvp['bbox'] != '':
|
|
693
|
+
LOGGER.debug('Adding bbox')
|
|
694
|
+
root.append(bbox_element)
|
|
695
|
+
elif time_element is not None:
|
|
696
|
+
LOGGER.debug('Adding time')
|
|
697
|
+
root.append(time_element)
|
|
698
|
+
elif anytext_elements:
|
|
699
|
+
LOGGER.debug('Adding anytext')
|
|
700
|
+
root.extend(anytext_elements)
|
|
701
|
+
elif par_count > 1:
|
|
702
|
+
LOGGER.debug('ogc:And query (%d predicates)', par_count)
|
|
703
|
+
# Since more than 1 parameter, append the AND logical operator
|
|
704
|
+
logical_and = etree.Element(util.nspath_eval('ogc:And',
|
|
705
|
+
context.namespaces))
|
|
706
|
+
if bbox_element is not None:
|
|
707
|
+
logical_and.append(bbox_element)
|
|
708
|
+
if time_element is not None:
|
|
709
|
+
logical_and.append(time_element)
|
|
710
|
+
if anytext_elements is not None:
|
|
711
|
+
logical_and.extend(anytext_elements)
|
|
712
|
+
root.append(logical_and)
|
|
713
|
+
|
|
714
|
+
if par_count == 1:
|
|
715
|
+
node_to_append = root
|
|
716
|
+
elif par_count > 1:
|
|
717
|
+
node_to_append = logical_and
|
|
718
|
+
|
|
719
|
+
LOGGER.debug('Adding EO queryables')
|
|
720
|
+
for eo_element in [eo_producttype_element, eo_platform_element, eo_instrument_element,
|
|
721
|
+
eo_sensortype_element, eo_cloudcover_element, eo_snowcover_element,
|
|
722
|
+
eo_bands_element, eo_orbitnumber_element, eo_orbitdirection_element,
|
|
723
|
+
eo_processinglevel_element, eo_parentidentifier_element]:
|
|
724
|
+
if eo_element is not None:
|
|
725
|
+
node_to_append.append(eo_element)
|
|
726
|
+
|
|
727
|
+
# Render etree to string XML
|
|
728
|
+
filterstring = etree.tostring(root, encoding='unicode')
|
|
729
|
+
if fes_version == '2.0':
|
|
730
|
+
filterstring = filterstring.replace('PropertyName', 'ValueReference')\
|
|
731
|
+
.replace('xmlns:ogc="http://www.opengis.net/ogc"', 'xmlns:fes20="http://www.opengis.net/fes/2.0"')\
|
|
732
|
+
.replace('ogc:', 'fes20:')\
|
|
733
|
+
.replace('xmlns:gml311="http://www.opengis.net/gml"', 'xmlns:gml32="http://www.opengis.net/gml/3.2"')\
|
|
734
|
+
.replace('gml311:', 'gml32:')
|
|
735
|
+
|
|
736
|
+
LOGGER.debug(filterstring)
|
|
737
|
+
|
|
738
|
+
return filterstring
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
def evaluate_literal(context, pname, pvalue):
|
|
742
|
+
"""
|
|
743
|
+
Transforms OpenSearch EO mathematical notation
|
|
744
|
+
to OGC FES syntax
|
|
745
|
+
|
|
746
|
+
:param pname: parameter name
|
|
747
|
+
:param pvalue: parameter value
|
|
748
|
+
|
|
749
|
+
:returns: lxml Element of predicate
|
|
750
|
+
"""
|
|
751
|
+
|
|
752
|
+
LOGGER.debug(f'property name: {pname}')
|
|
753
|
+
LOGGER.debug(f'property value: {pvalue}')
|
|
754
|
+
|
|
755
|
+
if pvalue.startswith('{') and pvalue.endswith('}'):
|
|
756
|
+
# {n1,n2,…} equals to field=n1 OR field=n2 OR …
|
|
757
|
+
values = pvalue.lstrip('{').rstrip('}').split(',')
|
|
758
|
+
el = etree.Element(util.nspath_eval('ogc:Or', context.namespaces))
|
|
759
|
+
|
|
760
|
+
for value in values:
|
|
761
|
+
el2 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsEqualTo', context.namespaces))
|
|
762
|
+
etree.SubElement(el2, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
763
|
+
etree.SubElement(el2, util.nspath_eval('ogc:Literal', context.namespaces)).text = value
|
|
764
|
+
|
|
765
|
+
elif pvalue.startswith('[') and pvalue.endswith(']'):
|
|
766
|
+
# [n1,n2] equal to n1 <= field <= n2
|
|
767
|
+
values = pvalue.lstrip('[').rstrip(']').split(',')
|
|
768
|
+
el = etree.Element(util.nspath_eval('ogc:And', context.namespaces))
|
|
769
|
+
|
|
770
|
+
el2 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsLessThanOrEqualTo', context.namespaces))
|
|
771
|
+
etree.SubElement(el2, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
772
|
+
etree.SubElement(el2, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[0]
|
|
773
|
+
|
|
774
|
+
el3 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsGreaterThanOrEqualTo', context.namespaces))
|
|
775
|
+
etree.SubElement(el3, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
776
|
+
etree.SubElement(el3, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[1]
|
|
777
|
+
|
|
778
|
+
elif pvalue.startswith(']') and pvalue.endswith('['):
|
|
779
|
+
# ]n1,n2[ equals to n1 < field < n2
|
|
780
|
+
values = pvalue.lstrip(']').rstrip('[').split(',')
|
|
781
|
+
el = etree.Element(util.nspath_eval('ogc:And', context.namespaces))
|
|
782
|
+
|
|
783
|
+
el2 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsLessThan', context.namespaces))
|
|
784
|
+
etree.SubElement(el2, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
785
|
+
etree.SubElement(el2, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[0]
|
|
786
|
+
|
|
787
|
+
el3 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsGreaterThan', context.namespaces))
|
|
788
|
+
etree.SubElement(el3, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
789
|
+
etree.SubElement(el3, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[1]
|
|
790
|
+
|
|
791
|
+
elif pvalue.startswith('['):
|
|
792
|
+
# [n1 equals to n1<= field
|
|
793
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyIsGreaterThanOrEqualTo', context.namespaces))
|
|
794
|
+
etree.SubElement(el, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
795
|
+
etree.SubElement(el, util.nspath_eval('ogc:Literal', context.namespaces)).text = pvalue.lstrip('[')
|
|
796
|
+
|
|
797
|
+
elif pvalue.endswith(']'):
|
|
798
|
+
# n2] equals to field <= n2
|
|
799
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyIsLessThanOrEqualTo', context.namespaces))
|
|
800
|
+
etree.SubElement(el, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
801
|
+
etree.SubElement(el, util.nspath_eval('ogc:Literal', context.namespaces)).text = pvalue.rstrip(']')
|
|
802
|
+
|
|
803
|
+
elif pvalue.startswith('[') and pvalue.endswith('['):
|
|
804
|
+
# [n1,n2[ equals to n1 <= field < n2
|
|
805
|
+
values = pvalue.lstrip('[').rstrip('[').split(',')
|
|
806
|
+
el = etree.Element(util.nspath_eval('ogc:And', context.namespaces))
|
|
807
|
+
|
|
808
|
+
el2 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsLessThanOrEqualTo', context.namespaces))
|
|
809
|
+
etree.SubElement(el2, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
810
|
+
etree.SubElement(el2, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[0]
|
|
811
|
+
|
|
812
|
+
el3 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsGreaterThan', context.namespaces))
|
|
813
|
+
etree.SubElement(el3, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
814
|
+
etree.SubElement(el3, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[1]
|
|
815
|
+
|
|
816
|
+
elif pvalue.startswith(']') and pvalue.endswith(']'):
|
|
817
|
+
# ]n1,n2] equal to n1 < field <= n2
|
|
818
|
+
values = pvalue.lstrip(']').rstrip(']').split(',')
|
|
819
|
+
el = etree.Element(util.nspath_eval('ogc:And', context.namespaces))
|
|
820
|
+
|
|
821
|
+
el2 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsLessThan', context.namespaces))
|
|
822
|
+
etree.SubElement(el2, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
823
|
+
etree.SubElement(el2, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[0]
|
|
824
|
+
|
|
825
|
+
el3 = etree.SubElement(el, util.nspath_eval('ogc:PropertyIsGreaterThanOrEqualTo', context.namespaces))
|
|
826
|
+
etree.SubElement(el3, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
827
|
+
etree.SubElement(el3, util.nspath_eval('ogc:Literal', context.namespaces)).text = values[1]
|
|
828
|
+
|
|
829
|
+
elif pvalue.startswith(']'):
|
|
830
|
+
# ]n1 equals to n1 < field
|
|
831
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyIsGreaterThan', context.namespaces))
|
|
832
|
+
etree.SubElement(el, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
833
|
+
etree.SubElement(el, util.nspath_eval('ogc:Literal', context.namespaces)).text = pvalue.lstrip(']')
|
|
834
|
+
|
|
835
|
+
elif pvalue.endswith('['):
|
|
836
|
+
# n2[ equals to field < n2
|
|
837
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyIsLessThan', context.namespaces))
|
|
838
|
+
etree.SubElement(el, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
839
|
+
etree.SubElement(el, util.nspath_eval('ogc:Literal', context.namespaces)).text = pvalue.rstrip('[')
|
|
840
|
+
|
|
841
|
+
else:
|
|
842
|
+
# n1 equal to field = n1
|
|
843
|
+
el = etree.Element(util.nspath_eval('ogc:PropertyIsEqualTo', context.namespaces))
|
|
844
|
+
etree.SubElement(el, util.nspath_eval('ogc:PropertyName', context.namespaces)).text = pname
|
|
845
|
+
etree.SubElement(el, util.nspath_eval('ogc:Literal', context.namespaces)).text = pvalue
|
|
846
|
+
|
|
847
|
+
return el
|
|
848
|
+
|
|
849
|
+
def validate_4326(bbox_list):
|
|
850
|
+
"""Helper function to validate 4326."""
|
|
851
|
+
is_valid = False
|
|
852
|
+
if ((-180.0 <= float(bbox_list[0]) <= 180.0) and
|
|
853
|
+
(-90.0 <= float(bbox_list[1]) <= 90.0) and
|
|
854
|
+
(-180.0 <= float(bbox_list[2]) <= 180.0) and
|
|
855
|
+
(-90.0 <= float(bbox_list[3]) <= 90.0)):
|
|
856
|
+
is_valid = True
|
|
857
|
+
return is_valid
|