解析GML编码的WFS响应XML文件
我需要一些帮助,从这个GML编码的WMS响应XML文件中获取天气细节、温度等。这是我从天气服务中得到的,该服务通过Web目录服务(CSW)、Web地图服务(WMS)和Web要素服务(WFS)提供开放数据。与JSON/XML不同,我不知道这个文件中发生了什么。请为Swift 3提供一些解决方案解析GML编码的WFS响应XML文件,xml,swift,xml-parsing,wms,gml-geographic-markup-lan,Xml,Swift,Xml Parsing,Wms,Gml Geographic Markup Lan,我需要一些帮助,从这个GML编码的WMS响应XML文件中获取天气细节、温度等。这是我从天气服务中得到的,该服务通过Web目录服务(CSW)、Web地图服务(WMS)和Web要素服务(WFS)提供开放数据。与JSON/XML不同,我不知道这个文件中发生了什么。请为Swift 3提供一些解决方案 <?xml version="1.0" encoding="UTF-8"?> <wfs:FeatureCollection timeStamp="2017-07-31T15:48:
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection
timeStamp="2017-07-31T15:48:01Z"
numberMatched="1"
numberReturned="1"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:om="http://www.opengis.net/om/2.0"
xmlns:omso="http://inspire.ec.europa.eu/schemas/omso/3.0"
xmlns:ompr="http://inspire.ec.europa.eu/schemas/ompr/3.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:swe="http://www.opengis.net/swe/2.0"
xmlns:gmlcov="http://www.opengis.net/gmlcov/1.0"
xmlns:sam="http://www.opengis.net/sampling/2.0"
xmlns:sams="http://www.opengis.net/samplingSpatial/2.0"
xmlns:target="http://xml.fmi.fi/namespace/om/atmosphericfeatures/1.0"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd
http://www.opengis.net/gmlcov/1.0 http://schemas.opengis.net/gmlcov/1.0/gmlcovAll.xsd
http://www.opengis.net/sampling/2.0 http://schemas.opengis.net/sampling/2.0/samplingFeature.xsd
http://www.opengis.net/samplingSpatial/2.0 http://schemas.opengis.net/samplingSpatial/2.0/spatialSamplingFeature.xsd
http://www.opengis.net/swe/2.0 http://schemas.opengis.net/sweCommon/2.0/swe.xsd
http://inspire.ec.europa.eu/schemas/omso/3.0 http://inspire.ec.europa.eu/schemas/omso/3.0/SpecialisedObservations.xsd
http://inspire.ec.europa.eu/schemas/ompr/3.0 http://inspire.ec.europa.eu/schemas/ompr/3.0/Processes.xsd
http://xml.fmi.fi/namespace/om/atmosphericfeatures/1.0 http://xml.fmi.fi/schema/om/atmosphericfeatures/1.0/atmosphericfeatures.xsd">
<wfs:member>
<omso:GridSeriesObservation gml:id="WFS-l9pen.SrlipXUb8ZfAc8nS2h_8.JTowuYWbbpdOs2_llx4efR060aeWzDtdOufXlmw48rp1w36d3R0629dnTTw36d3THv7ZeWHPlhaWLLn07qmnbltQ_wp37hjvCY2PlzrUi0Kcd06aMmrhnZd2Spp25bUP8KhE4V2nBm07sk7Lh5ZefSth2ackhmZ8u_Tk51mNmbRy2ZujXl899_LJf39svLvy09MOLZliaWzL2y7KnnhlqZmzfjw7MtambTfjSV3XpmcNbbh8RNPPph3Y8tK1dCA1tunnz07s9TL46VjTsM5lbd.TLsrM0aeWzDtZXDDyw7a1I.XfwkZdOfR0rWqZdvDLyw9OvLLWhQ5ZefPryy1oSOu3Tk09PNbVfTuyRNPLLj6ad.6tavp3ZKfDLlyTadZ1fTuyVZtOs6vp3ZK02nWtNw.NO3rtr6d2StCvp3ZI_Xn0rQiZe9Dfp3dK3qm_ph2Q9m_rkh7.2XlW5Xy4emjLyp.duLfsZ1tTN_eHs39ckPf2y8q4JuXJp67Yezf1yQ9_bLyrckac.iHs39ckPf2y8q3qHLLj08NPTD0079zHRXNQ5Zcenhp6Yemnfug7d_Xd0r2pYcmnD00790fZvxYdkHHj67euzD00791d1LDk04emnfumV4OPH129dmHpp37qwwqWHJpw9NO_dOy9KfXlmw48syvBx4.u3rsw9NO_dWGFSw5NOHpp37p2XpT68s2HHlp14OPH129dmHpp37q.KWHJpw9NO_dE05s3Xnlg48fXb12YemnfubnPpv5ZcnHrl5eb.nJXmFm26XTrNv5ZceHn0dOtGnlsw7XTrn15ZsOPK6dcN.nd0dOtvXZ008N.nd0x7.2Xlhz5Wh007ctPpl4T8hNDpp25bW_dlrGq1IYA-">
<om:phenomenonTime>
<gml:TimePeriod gml:id="time-interval-1-1">
<gml:beginPosition>2017-07-31T16:00:00Z</gml:beginPosition>
<gml:endPosition>2017-08-02T03:00:00Z</gml:endPosition>
</gml:TimePeriod>
</om:phenomenonTime>
<om:resultTime>
<gml:TimeInstant gml:id="time-1-1">
<gml:timePosition>2017-07-31T12:00:00Z</gml:timePosition>
</gml:TimeInstant>
</om:resultTime>
<om:procedure xlink:href="http://xml.fmi.fi/inspire/process/hirlam"/>
<om:parameter>
<om:NamedValue>
<om:name xlink:href="http://xml.fmi.fi/inspire/process/hirlam"/>
<om:value>
<gml:TimeInstant gml:id="analysis-time-1-1">
<gml:timePosition>2017-07-31T12:00:00Z</gml:timePosition>
</gml:TimeInstant>
</om:value>
</om:NamedValue>
</om:parameter>
<om:observedProperty xlink:href="http://data.fmi.fi/fmi-apikey/e35dc8fd-a855-4db5-a327-418120f64a86/meta?observableProperty=forecast&param=GeopHeight,Temperature,Pressure,Humidity,WindDirection,WindSpeedMS,WindUMS,WindVMS,MaximumWind,WindGust,DewPoint,TotalCloudCover,WeatherSymbol3,LowCloudCover,MediumCloudCover,HighCloudCover,Precipitation1h,PrecipitationAmount,RadiationGlobalAccumulation,RadiationLWAccumulation,RadiationNetSurfaceLWAccumulation,RadiationNetSurfaceSWAccumulation,RadiationDiffuseAccumulation&language=eng"/>
<om:featureOfInterest>
<sams:SF_SpatialSamplingFeature gml:id="enn-s-1-1-">
<sam:sampledFeature>
<target:LocationCollection gml:id="sampled-target-1-1">
<target:member>
<target:Location gml:id="forloc-geoid-634963-pos">
<gml:identifier codeSpace="http://xml.fmi.fi/namespace/stationcode/geoid">634963</gml:identifier>
<gml:name codeSpace="http://xml.fmi.fi/namespace/locationcode/name">Tampere</gml:name>
<gml:name codeSpace="http://xml.fmi.fi/namespace/locationcode/geoid">634963</gml:name>
<target:representativePoint xlink:href="#point-634963"/>
<target:country codeSpace="http://xml.fmi.fi/namespace/location/country">Finland</target:country>
<target:timezone>Europe/Helsinki</target:timezone>
<target:region codeSpace="http://xml.fmi.fi/namespace/location/region">Finland</target:region>
</target:Location></target:member>
</target:LocationCollection>
</sam:sampledFeature>
<sams:shape>
<gml:MultiPoint gml:id="sf-1-1-">
<gml:pointMembers>
<gml:Point gml:id="point-634963" srsName="http://www.opengis.net/def/crs/EPSG/0/4258" srsDimension="2">
<gml:name>Tampere</gml:name>
<gml:pos>61.49911 23.78712 </gml:pos>
</gml:Point>
</gml:pointMembers>
</gml:MultiPoint>
</sams:shape>
</sams:SF_SpatialSamplingFeature>
</om:featureOfInterest>
<om:result>
<gmlcov:MultiPointCoverage gml:id="mpcv-1-1">
<gml:domainSet>
<gmlcov:SimpleMultiPoint gml:id="mp-1-1" srsName="http://xml.fmi.fi/gml/crs/compoundCRS.php?crs=4258&time=unixtime" srsDimension="3">
<gmlcov:positions>
61.49911 23.78712 1501516800
61.49911 23.78712 1501520400
61.49911 23.78712 1501524000
61.49911 23.78712 1501527600
61.49911 23.78712 1501531200
</gmlcov:positions>
</gmlcov:SimpleMultiPoint>
</gml:domainSet>
<gml:rangeSet>
<gml:DataBlock>
<gml:rangeParameters/>
<gml:doubleOrNilReasonTupleList>
113.01 18.26 1007.03 92.74 259.0 3.79
113.01 17.79 1007.48 90.02 250.0 3.04
113.01 17.13 1007.82 93.62 229.0 2.19
113.01 16.42 1008.18 95.53 216.0 2.26
113.01 15.9 1008.89 97.09 211.0 2.74
</gml:doubleOrNilReasonTupleList>
</gml:DataBlock>
</gml:rangeSet>
<gml:coverageFunction>
<gml:CoverageMappingRule>
<gml:ruleDefinition>Linear</gml:ruleDefinition>
</gml:CoverageMappingRule>
</gml:coverageFunction>
<gmlcov:rangeType>
<swe:DataRecord>
<swe:field name="GeopHeight" xlink:href="http://"/>
<swe:field name="Temperature" xlink:href="http://"/>
<swe:field name="Pressure" xlink:href="http://"/>
<swe:field name="Humidity" xlink:href="http://"/>
<swe:field name="WindDirection" xlink:href="http://"/>
<swe:field name="WindSpeedMS" xlink:href="http://"/>
</swe:DataRecord>
</gmlcov:rangeType>
</gmlcov:MultiPointCoverage>
</om:result>
</omso:GridSeriesObservation>
</wfs:member>
</wfs:FeatureCollection>
2017-07-31T16:00:00Z
2017-08-02T03:00:00Z
2017-07-31T12:00:00Z
2017-07-31T12:00:00Z
634963
坦佩雷
634963
芬兰
欧洲/赫尔辛基
芬兰
坦佩雷
61.49911 23.78712
61.49911 23.78712 1501516800
61.49911 23.78712 1501520400
61.49911 23.78712 1501524000
61.49911 23.78712 1501527600
61.49911 23.78712 1501531200
113.01 18.26 1007.03 92.74 259.0 3.79
113.01 17.79 1007.48 90.02 250.0 3.04
113.01 17.13 1007.82 93.62 229.0 2.19
113.01 16.42 1008.18 95.53 216.0 2.26
113.01 15.9 1008.89 97.09 211.0 2.74
线性的
我无法帮助您使用swift,但我可以告诉您如何阅读此文件:
您基本上需要以下三个要素:
<gmlcov:positions>
61.49911 23.78712 1501516800
61.49911 23.78712 1501520400
61.49911 23.78712 1501524000
61.49911 23.78712 1501527600
61.49911 23.78712 1501531200
</gmlcov:positions>
<gml:doubleOrNilReasonTupleList>
113.01 18.26 1007.03 92.74 259.0 3.79
113.01 17.79 1007.48 90.02 250.0 3.04
113.01 17.13 1007.82 93.62 229.0 2.19
113.01 16.42 1008.18 95.53 216.0 2.26
113.01 15.9 1008.89 97.09 211.0 2.74
</gml:doubleOrNilReasonTupleList>
<swe:DataRecord>
<swe:field name="GeopHeight" xlink:href="http://"/>
<swe:field name="Temperature" xlink:href="http://"/>
<swe:field name="Pressure" xlink:href="http://"/>
<swe:field name="Humidity" xlink:href="http://"/>
<swe:field name="WindDirection" xlink:href="http://"/>
<swe:field name="WindSpeedMS" xlink:href="http://"/>
</swe:DataRecord>
第二个是实际测量数据,第三个给出测量的含义。这就是第一次测量的结果:
GeopHeight | Temperature | Pressure | Humidity | WindDirection | WindSpeedMs
113.01 | 18.26 | 1007.03 | 92.74 | 259.0 | 3.79
我希望这能有所帮助。谢谢,很容易看到参数和值。问题是把它们拿出来(好的。对不起,我误解了。
GeopHeight | Temperature | Pressure | Humidity | WindDirection | WindSpeedMs
113.01 | 18.26 | 1007.03 | 92.74 | 259.0 | 3.79