WFS 2.0 – Stored Queries Beispiele

Eine praktische Neuerung in WFS 2.0 sind Stored Queries. Stored Queries sind serverseitig gespeicherte Filterdefinitionen, die in einer Anfrage referenziert werden können. Ein Stored Query kann Template-Parameter („Platzhalter“) enthalten, die bei jeder Anfrage individuell belegt werden können.
Die folgenden Beispiele basieren auf den OpenData Verwaltungsgrenzen (ATKIS) der Bayerischen Vermessungsverwaltung und GeoServer 2.2.

 

CreateStoredQuery – Stored Query anlegen

Eine neue StoredQuery wird über die Operation CreateStoredQuery angelegt. Im Beispiel erfolgt eine BoundingBox-Abfrage über das Attribut „the_geom“ (PostGIS Geometriespalte). Die Werte der BoundingBox werden als Template-Parameter („Platzhalter“) „offen“ gelassen. Die benötigten Template-Parameter müssen zuvor über ihren Namen und Datentyp definiert werden.

Request (POST-Methode):

<wfs:CreateStoredQuery service="WFS" version="2.0.0"
xmlns="http://www.opengis.net/wfs/2.0"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bvv="http://www.geodaten.bayern.de"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd" xmlns:ns1="http://www.opengis.net/ows/1.1">
    <wfs:StoredQueryDefinition id="bboxQuery">
        <Title>BoundingBox Query für Gemeinden</Title>
        <!-- Definition Template-Parameter -->
        <wfs:Parameter name="x1" type="xsd:double" />
        <wfs:Parameter name="y1" type="xsd:double" />
        <wfs:Parameter name="x2" type="xsd:double" />
        <wfs:Parameter name="y2" type="xsd:double" />
        <wfs:QueryExpressionText returnFeatureTypes="bvv:gmd_ex" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression">
            <wfs:Query typeNames="bvv:gmd_ex">
                <fes:Filter>
                    <fes:ValueReference>the_geom</fes:ValueReference>
                    <fes:BBOX>
                        <gml:Envelope srsName="urn:ogc:def:crs:EPSG::31468">
                            <!-- Template-Parameter -->
                            <gml:lowerCorner>${y1} ${x1}</gml:lowerCorner>
                            <gml:upperCorner>${y2} ${x2}</gml:upperCorner>
                        </gml:Envelope>
                    </fes:BBOX>
                </fes:Filter>
            </wfs:Query>
        </wfs:QueryExpressionText>
    </wfs:StoredQueryDefinition>
</wfs:CreateStoredQuery>

 

ListStoredQueries – Vorhandene Stored Queries anzeigen

Über die ListStoredQueries-Operation können die auf dem Server vorhandenen Stored Queries angezeigt werden.

Request (GET-Methode):
http://geoserv.weichand.de:8080/geoserver/wfs?service=WFS&version=2.0.0&request=ListStoredQueries

Response:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:ListStoredQueriesResponse 
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://geoserv.weichand.de:8080/geoserver/schemas/wfs/2.0/wfs.xsd" 
    xmlns:ows="http://www.opengis.net/ows/1.1" 
    xmlns:fes="http://www.opengis.net/fes/2.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:gml="http://www.opengis.net/gml/3.2" 
    xmlns:xml="http://www.w3.org/XML/1998/namespace" 
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlmns:wfs="http://www.opengis.net/wfs/2.0">
    <wfs:StoredQuery id="urn:ogc:def:query:OGC-WFS::GetFeatureById">
        <wfs:Title xml:lang="en">Get feature by identifier</wfs:Title>
        <wfs:ReturnFeatureType/>
    </wfs:StoredQuery>
    <wfs:StoredQuery id="DWithinQuery">
        <wfs:Title xml:lang="en">Umkreisuche für Gemeinden (GK4)</wfs:Title>
        <wfs:ReturnFeatureType>bvv:gmd_ex</wfs:ReturnFeatureType>
    </wfs:StoredQuery>
    <wfs:StoredQuery id="InspireStoredQueryExample">
        <wfs:Title xml:lang="en">INSPIRE pre-defined WFS StoredQuery Example</wfs:Title>
        <wfs:ReturnFeatureType>bvv:gmd_ex</wfs:ReturnFeatureType>
    </wfs:StoredQuery>
    <wfs:StoredQuery id="GemeindeByGemeindeschluesselEpsg31468">
        <wfs:Title xml:lang="en">Abfrage einer Gemeinde über den Gemeindeschlüssel</wfs:Title>
        <wfs:ReturnFeatureType>bvv:gmd_ex</wfs:ReturnFeatureType>
    </wfs:StoredQuery>
    <wfs:StoredQuery id="GemeindeMuenchenEpsg31468">
        <wfs:Title xml:lang="en">Abfrage der Gemeinde München</wfs:Title>
        <wfs:ReturnFeatureType>bvv:gmd_ex</wfs:ReturnFeatureType>
    </wfs:StoredQuery>
    <wfs:StoredQuery id="bboxQuery">
        <wfs:Title xml:lang="en">BoundingBox Query für Gemeinden</wfs:Title>
        <wfs:ReturnFeatureType>bvv:gmd_ex</wfs:ReturnFeatureType>
    </wfs:StoredQuery>
</wfs:ListStoredQueriesResponse>

 

DescribeStoredQueries – Aufbau vorhandener Stored Queries anzeigen

Über die DescribeStoredQueries-Operation kann der Aufbau der auf dem Server vorhandenen Stored Queries abgerufen werden.

Request (GET-Methode):

http://geoserv.weichand.de:8080/geoserver/wfs?service=WFS&version=2.0.0&request=DescribeStoredQueries&STOREDQUERY_ID=bboxQuery

Response:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:DescribeStoredQueriesResponse xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://geoserv.weichand.de:8080/geoserver/schemas/wfs/2.0/wfs.xsd" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:wfs="http://www.opengis.net/wfs/2.0">
    <wfs:StoredQueryDescription id="bboxQuery">
        <wfs:Title xml:lang="en">BoundingBox Query für Gemeinden</wfs:Title>
        <wfs:Parameter name="x1" type="xsd:double"/>
        <wfs:Parameter name="y1" type="xsd:double"/>
        <wfs:Parameter name="x2" type="xsd:double"/>
        <wfs:Parameter name="y2" type="xsd:double"/>
        <wfs:QueryExpressionText isPrivate="false" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression" returnFeatureTypes="bvv:gmd_ex">
            <wfs:Query typeNames="bvv:gmd_ex" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xml="http://www.w3.org/XML/1998/namespace">
                <fes:Filter>
                    <fes:ValueReference>the_geom</fes:ValueReference>
                    <fes:BBOX>      
                        <gml:Envelope srsName="urn:ogc:def:crs:EPSG::31468">
                            <gml:lowerCorner>${y1} ${x1} </gml:lowerCorner>
                            <gml:upperCorner>${y2} ${x2}</gml:upperCorner>
                        </gml:Envelope>
                    </fes:BBOX>
                </fes:Filter>
            </wfs:Query>
        </wfs:QueryExpressionText>
    </wfs:StoredQueryDescription>
</wfs:DescribeStoredQueriesResponse>

 

GetFeature – Features über Stored Query abfragen

Die angelegten Stored Queries werden über ihren Identifikator (StoredQuery_ID) in der GetFeature-Anfrage referenziert. Hierfür ist ein GET-Request ausreichend. Des Weiteren werden die definierten Template-Parameter („Platzhalter“) mit Werten befüllt.

Beispiel: BoundingBox-Anfrage (4466856, 5346319, 4466980, 5346396)

Request (GET-Methode):
http://geoserv.weichand.de:8080/geoserver/wfs?service=WFS&request=GetFeature&version=2.0.0&StoredQuery_ID=bboxQuery&x1=4466856&y1=5346319&x2=4466980&y2=5346396

Response (GML 3.2.1):

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection numberMatched="1" numberReturned="1" timeStamp="2012-04-20T22:23:20.448Z" xsi:schemaLocation=" http://geoserv.weichand.de:8080/geoserver/wfs?service=WFS&amp;version=2.0.0&amp;request=DescribeFeatureType&amp;typeName=bvv%3Agmd_ex http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd" xmlns:bvv="http://www.geodaten.bayern.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0">
    <wfs:boundedBy>
        <gml:Envelope>
            <gml:lowerCorner>5341780.936661987 4462958.257411212</gml:lowerCorner>
            <gml:upperCorner>5349278.453021936 4471536.902153544</gml:upperCorner>
        </gml:Envelope>
    </wfs:boundedBy>
    <wfs:member>
        <bvv:gmd_ex gml:id="gmd_ex.336">
            <gml:boundedBy>
                <gml:Envelope srsDimension="2" srsName="urn:ogc:def:crs:EPSG::31468">
                    <gml:lowerCorner>5341780.936661987 4462958.257411212</gml:lowerCorner>
                    <gml:upperCorner>5349278.453021936 4471536.902153544</gml:upperCorner>
                </gml:Envelope>
            </gml:boundedBy>
            <bvv:gid>336</bvv:gid>
            <bvv:land>BY</bvv:land>
            <bvv:modellart>Basis-DLM</bvv:modellart>
            <bvv:objart>75003</bvv:objart>
            <bvv:objart_txt>AX_KommunalesGebiet</bvv:objart_txt>
            <bvv:objid>DEBY8728002NA001</bvv:objid>
            <bvv:hdu_x>0</bvv:hdu_x>
            <bvv:beginn>2012-01-10T17:23:38Z</bvv:beginn>
            <bvv:adm>6001</bvv:adm>
            <bvv:bez_gem>Oberschleißheim</bvv:bez_gem>
            <bvv:bez_krs>München</bvv:bez_krs>
            <bvv:bez_lan>Freistaat Bayern</bvv:bez_lan>
            <bvv:bez_rbz>Oberbayern</bvv:bez_rbz>
            <bvv:sch>09184135</bvv:sch>
            <bvv:the_geom>
                <gml:MultiSurface srsDimension="2" srsName="urn:ogc:def:crs:EPSG::31468">
                    <gml:surfaceMember>
                        <gml:Polygon srsDimension="2">
                            <gml:exterior>
                                <gml:LinearRing>
                                    <gml:posList>5346344.023167079 4463044.9540058775 5346366.296173054 4463048.636731647 5346377.420665045 4463048.481116069 5346390.440016635 4463048.749831998 5346410.140442935 4463050.400545812 5346436.489850431 4463056.81456346 5346443.296169874 4463060.1129027875 5346461.4259787025 4463068.917686452 5346489.200011246 4463089.57812814 5346500.914724013 4463102.485450607 5346505.682480358 4463107.755658491 5346516.974715364 4463120.20613398 5346546.890042741 4463147.275060394 5346555.771042847 4463152.285732155 5346563.270860341 4463156.531878464 5346579.650833361 4463162.225972061 5346601.732761885 4463167.212247259 5346610.280080715 4463167.446277938 5346617.587573679 4463167.651860482 5346947.247559537 4463124.365799797 5346950.463099202 4463122.75018143 5346963.050779075 4463116.397069515 5346980.71741849 4463108.120895616 5347048.019738442 4463076.59599379 5347096.412151283 4463053.919142244 5347153.510266262 4463027.169283158 5347197.926411029 4463006.368547885 5347259.447646519 4462976.809364733 5347281.640678923 4462965.898030875 5347393.279917533 4463240.456719287 5347438.513988841 4463355.910950607 5347529.80035589 4463590.203755707 5347618.764574395 4463866.737392611 5347631.740810885 4463909.576538219 5347666.241967536 4463917.8905946985 5347672.111285782 4463919.300943657 5347738.577490868 4463933.988542984 5347864.212366036 4463959.575874107 5347890.370450806 4463964.991857144 5347946.72342477 4463975.471275418 5347958.680815527 4463977.559986918 5347970.696128544 4463977.3992707785 5347976.3511914825 4463996.064231381 5347977.839184916 4464000.495694656 5347980.583396505 4464009.399596902 5347982.279394895 4464014.909997112 5347906.706011417 4464228.558026729 5347852.85683191 4464391.836770892 5347827.312751004 4464469.266870373 5347804.163007961 4464539.465062959 5347801.169585204 4464550.246192274 5347743.124845698 4464759.154877541 5347740.517981627 4464768.239827994 5347737.726631513 4464777.948036667 5347719.253845046 4464820.157917816 5347692.569495129 4464888.61660123 5347681.133712604 4464917.471396695 5347649.437634597 4465013.524850143 5347566.239852434 4465298.577119775 5347559.416736874 4465320.797112777 5347540.254585134 4465382.434405549 5347506.255287251 4465451.907888384 5347498.969253271 4465469.586403306 5347476.053861905 4465525.09247202 5347412.222807168 4465674.680028401 5347398.201125187 4465710.038520462 5347395.715221863 4465716.286045984 5347392.557171968 4465723.087725319 5347383.920553537 4465741.524019118 5347313.135297824 4465892.370691546 5347314.670861552 4465893.281352386 5347339.172277901 4465907.7892397605 5347333.742732629 4465919.705968165 5347293.134203758 4466039.468326501 5347286.374920025 4466059.288952929 5347245.121008662 4466189.673870751 5347228.736613772 4466241.442105307 5347163.517182451 4466447.54661862 5347141.725498751 4466471.753218607 5347181.19535979 4466527.796410547 5347154.921734359 4466555.040155504 5347249.631556247 4466694.04237148 5347270.78422074 4466725.091562117 5347282.225629366 4466726.039213412 5347440.883902555 4466822.508238822 5347517.841952548 4466868.548545079 5347578.597651128 4466898.984428155 5347591.728859254 4466907.903978339 5347610.235879994 4466902.953337975 5347627.06164836 4466917.2011440275 5347638.046739489 4466916.509784963 5347683.942383274 4466941.291007064 5347698.428244001 4466937.574190251 5347753.213365185 4466973.030563937 5347786.900808951 4466984.224874722 5347800.973088797 4466992.11044181 5347802.955098614 4466992.608240043 5347819.688978554 4466997.175350225 5347822.213147196 4466988.157331856 5347858.614076436 4466812.970514817 5347860.550833809 4466803.619293391 5347872.490590535 4466749.585953828 5347889.88865781 4466683.156706623 5347905.425961993 4466627.462656352 5347908.893061612 4466616.339906532 5347928.680751377 4466631.874427315 5347955.866990617 4466658.336053361 5347992.440560844 4466667.38158958 5348020.637204707 4466692.571758896 5348055.467934002 4466712.407168781 5348067.273850354 4466719.13336889 5348078.587613841 4466735.887731458 5348114.746274789 4466735.580187805 5348161.430755257 4466757.59033275 5348187.318691565 4466783.47082676 5348208.162992913 4466777.610887891 5348223.914299169 4466773.523274895 5348251.745603668 4466784.5087312125 5348262.281042125 4466788.663410367 5348323.242389462 4466666.1548854355 5348334.760978904 4466672.039258338 5348368.177714755 4466691.949542091 5348377.25130236 4466697.147883953 5348387.9590716595 4466702.270018398 5348535.659377513 4466767.498892331 5348572.065420317 4466783.643227464 5348614.147251381 4466821.24513965 5348624.637007666 4466823.496652768 5348697.857248323 4466839.459280827 5348735.541918877 4466856.174023208 5348747.845278642 4466861.438624319 5348765.190745827 4466868.791772915 5348765.492287504 4466879.251257224 5348766.514830422 4466915.547934651 5348725.599964786 4466915.669373085 5348712.868013501 4466945.423805344 5348636.160942393 4467050.3738961555 5348568.541794871 4467148.383933926 5348554.205143562 4467171.831004191 5348530.56708185 4467210.495829023 5348503.536888991 4467207.177281866 5348487.293340439 4467205.171150775 5348394.298298666 4467230.426281719 5348290.298278759 4467224.888878679 5348277.554520488 4467292.060287846 5348234.857041927 4467399.460883237 5348211.50498855 4467452.057081067 5348203.759595306 4467468.686658371 5348156.626452953 4467455.08520913 5348044.046034682 4467420.221213428 5348018.515696597 4467412.327983868 5348010.527186732 4467419.050810936 5347961.436799068 4467561.477272315 5347952.641715452 4467584.990878961 5347930.612648766 4467652.639755385 5347883.529851442 4467797.216052307 5347882.276208229 4467802.661054904 5347876.962221606 4467825.7002864415 5347860.803179001 4467894.739425621 5347854.071758865 4467891.834319332 5347823.486715331 4467887.2961060675 5347795.102792345 4467885.585956754 5347746.740384888 4467883.975373046 5347723.639575413 4467883.052208106 5347688.2958647935 4467884.022132262 5347667.586888974 4467888.21615454 5347665.592510292 4467889.058855446 5347617.7904746495 4467922.005435567 5347609.602612977 4467929.2208303595 5347601.394377238 4467936.445435964 5347593.984003685 4467944.251636094 5347572.72435719 4467963.555184392 5347503.616735068 4468001.6231791 5347495.954162161 4468008.969191641 5347488.301581898 4468016.31559482 5347493.715164066 4468028.355867842 5347499.406013982 4468040.727213627 5347503.354426457 4468050.568642738 5347511.293809313 4468067.371061373 5347517.434750165 4468080.260366423 5347564.215692523 4468163.788835779 5347585.260688076 4468217.039801176 5347602.443761988 4468262.844457578 5347644.807308864 4468383.337199626 5347641.957030233 4468389.690470528 5347641.85558518 4468393.309140556 5347650.633259819 4468431.159598281 5347655.084516445 4468448.616194795 5347665.069940078 4468470.932529183 5347667.407117783 4468476.167643657 5347674.447454148 4468491.904134334 5347673.3136088345 4468491.46952193 5347650.688283584 4468504.495081716 5347490.696756297 4468581.420627346 5347471.629491796 4468588.931195172 5347455.135127437 4468595.391515093 5347432.177648163 4468604.371177394 5347410.696169664 4468611.176924339 5347291.686345459 4468665.787381876 5347285.852649547 4468670.893193357 5347252.3042338295 4468701.714989712 5347243.223986064 4468707.184238067 5347189.309618307 4468732.916748311 5347161.962506539 4468746.158047309 5347071.744152485 4468796.149979295 5347046.1920001935 4468810.322083399 5347037.560925588 4468813.517235408 5346996.801643872 4468822.9818800315 5346887.564169446 4468899.48012504 5346884.876151406 4468902.707460798 5346883.205589533 4468906.274788013 5346882.459040511 4468910.268519051 5346882.770469747 4468914.333629781 5346884.111627306 4468918.168798366 5346886.391186581 4468921.550295242 5346940.309952003 4468968.6606718525 5346886.807713179 4468978.477800181 5346862.567606956 4468984.175029043 5346852.930832648 4468988.521733924 5346839.915741482 4468998.650658469 5346808.782438672 4469036.301756146 5346793.979524901 4469050.693928904 5346753.218384806 4469084.015801364 5346738.595279928 4469094.832411256 5346715.102594713 4469104.962057228 5346690.005764493 4469113.888173333 5346633.004377365 4469123.1082474105 5346559.016187682 4469134.23618621 5346463.680346567 4469143.629035979 5346450.99942657 4469146.745960184 5346438.094812063 4469148.673287319 5346442.437105332 4469160.471431762 5346445.108043478 4469167.92114715 5346457.740708178 4469203.160064755 5346468.615498964 4469237.799879382 5346485.202818611 4469361.827379204 5346492.69110699 4469393.242557934 5346498.413452021 4469425.289207287 5346521.470461217 4469534.338502898 5346527.11756391 4469557.045457602 5346635.227897818 4469609.9765989 5346766.8070878815 4469810.3106817035 5346802.292899346 4469860.222776135 5346824.729525628 4469891.441677707 5346823.683677281 4469895.924046914 5346820.9696730925 4469907.496350677 5346818.152852138 4469919.394871917 5346832.044705179 4469943.154616028 5346850.662392259 4469989.635295451 5346866.328630259 4470022.530911502 5346886.639114336 4470056.939031279 5346892.0932795955 4470063.076499714 5346909.846401322 4470083.03433799 5346934.661624233 4470103.068104393 5346958.808669219 4470119.202971289 5347007.7391842315 4470141.080112563 5347019.038120832 4470148.226629444 5347026.098898525 4470153.456209121 5347040.386018527 4470164.0319203045 5347049.697869405 4470156.220077018 5347078.230082273 4470131.857190265 5347090.25366685 4470120.979079151 5347154.641972331 4470102.751321046 5347232.224859866 4470079.78563361 5347317.6815189915 4470048.421537758 5347341.7761652935 4470039.786617892 5347334.262879279 4469989.817189796 5347388.433590712 4469970.829787957 5347443.8711089995 4469951.691781025 5347459.843511277 4469942.709311628 5347478.808456147 4469932.693008876 5347507.93038406 4469917.309650103 5347566.5978563195 4469894.905507634 5347590.724793891 4469885.701462987 5347727.400507751 4469820.754346749 5347720.6747293295 4469805.420543197 5347958.133339842 4469684.670780286 5347963.768432449 4469681.828891852 5347977.835624936 4469674.993563003 5347988.175388632 4469702.57741346 5348014.3994529825 4469761.314299038 5348030.013849204 4469791.436046128 5348035.485158259 4469801.997415334 5348084.4851521235 4469790.103279996 5348149.206729144 4469781.785982273 5348175.2407887345 4469774.22770338 5348253.248783528 4469763.6879490735 5348261.81096128 4469769.676797067 5348267.841425881 4469773.615251314 5348287.756831552 4469787.153122028 5348290.783097571 4469794.726817356 5348293.582555857 4469801.19085155 5348296.411989736 4469807.656057602 5348300.4492397 4469817.270722592 5348304.005574236 4469824.084580284 5348305.811177775 4469827.557628653 5348310.76968518 4469835.8773552645 5348313.820325554 4469840.780078261 5348352.982000766 4469852.208413207 5348411.239601382 4469857.438407784 5348433.707270631 4469859.447711603 5348445.38868657 4469862.186100753 5348484.47230264 4469891.734457523 5348495.546358719 4469909.750114718 5348521.414009974 4469932.297055208 5348638.840503741 4470017.726710184 5348650.860601689 4470026.902974343 5348675.882619554 4470056.231759369 5348678.139130293 4470058.921863275 5348727.090015469 4470094.350021439 5348775.956280278 4470121.448894799 5348800.828816999 4470132.078406279 5348811.789974066 4470139.67216196 5348852.737393796 4470156.61433046 5348884.277543727 4470168.195069007 5348906.814201865 4470181.235051142 5348937.470584131 4470208.762719745 5349005.362231738 4470261.663587104 5349009.53143007 4470263.808039793 5349055.290732791 4470287.443076518 5349103.562521499 4470314.899042686 5349147.943986142 4470342.803321235 5349214.162180211 4470390.385027237 5349238.737091823 4470411.9508016035 5349268.960098503 4470433.157029029 5349278.453021936 4470439.142275358 5349254.88329165 4470468.132032009 5349239.285190769 4470489.0374964 5349198.4529367825 4470548.484515163 5349129.261299953 4470648.342280191 5349085.309157299 4470716.943904832 5349066.196311006 4470743.025713824 5349042.1298197815 4470782.673655999 5349013.083230258 4470813.020341267 5348984.903185286 4470855.49955836 5348971.022801622 4470876.75236564 5348919.281667802 4470955.937136924 5348845.971503916 4471038.031155071 5348837.786750231 4471047.728258354 5348831.26845465 4471055.499103212 5348803.032244867 4471089.179814868 5348782.406625668 4471113.771420842 5348767.316916018 4471130.123461615 5348675.6200312 4471262.474821378 5348660.886803097 4471264.080280217 5348646.163957843 4471265.676139067 5348595.7553620115 4471338.428303067 5348577.0276019 4471367.717394538 5348572.4555432685 4471371.781641362 5348569.969506493 4471390.317696119 5348567.501442066 4471408.394124177 5348505.344172135 4471478.085013288 5348487.478924027 4471497.600841373 5348468.965129017 4471501.200011551 5348447.537517205 4471505.355728154 5348203.23732014 4471528.556888567 5348174.835900115 4471529.868137095 5348166.992035436 4471530.592181652 5348084.2066585 4471536.902153544 5348086.349739476 4471481.06619489 5348069.134953141 4471463.471088953 5348060.927266669 4471459.167348489 5348043.465483797 4471450.448905686 5348040.029912449 4471450.784914893 5348034.635654992 4471450.283801927 5347984.750174423 4471440.557839701 5347868.647312966 4471424.440245213 5347805.099478807 4471411.1980483215 5347731.628214828 4471396.327017189 5347709.900769337 4471391.514728856 5347692.767123874 4471387.712635142 5347622.384800142 4471375.484207884 5347563.551475486 4471368.610812302 5347528.83408504 4471365.352160722 5347473.914743581 4471356.400225806 5347487.094352287 4471245.816413033 5347512.1298258025 4471060.812661917 5347522.592059214 4470995.674936908 5347526.309904305 4470962.266346668 5347532.457884793 4470864.907031451 5347534.190108886 4470802.169891589 5347530.146030338 4470724.386308282 5347529.911579224 4470713.489358292 5347529.685002079 4470702.902937308 5347524.323458279 4470694.397393561 5347489.805667978 4470701.644056321 5347399.479757869 4470721.8997734785 5347391.950092731 4470733.784109114 5347389.537813967 4470734.310245331 5347327.248157254 4470737.769275001 5347264.189553524 4470638.28468273 5347252.058114071 4470619.157073976 5347264.353187932 4470580.599806177 5347269.415364977 4470564.766234281 5347317.220260424 4470487.188248937 5347317.731995101 4470461.299699578 5347202.90062381 4470485.851289025 5347173.370126489 4470429.006951543 5347121.283998858 4470273.850980199 5347115.9498602785 4470259.01195863 5347096.216018523 4470203.711382505 5347094.786284362 4470199.5825673025 5347072.793464549 4470206.418326167 5346805.327683398 4470289.459583952 5346603.069784205 4470352.25382766 5346549.33960565 4470368.936965168 5346372.913529792 4470423.714727773 5346224.152719391 4470469.907101883 5346120.113715577 4470500.745409257 5346039.800443043 4470522.143723323 5345936.358696674 4470545.6401992 5345925.274045455 4470547.348468965 5345734.047227691 4470584.986416825 5345722.7728604525 4470584.635816329 5345692.99400616 4470585.85359943 5345507.882985564 4470582.4913310595 5345397.076916808 4470577.289959647 5345274.169379615 4470561.9187607225 5345199.759321444 4470549.80402116 5345189.229225316 4470547.821354133 5345174.610882826 4470545.718937333 5345125.865708801 4470537.789552836 5345010.19927411 4470515.096091953 5344950.593495996 4470503.910279272 5344799.453837025 4470475.527537715 5344640.872331448 4470448.335154928 5344555.273282816 4470431.890631031 5344438.2380618695 4470409.394216382 5344313.643310343 4470387.002752509 5344122.650227368 4470351.0588909425 5344106.795685684 4470348.067651037 5344039.354610111 4470335.335067914 5343773.045207194 4470286.901671752 5343746.781445731 4470282.162765152 5343668.974667738 4470268.104622592 5343653.918525404 4470265.424819028 5343653.372728168 4470271.197640217 5343653.19394321 4470273.21210136 5343650.833009814 4470390.233645271 5343643.505815792 4470639.47562993 5343650.218524148 4470650.285452147 5343639.1550938245 4470682.696597425 5343601.971655461 4470698.49600075 5343593.794302624 4470699.0471008 5343442.277891343 4470709.248330205 5343435.149224439 4470709.340055673 5343428.78695478 4470710.5625120895 5343427.886831652 4470710.036991806 5343391.656146941 4470711.953731782 5343263.64939683 4470716.959335069 5343248.2187805185 4470718.998313752 5343155.84531073 4470731.230418952 5343153.412384772 4470720.24759626 5343143.3164975215 4470626.216331233 5343120.5442130435 4470624.065687656 5342852.719277829 4470601.623073096 5342813.26427677 4470598.980792472 5342164.135904005 4470529.949600425 5342074.665888883 4470531.387906481 5341983.814262879 4470532.842333476 5341961.329885029 4470515.89251036 5341949.629586237 4470492.118794179 5341792.350919125 4470516.106305433 5341780.936661987 4470404.571095088 5341794.129527265 4470322.507450122 5341802.468384527 4470226.62440205 5341802.325535483 4470223.876860335 5341797.826924084 4470052.378489738 5341797.776277572 4470041.378633261 5341797.741864495 4470032.78113087 5341798.445960151 4469993.750650321 5341799.780581596 4469940.884856546 5341802.303914222 4469844.524250596 5341803.740733 4469782.125560795 5341805.535148161 4469668.303874074 5341807.976514657 4469574.041433081 5341808.2961183125 4469561.504896019 5341809.905299729 4469498.792612267 5341810.000931009 4469495.063662964 5341821.587221666 4469496.396902392 5341821.49451237 4469476.739141786 5341821.469540831 4469470.974019222 5341821.441212862 4469465.038642957 5341821.362006451 4469446.572263416 5341830.3794327555 4469446.804433455 5341847.722185489 4469447.822156293 5342156.9900515415 4469445.893602673 5342322.316796385 4469443.646029504 5342543.408179307 4469443.076843854 5342646.037593434 4469442.423030962 5342765.032768008 4469437.825370508 5342876.502048418 4469434.264710533 5342981.92225498 4469426.2147159055 5342996.202962453 4469424.410967094 5343013.52036973 4469422.235511465 5343025.748367142 4469409.193527845 5343031.513238791 4469402.003423197 5343035.415049505 4469398.44319479 5343081.937716877 4469357.740233437 5343125.595423237 4469319.417132408 5343190.653443398 4469263.296735132 5343247.20722141 4469218.142216462 5343287.633772577 4469187.218303759 5343293.0805292 4469183.047956155 5343293.520102544 4469182.554762849 5343295.948480028 4469180.848344445 5343296.579303814 4469180.582782549 5343364.467688235 4469136.801813569 5343423.4113459205 4469099.636392335 5343439.129762859 4469089.722950612 5343440.760333672 4469089.226256767 5343442.577251381 4469087.545983972 5343443.685275106 4469086.848742696 5343450.241928227 4469082.701749281 5343456.757052091 4469078.59316223 5343476.384703765 4469066.210573344 5343478.26383027 4469065.243244572 5343473.147730602 4469025.094482247 5343456.0663561905 4468896.754768349 5343416.882995328 4468610.797836735 5343412.239417873 4468597.997253633 5343406.365560993 4468570.838225023 5343404.2727132905 4468554.224465585 5343395.675542457 4468481.766242706 5343368.385445145 4468212.845432446 5343365.0864489395 4468171.266396323 5343357.266838327 4468072.759430784 5343357.719958147 4468051.941971836 5343359.083609486 4468030.359504117 5343354.298234551 4467962.0229073865 5343349.496140753 4467886.430345278 5343339.033878657 4467734.411017943 5343329.645504656 4467457.3221030645 5343328.306431989 4467388.119216378 5343325.965619786 4467153.996426601 5343321.412006752 4466937.319748181 5343320.345172539 4466905.714898195 5343317.020585544 4466900.39118827 5343315.003474303 4466895.6689675795 5343311.42773848 4466789.711543646 5343306.946004996 4466596.294357805 5343310.890781882 4466579.085710834 5343326.044913227 4466493.974722256 5343333.063161893 4466464.697174887 5343335.442844478 4466456.554087176 5343338.481860281 4466447.416008529 5343344.344677712 4466428.500976706 5343357.284501298 4466400.575611577 5343368.227235651 4466380.47803926 5343386.873666163 4466352.235237869 5343401.303242959 4466334.845795638 5343416.893543754 4466317.972051431 5343447.445526951 4466290.3245169865 5343488.010120225 4466261.006679511 5343528.3538556835 4466242.207983324 5343535.942519806 4466239.312137905 5343547.186523296 4466235.068016939 5343572.792551207 4466241.032180604 5343586.2399774445 4466244.169538874 5343585.457088363 4466220.921818216 5343605.202181398 4466212.4565034965 5343630.039286183 4466203.779849017 5343647.929636913 4466198.47445274 5343617.227354973 4466187.707752697 5343602.511487144 4466182.969684542 5343520.043188454 4466159.852724714 5343521.019106544 4466147.6818430405 5343523.627081963 4466121.91464285 5343528.68044053 4466069.162984115 5343530.363656706 4466052.976745463 5343532.233199192 4466053.27996358 5343580.45264008 4466067.012787442 5343582.29269017 4466058.338221976 5343591.4450933095 4466014.6532897595 5343662.85034944 4465772.301985284 5343668.890566284 4465761.910127849 5343672.418315757 4465757.424545547 5343672.764613804 4465756.757572695 5343677.863135 4465733.329292097 5343685.686986842 4465712.8896315815 5343696.35270309 4465682.723722509 5343706.119600571 4465630.996735357 5343716.087063991 4465549.805715708 5343723.478946909 4465506.101911866 5343732.878626322 4465491.1778470175 5343743.799966704 4465493.656106645 5343752.168791935 4465494.613576074 5343787.5391331585 4465501.679850661 5343827.157996537 4465503.998494155 5343826.669527244 4465492.681024715 5343822.711448441 4465399.58738308 5343830.826424515 4465292.814924687 5343848.804604489 4465281.678611006 5343855.531195931 4465277.027796329 5343863.996052087 4465271.173958787 5343889.877687238 4465245.245245243 5343902.884859259 4465232.503644719 5343913.645060059 4465224.507838255 5343933.313899045 4465212.1066001095 5343935.630770989 4465211.206394635 5343955.008764312 4465203.687432025 5344052.378672189 4465173.7871067505 5344096.046787865 4465158.020463095 5344150.672435265 4465137.147885725 5344207.657920475 4465114.27597841 5344253.153624715 4465092.71641544 5344283.567197229 4465077.582723287 5344306.554159743 4465067.342685962 5344320.633782967 4465062.49885673 5344351.441085814 4465055.216392893 5344393.540421698 4465048.865560034 5344410.691237122 4465044.562063696 5344462.5339222755 4465027.043389598 5344557.533841755 4464986.602894307 5344594.052339698 4464979.143351307 5344616.440850252 4464976.535663268 5344636.154066678 4464971.4516639365 5344648.20000474 4464965.127338705 5344664.810216561 4464957.500276089 5344696.393722674 4464946.745586404 5344733.719923299 4464937.055946989 5344763.5400280105 4464922.769773851 5344817.109643326 4464905.108514032 5344888.776569173 4464882.740470698 5344908.298182917 4464876.157896949 5344916.456459856 4464874.565297309 5344919.457885919 4464869.208510701 5344923.862606216 4464858.672661091 5344932.457318814 4464836.181516017 5344933.660264509 4464833.056160702 5344955.1869381005 4464805.896536328 5344999.0295511065 4464750.587364623 5345046.272277578 4464690.98776032 5345077.230496504 4464590.221444643 5345151.476855026 4464462.165147771 5345170.623138745 4464429.338288444 5345181.982414242 4464409.857313766 5345200.145818825 4464376.0613383055 5345222.379959422 4464334.898813546 5345231.647076136 4464317.737864925 5345301.427941892 4464191.278231656 5345309.211094425 4464176.7512944415 5345332.238854896 4464133.207942224 5345361.805552918 4464077.270648209 5345420.916283849 4463965.465186148 5345429.042487054 4463946.258117058 5345434.89081255 4463932.586245079 5345455.089959244 4463885.369619027 5345460.484960757 4463872.030289063 5345469.70727461 4463849.103222439 5345487.485067347 4463803.923546252 5345489.456839651 4463799.307080154 5345510.882787113 4463752.708799946 5345525.467964966 4463716.24097337 5345531.652587087 4463680.905918796 5345552.914567719 4463603.167763272 5345571.757630661 4463556.338391794 5345603.053142226 4463467.693816155 5345632.206048547 4463396.999060327 5345642.495552932 4463348.304180655 5345650.144905718 4463288.808027216 5345685.109277709 4463154.43207181 5345694.521642877 4463099.7583539 5345705.709810832 4463053.420275076 5345704.976710382 4462998.690258376 5345701.428363586 4462972.46184032 5345700.082975538 4462962.331633418 5345699.541682536 4462958.257411212 5345728.235104451 4462961.030116972 5345755.123823446 4462963.632215933 5345774.714575801 4462965.528763846 5345809.14107489 4462968.845798769 5345825.637887996 4462970.271161749 5345847.66949584 4462972.193064654 5345883.006235773 4462975.265478154 5345908.668793381 4462977.489425374 5345920.806387802 4462978.554272379 5345938.061052555 4462980.049296631 5346129.6147512095 4462999.795610987 5346285.399002499 4463031.123812253 5346332.401629859 4463042.2080153655 5346344.023167079 4463044.9540058775</gml:posList>
                                </gml:LinearRing>
                            </gml:exterior>
                        </gml:Polygon>
                    </gml:surfaceMember>
                </gml:MultiSurface>
            </bvv:the_geom>
        </bvv:gmd_ex>
    </wfs:member>
</wfs:FeatureCollection>

 

Über  Stored Queries sind viele unterschiedliche Anwendungsfälle denkbar. Der folgende Aufruf könnte beispielsweise zur Abfrage von einzelnen Flurstücken eingesetzt werden.

http://localhost:8180/geoserver/wfs?service=WFS&request=GetFeature&version=2.0.0&StoredQuery_ID=FlstQuery&gemarkung=9999&zaehler=1&nenner=0

 

Quellen/Links
[OGC-WFS] Web Feature Service 2.0
http://www.opengeospatial.org/standards/wfs

Grundlagen Web Feature Service 2.0
http://www.weichand.de/2011/11/30/grundlagen-web-feature-service-wfs-2-0/

WFS 2.0 – Abfragen (Queries)
http://www.weichand.de/2011/11/30/wfs-2-0-abfragen-queries/

WFS 2.0 – INSPIRE WFS 2.0 DemoServer
http://www.weichand.de/2012/10/17/inspire-wfs-2-0-demoserver-mit-beispielanfragen-geoserver-2-2/

WFS 2.0 Client – Plugin für QGIS
http://www.weichand.de/2012/05/29/wfs-2-0-client-plugin-fur-qgis/

 

 

9 Gedanken zu “WFS 2.0 – Stored Queries Beispiele

  1. Sehr schön!
    Das scheint ja Spaßpotential zu haben, insb. weil es bei “Standardabfragen” eine signifikante Erleichterung für die Anwender bietet.

  2. In folgendem Mailinglist-Eintrag wird die Handhabung der Koordinatenreferenzsysteme erläutert, insbesondere die unterschiedliche Achsenreihenfolge zwischen „EPSG:31468“ und „urn:x-ogc:def:crs:EPSG:31468“:
    http://sourceforge.net/mailarchive/forum.php?thread_name=4F96760B.7080807%40csiro.au&forum_name=geoserver-devel

    Weitere Informationen können folgendem GeoServer-Artikel entnommen werden:
    http://docs.geoserver.org/latest/en/user/services/wfs/basics.html#axis-ordering

  3. Hallo,

    das ist ja ein sehr schöner Beitrag. Ich bin nur noch nicht dahinter gekommen, wie ein storedQuery im Geoserver angelegt wird. Ich bin diesen http://geoserver.org/display/GEOS/GSIP+61+-+WFS+2.0 Ausführungen gefolgt, aber ohne Erfolg.
    Nachdem ich ein bboxQuery in data_dir/wfs/bboxQuery.xml angelegt hatte wurde dieser Query aber nicht nach Aufruf der Methode ListStoredQueries angezeigt. Wie sieht da die genaue Konfiguration aus um StoredQueries dann auch zu benutzen? Ich verwende jetzt übrigens den Geoserver 2.2.

    Gruß,
    Matthias

  4. Hallo,

    ist folgende Situation bekannt?
    1. StoredQuery wurde erzeugt und befindet sich in wfs/stored_queries
    2. StoredQuery wird nach Aufruf des Requests ListSoredQueries mit aufgelistet
    3. Die Definition des selbigen lässt sich mittels
    DescribeStoredQueries abfragen
    4. Nach der GetFeature-Abfrage mit dem StoredQuery tritt
    folgende Exception auf

    java.lang.NullPointerException null

    Ich kann mir das nicht erklären. Hab schon alles mögliche probiert, bin aber dem Fehler immer noch nicht auf die Schliche gekommen.

    Gruß,
    Matthias

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>