Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have:

function createWPSExecuteRequest(namespace, layerName, popFilter) {
    var request = OpenLayers.Format.XML.prototype.write(new OpenLayers.Format.WPSExecute().writeNode('wps:Execute', {
        identifier: 'gs:Aggregate',
        dataInputs: [{
            identifier: 'features',
            reference: {
                mimeType: 'text/xml',
                href: WFS_HOST,
                method: 'POST',
                body: {
                    wfs: {
                        featureType: layerName,
                        version: '1.1.0',
                        featureNS: namespace,
                        srsName: 'EPSG:4326',
                        defaultFilter: popFilter
                    }
                }
            }, 
            input: {
                identifier: 'aggregationAttribute',
                data: {
                    literalData: 'grid_code'
                }
            },
            input: {
                identifier: 'function',
                data: {
                    literalData: 'Sum'
                }
            },
            input: {
                identifier: 'singlePass',
                data: {
                    literalData: 'Yes'
                }
            }

        }],
        responseForm: {
            rawDataOutput: {
                identifier: 'result'
            }
        }
    }));

    return request;
}

but the generated GML is shown below:

<wps:Execute xmlns:wps="http://www.opengis.net/wps/1.0.0" version="1.0.0" service="WPS">
    <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">gs:Aggregate</ows:Identifier>
    <wps:DataInputs><wps:Input>
        <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">features</ows:Identifier>
        <wps:Reference mimeType="text/xml" xlink:href="/geoserver/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" method="POST">
            <wps:Body>
                <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0">
                    <wfs:Query typeName="p_layer" srsName="EPSG:4326" xmlns:undefined="http://pe.example.com/nig"/>
                </wfs:GetFeature>
            </wps:Body>
        </wps:Reference>
        </wps:Input>
    </wps:DataInputs>
    <wps:ResponseForm>
    <wps:RawDataOutput>
    <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">result</ows:Identifier>
    </wps:RawDataOutput>
    </wps:ResponseForm>
</wps:Execute>

Any idea what I may be doing wrong?

UPDATE: I figured part of this out. Its the braces. A revised version that generates everything except the filter is shown below:

function createWPSExecuteRequest(namespace, layerName, popFilter) {
    var request = OpenLayers.Format.XML.prototype.write(new OpenLayers.Format.WPSExecute().writeNode('wps:Execute', {
        identifier: 'gs:Aggregate',
        dataInputs: [{
            identifier: 'features',
            reference: {
                mimeType: 'text/xml',
                href: WFS_HOST,
                method: 'POST',
                body: {
                    wfs: {
                        featureType: layerName,
                        version: '1.0.0',
                        featureNS: namespace,
                        srsName: 'EPSG:4326',
                        defaultFilter: popFilter
                    }
                }
            }},
            { identifier: 'aggregationAttribute',
            data: {
                literalData: {
                    value: 'grid_code'
                } 
            }},
            {identifier: 'function',
            data: {
                literalData: {
                    value: 'Sum'
                }
            }},
            {identifier: 'singlePass',
            data: {
                literalData: {
                    value: 'Yes'
                }
            }}
        ],
        responseForm: {
            rawDataOutput: {
                identifier: 'result'
            }
        }
    }));

    return request;
}

The filter is not generated yet. Any idea will be appreciated.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.