WFS requests on Oracle data

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

WFS requests on Oracle data

Kalbermatten Michaël

Dear all,

 

I am having quite a strange behaviour trying to do a WFS request with a filter body on an Oracle table. I have another project where we are using the same configuration on PostGIS layers and this is not a problem, thus I think it is quite specific to Oracle…

 

The layer definition would be something like:

 

LAYER

    NAME "the_layer"

    TYPE POINT

    STATUS ON

    CONNECTION "user/password@my_alias"

    EXTENT 2500000 1160000 2600000 1250000

    CONNECTIONTYPE PLUGIN

    PLUGIN "C:\Mapserver7_x64\bin\ms\plugins\oci\msplugin_oracle.dll"

    PROCESSING "CLOSE_CONNECTION=DEFER"

    DATA "GEOM FROM (

        SELECT

*

        FROM my_schema.my_table

        )"

    METADATA

        "ows_title" " the_layer "

        "wms_srs" "EPSG:2056"

        "gml_include_items" "*"

        "wfs_enable_request" "*"

        "gml_geometries" "geom"

        "gml_geom_type" "point"

        "ows_metadataurl_href" ""

        "wfs_srs" "EPSG:2056"

        "gml_featureid"     "NOCOM"

    END

    TEMPLATE "ttt"

    PROJECTION

        "init=epsg:2056"

    END

    CLASS

        NAME "The class"

        STYLE

            SYMBOL "triangle"

            SIZE 10

            COLOR 255 221 85

        END

    END

    TOLERANCE 10

END

 

Some remarks: the Oracle raw data has not any projection defined, the geometry looks like:

 

MDSYS.SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(2549853.47, 1194865.78, NULL), NULL, NULL)

 

If I add a projection condition in the DATA section of the mapfile (“USING srid 2056”), then the layer does not work anymore. IHMO, Oracle has always had quite a strange projection support…

 

Furthermore, I am using the PLUGIN connection type, because my version of Mapserver (taken from gisinternals) does not support Oracle Spatial directly and the OGR included version neither.

 

Now, almost all kind of requests are working (WMS, raw WFS without any XML body).

 

Here under is the log (DEBUG 5) of two WFS requests, on the same layer, using the same envelopes. In the first request, the envelope XML tag contains an attribute (srsName) referring to the projection. This attribute is not defined in the second request.

 

There are no results for the first request and there are results for the second request, which I have been using for years. The only thing differing is the famous srsName attribute on the envelope tag. Actually, I am thinking that I misused this for years and that this actually worked (with a lot of chance…)

 

You can also see how this induces a different FLTLayerApplyPlainFilterToLayer() definition between the two requests. Without the srsName attribute, Mapserver only uses the rect filter, otherwise it seems to add an “intersects” condition, which make the query not returning any results.

 

My question is, why this difference as the projection is the same everywhere in my Mapfile (always 2056) and is there a way to make it work with that famous srsName attribute defined ?

 

Thanks a lot for any hint or explanation on that…

 

Best regards

 

Michael

 

 

DEBUG:

 

[Fri May  3 09:10:49 2019].285000 msWFSParseRequest(): WFS post request: <GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" outputFormat="GML3" maxFeatures="20" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <Query typeName="feature:the_layer" srsName="EPSG:2056" xmlns:feature="http://mapserver.gis.umn.edu/mapserver">

        <Filter xmlns="http://www.opengis.net/ogc">

            <BBOX>

                <PropertyName>geom</PropertyName>

                <Envelope xmlns="http://www.opengis.net/gml" srsName="EPSG:2056">

                    <lowerCorner>2558525 1201600</lowerCorner>

                    <upperCorner>2566375 1208250</upperCorner>

                </Envelope>

            </BBOX>

        </Filter>

    </Query>

</GetFeature>

[Fri May  3 09:10:49 2019].584000 FLTLayerApplyPlainFilterToLayer(): intersects([shape],fromText('POLYGON ((2558525.0000000000000000 1201600.0000000000000000, 2558525.0000000000000000 1208250.0000000000000000, 2566375.0000000000000000 1208250.0000000000000000, 2566375.0000000000000000 1201600.0000000000000000, 2558525.0000000000000000 1201600.0000000000000000))')) = TRUE, rect=2558525,1201600,2566375,1208250.00000001

[Fri May  3 09:10:49 2019].764000 msQueryByFilter(): Search returned no results. No matching record(s) found.

[Fri May  3 09:10:49 2019].764000 mapserv request processing time (msLoadMap not incl.): 0.479s

