Tuesday, 29 May 2018

mapserver - OL3 parser flips the coordinates


When requesting featureInfo from MapServer using getGetFeatureInfoUrl() of OL3 lib


var req_url = the_layer.getSource().getGetFeatureInfoUrl(
evt.coordinate,
map.getView().getResolution(),
map.getView().getProjection(), //4326
{

'INFO_FORMAT': 'application/vnd.ogc.gml',
}
);

it returns response in which the coordinates X and Y are in coorect order but after parsing the response theu are flipped:


$.ajax(req_url, {
async: false
})
.done(function(resp){
//console.log(resp);

WMSfeatures = parser.readFeatures(resp);
console.log(WMSfeatures);
});

Coordinates in response from mapserver:


[[223.745,250.638],[232.028,255.22],[229.376,264.126]] (in EPSG:4326)


Parsed response:


[[250.638,223.745],[255.22,232.028],[264.126,229.376]] (in EPSG:4326)


What is wrong here?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...