Hi

 

I have been attempting to use the Geoserver cross-layer filtering
plug-in with my OpenLayers application.  What I'm trying to do is get
all point features from layer A that fall within a specified (polygon)
feature in layer B.  i.e. I want to select all 'sales' points within a
defined postcode area.

 

Here is the relevant extract from my code:

 

Function postcode_sales()

{

 

var postData =   '<wfs:GetFeature\n'

                        + '  service="WFS"\n'

                        + '  version="1.1.0"\n'

                        + '  outputFormat="text/xml;
subtype=gml/3.1.1"\n'

                        + '  maxFeatures="500"\n'

                        + '  xmlns:wfs="http://www.opengis.net/wfs"\n'

                        + '  xmlns:ogc="http://www.opengis.net/ogc"\n'

                        + '
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n'

                        + '  xmlns:gml="http://www.opengis.net/gml"\n'

                        + '
xsi:schemaLocation="http://www.opengis.net/wfs\n'

                        + '
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd";>\n'

                        + '  <wfs:Query typeName="rs:sales"
srsName="urn:x-ogc:def:crs:EPSG:27700">\n'

                        + '    <ogc:Filter
xmlns:ogc="http://www.opengis.net/ogc";>\n'

                        + '
<ogc:Within>\n'

                        + '
<ogc:PropertyName>the_geom</ogc:PropertyName>\n'

                        + '
<ogc:Function name="querySingle">\n'

                        + '
<ogc:Literal>rs:PostcodeUnits</ogc:Literal>\n'

                        + '
<ogc:Literal>the_geom</ogc:Literal>\n'

                        + '
<ogc:Literal>pcu = '+"EH9 1HG"+'</ogc:Literal>\n' 

                        + '
</ogc:Function>\n'

                        + '
</ogc:Within>\n'

                        + '         </ogc:Filter>\n'

                        + '  </wfs:Query>\n'

                        + '</wfs:GetFeature>\n';

                                                              

            var request = new OpenLayers.Request.POST({

                        url: '/ros/geoserver/wfs',

                        data: postData,

                        headers: {

                                    "Content-Type": "text/xml"

                        },

            callback: function (response) 

                        {

                        // read the response from GeoServer

                        var format = new OpenLayers.Format.GML.v3({

                                    extractAttributes:true

                                    });

                        // Remove any previously selected features from
map

                        map.layers[18].destroyFeatures();

// Add features to vector layer

 
map.layers[18].addFeatures(format.read(response.responseText));

                                                                        

                                                            

                        },


                        failure: function (response) {

                                    alert("Invalid request");


                                    }

                        });

} 

 

 

Unfortunately this doesn't seem to be working.  I'm getting a '500
Internal Server Error' response from geoserver:

 

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at 
 ad...@example.com to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body></html>

 

 

Clearly I've misconfigured the query somehow, but I can't figure out
where.  I've tried the test scenario outlined at
http://docs.geoserver.org/stable/en/user/extensions/querylayer/index.htm
l using the preloaded Geoserver layers and it works perfectly, but I
can't seem to get it to work with my own data layers.  I had initially
thought it was because the third argument in the function (i.e.
'<ogc:Literal>pcu = '+"EH9 1HG"+'</ogc:Literal>') is handling a string
rather than a number, but the data in my attribute column 'pcu' is
string type so I don't think this is the problem.

 

Does anyone have any clues about what's going wrong here?

 

Thanks

Chris Muir 
 
P Please consider the environment - do you really need to print this email?

**********************************************************************
This e-mail (and any files or other attachments transmitted with it) is 
intended solely for the attention of the addressee(s). Unauthorised use, 
disclosure, storage, copying or distribution of any part of this e-mail is not 
permitted. If you are not the intended recipient please destroy the email, 
remove any copies from your system and inform the sender immediately by return. 

Registers of Scotland does not accept any liability or responsibility for any 
damage caused by any virus transmitted by this email or for changes made to 
this e-mail after it was sent. 

All communications to or from Registers of Scotland may be automatically 
logged, monitored and/or recorded in order to secure the effective operation of 
the system and for other lawful purposes. The views or opinions contained 
within this e-mail may not necessarily reflect those of the Keeper of the 
Registers of Scotland. 

**********************************************************************

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to