[OpenLayers-Users] Browser slow performance while
parsing OpenLayers.Vector.Feature features : SLDSELECT??
Phil Scadden
p.scadden at gns.cri.nz
Thu Apr 7 17:36:04 EDT 2011
So do you HAVE to use WFS? I had a similar problem,
Have a look at http://dev.openlayers.org/releases/OpenLayers-2.10/examples/
The idea is to have the server draw the selected polygons via WMS and
have WFS query return the attribute data.
My code was something like this:
polySelectControl[i] = new
OpenLayers.Control.SLDSelect(OpenLayers.Handler.Polygon,
{
displayClass: 'olControlSLDSelectPolygon',
layers:[layer[i]]
});
polySelectControl[i].events.register("selected", this,
function(e){
// next bit of code selects ONLY the fields to return which are read
from a JSON config file. This step reduces the amount of web traffic but
more importantly, ensures that geometry is not sent.
clearData();
var propNames = [];
var layerNode = getLayerNode(combo.value);
var SpatialQueryNode =layerNode.spatialQuery[0];
for (var i = 0; i <
SpatialQueryNode.fields.length; i++) {
propNames[i] = SpatialQueryNode.fields[i].id;
}
// Now set up the wfs to return the attribute data associated with propNames
wfsProtocol[combo.value].read({
filter: e.filters[0],
propertyNames: propNames,
callback: processSpatialQuery,
scope: strategy
});
});*/
mapPanel.map.addControl(polySelectControl[i]);
All very nice but you need to be aware that geoserver has an unresolved
problem with SLD filters. If the WFS layers has different projection to
your map projection, then this doesnt work. I understand mapserver
doesnt have this problem.
I've worked out an ugly workaround (reproject the polygon before sending
the SLD filter) but havent had time to hack the openlayers code to
implement it. I dont know what the status of in geoserver is but I am
guessing you will get no sense from geoserver developers on new issues
till 2.1 is finally out. In short term, I made life a lot easily by
generalising the line work but that might be tricky with cadastre.
--
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St,
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232
Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
More information about the Users
mailing list