无法使用任何ol.format解析ArcGIS的WFS GetFeature输出。*

时间:2016-09-07 08:36:34

标签: openlayers-3 arcgis geoserver gml

一个简单的 ol.format.ogc.filter.bbox 使用Geoserver没问题,我可以按如下方式解析输出xml:

features = new ol.format.GML3().readFeatures(result);

然而;在ArcGIS中使用相同的过滤器时,无法解析输出xml。地图服务器返回的结果是正确的,但上面的代码只解析返回的第一个特征。我尝试使用新的ol.format.GML2来解析正确数量的功能,但没有几何,所以我认为情况并非如此。输出xmls有明显的差异(见下文)。

如何使用OpenLayers 3解析第二个xml(由ArcGIS返回)?有没有办法在ArcGIS中更改输出xml?

利用Geoserver:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection numberOfFeatures="2" timeStamp="2016-09-02T15:19:25.157Z" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:rkms="http://rkms" xmlns:wfs="http://www.opengis.net/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://mapserver/geoserver/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=rkms%3AMyLayer http://www.opengis.net/wfs http://mapserver/geoserver/schemas/wfs/1.1.0/wfs.xsd">
    <gml:boundedBy>
        <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
            <gml:lowerCorner>6290152.654765377 2551363.9791194764</gml:lowerCorner>
            <gml:upperCorner>6290408.655102356 2551457.2361871097</gml:upperCorner>
        </gml:Envelope>
    </gml:boundedBy>
    <gml:featureMembers>
        <rkms:MyLayer gml:id="MyLayer.4727">
            <gml:boundedBy>
                <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
                    <gml:lowerCorner>6290152.654765377 2551363.9791194764</gml:lowerCorner>
                    <gml:upperCorner>6290152.654765377 2551363.9791194764</gml:upperCorner>
                </gml:Envelope>
            </gml:boundedBy>
            <rkms:fid>6319.0</rkms:fid>
            <rkms:uwi>FAHUD WDW-5H1</rkms:uwi>
            <rkms:display_class>General#0x0048</rkms:display_class>
            <rkms:label>FAHUD WDW-5H1</rkms:label>
            <rkms:the_geom>
                <gml:Point srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
                    <gml:pos>6290152.654765377 2551363.9791194764</gml:pos>
                </gml:Point>
            </rkms:the_geom>
            <rkms:well_status>completed</rkms:well_status>
            <rkms:show_type>unknown</rkms:show_type>
        </rkms:MyLayer>
        <rkms:MyLayer gml:id="MyLayer.21732">
            <gml:boundedBy>
                <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
                    <gml:lowerCorner>6290408.655102356 2551457.2361871097</gml:lowerCorner>
                    <gml:upperCorner>6290408.655102356 2551457.2361871097</gml:upperCorner>
                </gml:Envelope>
            </gml:boundedBy>
            <rkms:fid>23325.0</rkms:fid>
            <rkms:uwi>FAHUD WDW-7H1</rkms:uwi>
            <rkms:display_class>General#0x0048</rkms:display_class>
            <rkms:label>FAHUD WDW-7H1</rkms:label>
            <rkms:the_geom>
                <gml:Point srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
                    <gml:pos>6290408.655102356 2551457.2361871097</gml:pos>
                </gml:Point>
            </rkms:the_geom>
            <rkms:well_status>producing</rkms:well_status>
            <rkms:show_type>unknown</rkms:show_type>
        </rkms:MyLayer>
    </gml:featureMembers>

的ArcGIS:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:MyLayer="http://mapserver/arcgis/services/MyLayer/MapServer/WFSServer" xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mapserver/arcgis/services/MyLayer/MapServer/WFSServer http://mapserver/arcgis/services/MyLayer/MapServer/WFSServer?request=DescribeFeatureType%26version=1.1.0%26typename=WellHole http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd">
    <gml:boundedBy>
        <gml:Envelope srsName="EPSG:3857">
            <gml:lowerCorner>6280561.8275626749 2548148.676770444</gml:lowerCorner>
            <gml:upperCorner>6289533.3190469407 2559799.8122104518</gml:upperCorner>
        </gml:Envelope>
    </gml:boundedBy>
    <gml:featureMember>
        <MyLayer:WellHole gml:id="F662__369">
            <MyLayer:OBJECTID>369</MyLayer:OBJECTID>
            <MyLayer:Well_Number>0</MyLayer:Well_Number>
            <MyLayer:Hole_Number>0</MyLayer:Hole_Number>
            <MyLayer:SHAPE>
                <gml:Point>
                    <gml:pos>6288892.4079840938 2550358.0037752441</gml:pos>
                </gml:Point>
            </MyLayer:SHAPE>
        </MyLayer:WellHole>
    </gml:featureMember>
    <gml:featureMember>
        <MyLayer:WellHole gml:id="F662__400">
            <MyLayer:OBJECTID>400</MyLayer:OBJECTID>
            <MyLayer:Well_Number>0</MyLayer:Well_Number>
            <MyLayer:Hole_Number>0</MyLayer:Hole_Number>
            <MyLayer:SHAPE>
                <gml:Point>
                    <gml:pos>6288797.9203164754 2550567.9331951309</gml:pos>
                </gml:Point>
            </MyLayer:SHAPE>
        </MyLayer:WellHole>
    </gml:featureMember>
</wfs:FeatureCollection>

1 个答案:

答案 0 :(得分:2)

使用应该有效的ol.format.WFS。

features getting parsed