[Fri May  3 09:10:49 2019].764000 msFreeMap(): freeing map at 00000152DD1D0E60.

[Fri May  3 09:10:59 2019].732000 CGI Request 2 on process 7356

[Fri May  3 09:10:59 2019].732000 msWFSParseRequest(): WFS post request: <GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" outputFormat="GML3" maxFeatures="20" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <Query typeName="feature:the_layer" srsName="EPSG:2056" xmlns:feature="http://mapserver.gis.umn.edu/mapserver">

        <Filter xmlns="http://www.opengis.net/ogc">

            <BBOX>

                <PropertyName>geom</PropertyName>

                <Envelope xmlns="http://www.opengis.net/gml">

                    <lowerCorner>2558525 1201600</lowerCorner>

                    <upperCorner>2566375 1208250</upperCorner>

                </Envelope>

            </BBOX>

        </Filter>

    </Query>

</GetFeature>

[Fri May  3 09:10:59 2019].768000 FLTLayerApplyPlainFilterToLayer(): rect=2558525,1201600,2566375,1208250

[Fri May  3 09:10:59 2019].895000 mapserv request processing time (msLoadMap not incl.): 0.163s

 

 

Result obtained with the first request:

 

<?xml version='1.0' encoding="UTF-8" ?>

<wfs:FeatureCollection

   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"

   xmlns:gml="http://www.opengis.net/gml"

   xmlns:wfs="http://www.opengis.net/wfs"

   xmlns:ogc="http://www.opengis.net/ogc"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

   xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://localhost/michael_infopol/mapserv?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=feature:the_layer&amp;OUTPUTFORMAT=SFE_XMLSCHEMA  http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">

    <gml:boundedBy>

        <gml:Null>missing</gml:Null>

    </gml:boundedBy>

</wfs:FeatureCollection>


_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: WFS requests on Oracle data

Kalbermatten Michaël

Actually I found the solution… I am sorry for the noise.

 

For the record, I solved my issue by setting “USING None” at the end of the DATA section of the  Mapfile.

 

For more explanations, please have a look at: https://www.mapserver.org/input/vector/oracle.html#using-none

 

Although I have a defined spatial index, it looks like the PLUGIN mode somehow does not support spatial queries. If anybody has a better explanation, I would be happy to hear about it.

 

Thanks !

 

Michael

 

De : mapserver-users <[hidden email]> De la part de Kalbermatten Michaël
Envoyé : vendredi, 3 mai 2019 10:09
À : '[hidden email]' <[hidden email]>
Objet : [mapserver-users] WFS requests on Oracle data

 

Dear all,

 

I am having quite a strange behaviour trying to do a WFS request with a filter body on an Oracle table. I have another project where we are using the same configuration on PostGIS layers and this is not a problem, thus I think it is quite specific to Oracle…

 

The layer definition would be something like:

 

LAYER

    NAME "the_layer"

    TYPE POINT

    STATUS ON

    CONNECTION "user/password@my_alias"

    EXTENT 2500000 1160000 2600000 1250000

    CONNECTIONTYPE PLUGIN

    PLUGIN "C:\Mapserver7_x64\bin\ms\plugins\oci\msplugin_oracle.dll"

    PROCESSING "CLOSE_CONNECTION=DEFER"

    DATA "GEOM FROM (

        SELECT

*

        FROM my_schema.my_table

        )"

    METADATA

        "ows_title" " the_layer "

        "wms_srs" "EPSG:2056"

        "gml_include_items" "*"

        "wfs_enable_request" "*"

        "gml_geometries" "geom"

        "gml_geom_type" "point"

        "ows_metadataurl_href" ""

        "wfs_srs" "EPSG:2056"

        "gml_featureid"     "NOCOM"

    END

    TEMPLATE "ttt"

    PROJECTION

        "init=epsg:2056"

    END

    CLASS

        NAME "The class"

        STYLE

            SYMBOL "triangle"

            SIZE 10

            COLOR 255 221 85

        END

    END

    TOLERANCE 10

END

 

Some remarks: the Oracle raw data has not any projection defined, the geometry looks like:

 

MDSYS.SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(2549853.47, 1194865.78, NULL), NULL, NULL)

 

If I add a projection condition in the DATA section of the mapfile (“USING srid 2056”), then the layer does not work anymore. IHMO, Oracle has always had quite a strange projection support…

 

Furthermore, I am using the PLUGIN connection type, because my version of Mapserver (taken from gisinternals) does not support Oracle Spatial directly and the OGR included version neither.

 

