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 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);

Thank you all!

share|improve this question
    
If you don't get an answer here, you may want to try stackoverflow.com as there are more coders there. –  GIS-Jonathan Apr 18 '12 at 9:48
add comment

1 Answer

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);
share|improve this answer
add comment

Your Answer

 
discard

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

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