Saturday, 28 May 2016

openlayers 2 - GetFeature request with polygon intersecting polygons


My task is very straightforward: a user draws a polygon and queries all parcel polygons. The query string extends the URL limit. So I am posting XML to WFS. However, GeoServer always returned 0 feature, but I knew the query polygon overlapped several tax parcels. If I passed a single point, it worked fine. Did I miss anything for sending a polygon? I used the OpenLayers buildGeometry to create the polygon GML. I can't figure out what's wrong.


Please Help.


Here is my code:


var gml = new OpenLayers.Format.GML(); 
var polygonGML = gml.buildGeometry.polygon.apply(gml,[taArray[0].geometry])
console.log(polygonGML);

var plgGMLString = (new XMLSerializer()).serializeToString(polygonGML);

var geo_req_url = proxyHost + "http://localhost:8080/geoserver/wfs";
var query_xml = ' + ''
+ 'geom'
+ plgGMLString
+ '
';

$.post(

geo_req_url,
query_xml,
function(data) {
geoResults = data.features;
remove_selected_features();
draw_sel_features();
},
"application/json"
);


Here is the printout of plgGMLString.


-74.00567761405651,40.546826958183715 ...




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...