Now, almost all kind of requests are working (WMS, raw WFS without any XML body).

 

Here under is the log (DEBUG 5) of two WFS requests, on the same layer, using the same envelopes. In the first request, the envelope XML tag contains an attribute (srsName) referring to the projection. This attribute is not defined in the second request.

 

There are no results for the first request and there are results for the second request, which I have been using for years. The only thing differing is the famous srsName attribute on the envelope tag. Actually, I am thinking that I misused this for years and that this actually worked (with a lot of chance…)

 

You can also see how this induces a different FLTLayerApplyPlainFilterToLayer() definition between the two requests. Without the srsName attribute, Mapserver only uses the rect filter, otherwise it seems to add an “intersects” condition, which make the query not returning any results.

 

My question is, why this difference as the projection is the same everywhere in my Mapfile (always 2056) and is there a way to make it work with that famous srsName attribute defined ?

 

Thanks a lot for any hint or explanation on that…

 

Best regards

 

Michael

 

 

DEBUG:

 

[Fri May  3 09:10:49 2019].285000 msWFSParseRequest(): WFS post request: <GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" outputFormat="GML3" maxFeatures="20" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 

    <Query typeName="feature:the_layer" srsName="EPSG:2056" xmlns:feature="http://mapserver.gis.umn.edu/mapserver">

 

        <Filter xmlns="http://www.opengis.net/ogc">

 

            <BBOX>

 

                <PropertyName>geom</PropertyName>

 

                <Envelope xmlns="http://www.opengis.net/gml" srsName="EPSG:2056">

 

                    <lowerCorner>2558525 1201600</lowerCorner>

 

                    <upperCorner>2566375 1208250</upperCorner>

 

                </Envelope>

 

            </BBOX>

 

        </Filter>

 

    </Query>

 

</GetFeature>

[Fri May  3 09:10:49 2019].584000 FLTLayerApplyPlainFilterToLayer(): intersects([shape],fromText('POLYGON ((2558525.0000000000000000 1201600.0000000000000000, 2558525.0000000000000000 1208250.0000000000000000, 2566375.0000000000000000 1208250.0000000000000000, 2566375.0000000000000000 1201600.0000000000000000, 2558525.0000000000000000 1201600.0000000000000000))')) = TRUE, rect=2558525,1201600,2566375,1208250.00000001

[Fri May  3 09:10:49 2019].764000 msQueryByFilter(): Search returned no results. No matching record(s) found.

[Fri May  3 09:10:49 2019].764000 mapserv request processing time (msLoadMap not incl.): 0.479s

[Fri May  3 09:10:49 2019].764000 msFreeMap(): freeing map at 00000152DD1D0E60.

[Fri May  3 09:10:59 2019].732000 CGI Request 2 on process 7356

[Fri May  3 09:10:59 2019].732000 msWFSParseRequest(): WFS post request: <GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" outputFormat="GML3" maxFeatures="20" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 

    <Query typeName="feature:the_layer" srsName="EPSG:2056" xmlns:feature="http://mapserver.gis.umn.edu/mapserver">

 

        <Filter xmlns="http://www.opengis.net/ogc">

 

            <BBOX>

 

                <PropertyName>geom</PropertyName>

 

                <Envelope xmlns="http://www.opengis.net/gml">

 

                    <lowerCorner>2558525 1201600</lowerCorner>

 

                    <upperCorner>2566375 1208250</upperCorner>

 

                </Envelope>

 

            </BBOX>

 

        </Filter>

 

    </Query>

 

</GetFeature>

[Fri May  3 09:10:59 2019].768000 FLTLayerApplyPlainFilterToLayer(): rect=2558525,1201600,2566375,1208250

[Fri May  3 09:10:59 2019].895000 mapserv request processing time (msLoadMap not incl.): 0.163s

 

 

Result obtained with the first request:

 

<?xml version='1.0' encoding="UTF-8" ?>

<wfs:FeatureCollection

   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"

   xmlns:gml="http://www.opengis.net/gml"

   xmlns:wfs="http://www.opengis.net/wfs"

   xmlns:ogc="http://www.opengis.net/ogc"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

   xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://localhost/michael_infopol/mapserv?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=feature:the_layer&amp;OUTPUTFORMAT=SFE_XMLSCHEMA  http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">

    <gml:boundedBy>

        <gml:Null>missing</gml:Null>

    </gml:boundedBy>

</wfs:FeatureCollection>


_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users