Skip to main content
corrected spelling removed thanks, added tag
Source Link
nmtoken
  • 13.6k
  • 5
  • 38
  • 89

GetFeature Requestrequest with Polygon Intersecting Polygonspolygon intersecting polygons

My task is very straightforward: a user draws a polygon and queryqueries 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. THANK YOU IN ADVANCE.

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 = '<?xml version=' 
    + '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' 
    + '<wfs:Query typeName="topp:tax_parcel"><Filter><Intersects><PropertyName>geom</PropertyName>'
    + plgGMLString 
    + '</Intersects></Filter></wfs:Query></wfs:GetFeature>'; 
            
$.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.

<gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">-74.00567761405651,40.546826958183715 ...</gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon>

GetFeature Request with Polygon Intersecting Polygons

My task is very straightforward: a user draws a polygon and query 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. THANK YOU IN ADVANCE.

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 = '<?xml version=' 
    + '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' 
    + '<wfs:Query typeName="topp:tax_parcel"><Filter><Intersects><PropertyName>geom</PropertyName>'
    + plgGMLString 
    + '</Intersects></Filter></wfs:Query></wfs:GetFeature>'; 
            
$.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.

<gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">-74.00567761405651,40.546826958183715 ...</gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon>

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 = '<?xml version=' 
    + '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' 
    + '<wfs:Query typeName="topp:tax_parcel"><Filter><Intersects><PropertyName>geom</PropertyName>'
    + plgGMLString 
    + '</Intersects></Filter></wfs:Query></wfs:GetFeature>'; 
            
$.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.

<gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">-74.00567761405651,40.546826958183715 ...</gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon>

edited tags
Link
Sam007
  • 4.4k
  • 7
  • 51
  • 70
added 32 characters in body
Source Link
freddell
  • 287
  • 1
  • 4
  • 13

My task is very straightforward: a user draws a polygon and query 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. Is itI can't figure out what's wrong? THANK. Please Help. THANK YOU IN ADVANCE.

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 = '<?xml version=' 
    + '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' 
    + '<wfs:Query typeName="topp:tax_parcel"><Filter><Intersects><PropertyName>geom</PropertyName>'
    + plgGMLString 
    + '</Intersects></Filter></wfs:Query></wfs:GetFeature>'; 
            
$.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.

<gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">-74.00567761405651,40.546826958183715 ...</gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon>

My task is very straightforward: a user draws a polygon and query 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. Is it wrong? THANK YOU IN ADVANCE.

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 = '<?xml version=' 
    + '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' 
    + '<wfs:Query typeName="topp:tax_parcel"><Filter><Intersects><PropertyName>geom</PropertyName>'
    + plgGMLString 
    + '</Intersects></Filter></wfs:Query></wfs:GetFeature>'; 
            
$.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.

<gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">-74.00567761405651,40.546826958183715 ...</gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon>

My task is very straightforward: a user draws a polygon and query 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. THANK YOU IN ADVANCE.

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 = '<?xml version=' 
    + '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' 
    + '<wfs:Query typeName="topp:tax_parcel"><Filter><Intersects><PropertyName>geom</PropertyName>'
    + plgGMLString 
    + '</Intersects></Filter></wfs:Query></wfs:GetFeature>'; 
            
$.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.

<gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">-74.00567761405651,40.546826958183715 ...</gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon>

added 36 characters in body
Source Link
freddell
  • 287
  • 1
  • 4
  • 13
Loading
Source Link
freddell
  • 287
  • 1
  • 4
  • 13
Loading