2

I am making a WPS call in OpenLayers which works successfully in Chrome and Firefox but not in IE9. The response from IE tells me

Process failed during execution\nCould not convert to target type com.vividsolutions.jts.geom.Geometry

The same code returns intersecting polygons in both other browsers so I think it's down to how IE handles my GML/XML. Can anyone help out?

Code as follows:

function wpsExecute(featureA, featureB, identifier) {

    var polygonElement;
    if (BrowserInfo.browser == "Chrome") {
        polygonElement = "Polygon"
    } else {
        polygonElement = "gml:Polygon"
    }

    // set up the process specific parameters
    var options = {
        // set the wps process
        identifier : identifier,
        dataInputs : [ {
            identifier : "a",
            data : {
                complexData : {
                    attributes : {
                        mimeType : "text/xml",
                        subtype : "gml/3.1.1"
                    },
                    // get the gml:Polygon node from the xml DOM
                    value : featureA.getElementsByTagName(polygonElement)[0]
                }
            }
        }, {
            identifier : "b",
            data : {
                complexData : {
                    attributes : {
                        mimeType : "text/xml",
                        subtype : "gml/3.1.1"
                    },
                    // get the gml:Polygon node from the xml DOM
                    value : featureB.getElementsByTagName(polygonElement)[0]
                }
            }
        } ],
        responseForm : {}
    };

    var format = new OpenLayers.Format.WPSExecute();
    // console.log(format.write(options));

    try {

        OpenLayers.Request.POST({
            url : WPS_URL,
            data : format.write(options),
            async : false,
            success : parseExecute,
        });

WHERE featureA and featureB are as follows:

var gmlOptions = {
    featureType : "feature",
    featureNS : "http://example.com/feature"
};

// new gml 3 format
var gml3 = new OpenLayers.Format.GML.v3(gmlOptions);


compareFeatureGml = gml3.write(compareFeature);

var xmlFormat = new OpenLayers.Format.XML();
var featureB = xmlFormat.read(compareFeatureGml);
2

The problem was with Format.XML. I had to redeclare a new XML format everytime I made a wps call.

var xmlFormat = new OpenLayers.Format.XML();
//read gml feature as xml
var xmlfeature = xmlFormat.read(gmlFeature);

Also, ie cannot use XMLSerializer...

    // this fails in IE
    var xmlSerializer = new XMLSerializer();
    var featureString = xmlSerializer.serializeToString(gmlFeature);

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.