# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # ------------------------------------------------------------------------------- from ows.xml import ElementMaker, NameSpace, NameSpaceMap, Element from .types import Field, DataRecord ns_swe = NameSpace("http://www.opengis.net/swe/2.0", "swe") nsmap = NameSpaceMap(ns_swe) SWE = ElementMaker(namespace=ns_swe.uri, nsmap=nsmap) def encode_field(field: Field) -> Element: return SWE( 'field', SWE( 'Quantity', SWE('description', field.description), SWE( 'nilValues', SWE( 'NilValues', *[ SWE('nilValue', str(value), reason=reason) for value, reason in field.nil_values.items() ])), SWE('uom', code=field.uom), SWE(
from ows.xml import ElementMaker, NameSpace, NameSpaceMap, Element from ows.util import isoformat from ows.swe.v20 import Field, encode_data_record from .types import Grid, RegularAxis, SpatioTemporalType # namespace declarations ns_gml = NameSpace("http://www.opengis.net/gml/3.2", "gml") ns_gmlcov = NameSpace("http://www.opengis.net/gmlcov/1.0", "gmlcov") ns_om = NameSpace("http://www.opengis.net/om/2.0", "om") ns_eop = NameSpace("http://www.opengis.net/eop/2.0", "eop") nsmap = NameSpaceMap(ns_gml, ns_gmlcov, ns_om, ns_eop) # Element factories GML = ElementMaker(namespace=ns_gml.uri, nsmap=nsmap) GMLCOV = ElementMaker(namespace=ns_gmlcov.uri, nsmap=nsmap) OM = ElementMaker(namespace=ns_om.uri, nsmap=nsmap) EOP = ElementMaker(namespace=ns_eop.uri, nsmap=nsmap) def encode_bounded_by(grid: Grid) -> Element: spatial_axes = [ axis for axis in grid.axes if axis.type == SpatioTemporalType.SPATIAL ] temporal_axis = next( (axis for axis in grid.axes if axis.type == SpatioTemporalType.TEMPORAL), None) lower_coords, upper_coords = zip(*[axis.limits for axis in spatial_axes])
# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies of this Software or works derived from this Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # ------------------------------------------------------------------------------- from ows.xml import ElementMaker, NameSpace, NameSpaceMap, Element from ows.common.v20.namespaces import ns_xlink ns_wms = NameSpace("http://www.opengis.net/wms") nsmap = NameSpaceMap(ns_wms, ns_xlink) WMS = ElementMaker(namespace=ns_wms.uri, nsmap=nsmap)
# ------------------------------------------------------------------------------- from datetime import datetime, date, timedelta from typing import List, Union from dataclasses import dataclass from ows.xml import ElementMaker, NameSpace, NameSpaceMap from ows.util import isoformat from ows.swe.v20 import Field, encode_data_record from ows.gml.types import (PositionType, AxisType, Grid, IndexAxis, RegularAxis, IrregularAxis) ns_cis = NameSpace('http://www.opengis.net/cis/1.1/gml', 'cis') nsmap = NameSpaceMap(ns_cis) CIS = ElementMaker(namespace=ns_cis.uri, nsmap=nsmap) def encode_position_value(value: PositionType): if isinstance(value, str): return value elif isinstance(value, datetime): return isoformat(value) return str(value) def encode_axis_extent(axis: AxisType): return CIS( 'AxisExtent',
# ------------------------------------------------------------------------------- # Copyright (C) 2019 EOX IT Services GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies of this Software or works derived from this Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # ------------------------------------------------------------------------------- from ows.xml import NameSpace, NameSpaceMap, ElementMaker from ows.common.v20.namespaces import ns_ows, ns_xlink ns_wps = NameSpace("http://www.opengis.net/wps/2.0", "wps") nsmap = NameSpaceMap(ns_wps, ns_ows, ns_xlink) WPS = ElementMaker(namespace=ns_wps.uri, nsmap=nsmap)
from ows.xml import NameSpace, NameSpaceMap, ElementMaker, ns_xsi from ows.common.v20.namespaces import ns_ows, ns_xlink from ows.gml.v32 import ns_om, ns_gml, ns_gmlcov, ns_eop # namespace declarations ns_ogc = NameSpace("http://www.opengis.net/ogc", "ogc") ns_wcs = NameSpace("http://www.opengis.net/wcs/2.0", "wcs") ns_crs = NameSpace("http://www.opengis.net/wcs/crs/1.0", "crs") ns_rsub = NameSpace("http://www.opengis.net/wcs/range-subsetting/1.0", "rsub") ns_eowcs = NameSpace("http://www.opengis.net/wcs/wcseo/1.0", "wcseo", "http://schemas.opengis.net/wcs/wcseo/1.0/wcsEOAll.xsd") ns_swe = NameSpace("http://www.opengis.net/swe/2.0", "swe") ns_int = NameSpace("http://www.opengis.net/wcs/interpolation/1.0", "int") ns_scal = NameSpace("http://www.opengis.net/wcs/scaling/1.0", "scal") ns_geotiff = NameSpace("http://www.opengis.net/gmlcov/geotiff/1.0", "geotiff") # namespace map nsmap = NameSpaceMap(ns_xlink, ns_ogc, ns_ows, ns_gml, ns_gmlcov, ns_wcs, ns_crs, ns_rsub, ns_eowcs, ns_om, ns_eop, ns_swe, ns_int, ns_scal, ns_geotiff) # Element factories WCS = ElementMaker(namespace=ns_wcs.uri, nsmap=nsmap) CRS = ElementMaker(namespace=ns_crs.uri, nsmap=nsmap) SCAL = ElementMaker(namespace=ns_scal.uri, nsmap=nsmap) EOWCS = ElementMaker(namespace=ns_eowcs.uri, nsmap=nsmap) SWE = ElementMaker(namespace=ns_swe.uri, nsmap=nsmap) INT = ElementMaker(namespace=ns_int.uri, nsmap=nsmap) GEOTIFF = ElementMaker(namespace=ns_geotiff.uri, nsmap=nsmap)
# Copyright (C) 2019 EOX IT Services GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies of this Software or works derived from this Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # ------------------------------------------------------------------------------ from ows.xml import NameSpaceMap, NameSpace, ElementMaker ns_xlink = NameSpace("http://www.w3.org/1999/xlink", "xlink") ns_ows = NameSpace("http://www.opengis.net/ows/2.0", "ows", "http://schemas.opengis.net/ows/2.0/owsAll.xsd") ns_xml = NameSpace("http://www.w3.org/XML/1998/namespace", "xml") nsmap = NameSpaceMap(ns_ows) OWS = ElementMaker(namespace=ns_ows.uri, nsmap=nsmap)