Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LIKE,
- matchCase:false,
- property: "nome",
- value: "searchText"});
- var strategy = new OpenLayers.Strategy.Fixed();
- var wfsprotocol = new OpenLayers.Protocol.WFS.v1_1_0({
- url: host,
- featureType: "pontos_interesse",
- featureNS: "domain",
- srsName: "EPSG:900913",
- version: "1.1.0",
- extractAttributes: true,
- isBaseLayer: false,
- visibility: true});
- //selectedLayer = new OpenLayers.Layer.Vector("Selected Layer", {
- //displayOutsideMaxExtent: true,
- //displayInLayerSwitcher: false});
- wfsprotocol.read ({
- filter:filter,
- callback: processTheQuery,
- scope: strategy});
- function processTheQuery(request) {
- // the first bit sets the value of sExt to be the a boundingbox on the
- //features returned.
- // Depending on application logic, this could happen in other places in
- //the code.
- if (request.data && request.data.bbox) {
- var b = request.data.bbox;
- var sExt = new OpenLayers.Bounds(b[0],b[1],b[2],b[3]);
- }else {
- var fts = request.features;
- if (fts.length>0) {
- sExt = fts[0].geometry.getBounds().clone();
- for(var i=1;i<fts.length;i++) {
- sExt.extend(fts[i].geometry.getBounds());
- }
- }
- };
- map.zoomToExtent(sExt);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement