2

Is it possible to catch Raise Warning, Raise Notice and Raise Exception in OpenLayers while using a WFS-T-Layer (stored in a PostGIS-Database) to save edits? Example: A trigger is used to check values or check Intersections/Overlaps and gives back warnings or exceptions that are displayed in alerts/popups to give some feedback to the user.

1

Actually I'm not sure if the SaveStrategy of OpenLayers can catch these notices.

In the OGC specification is written:

Individual exception messages are contained within the <ExceptionText> element. The mandatory code attribute may be used to associate an exception code with the accompanying message. The optional locator attribute may be used to indicate where an exception was encountered in the request that generated the error.

If you wrote sucessfully to your wfs-t-service you normally get back something like this:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:TransactionResponse version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://web-mapping.com:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd"
    xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:gml="http://www.opengis.net/gml"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tests="http://tests.de"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:ows="http://www.opengis.net/ows"
    xmlns:wfs="http://www.opengis.net/wfs">
    <wfs:TransactionSummary>
        <wfs:totalInserted>1</wfs:totalInserted>
        <wfs:totalUpdated>0</wfs:totalUpdated>
        <wfs:totalDeleted>0</wfs:totalDeleted>
    </wfs:TransactionSummary>
    <wfs:TransactionResults/>
    <wfs:InsertResults>
        <wfs:Feature>
            <ogc:FeatureId fid="shape_flurstuecke.457"/>
        </wfs:Feature>
    </wfs:InsertResults>
</wfs:TransactionResponse>

I am not 100% sure (as i haven't tested it yet) but I guess that a raise notice message would not even be included in this wfs response. In this case OpenLayers would have no chance to catch this message.

One option aside the OGC-standards would be PHP: Have a look at http://php.net/manual/de/function.pg-last-notice.php

The nicest solution would be to have a websocket connection and to "push" notices, warnings and exceptions through the websocket connection from the server to the client ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.