title: OpenLayers - How to validate whether the BBOX strategy works successfully?
body: <p>I want to send requests to our feature server that asks only data within
  the viewable map extent. So I've used BBOX strategy and HTTP Protocol as
  following code.</p>
  
  <pre><code>    mVectorLayer = new OpenLayers.Layer.Vector("Overlay", {
          strategies: [new OpenLayers.Strategy.BBOX()],
          protocol: new OpenLayers.Protocol.HTTP({
              url: 'http://localhost:56786/jlist.geojson',
              format: new OpenLayers.Format.GeoJSON({
                  'read': myReadFunction,
                  'internalProjection': map.baseLayer.projection,
                  'externalProjection': new OpenLayers.Projection("EPSG:4326")
              })
          }),
          projection: new OpenLayers.Projection("EPSG:900913")
      });
  </code></pre>
  
  <p>I've added a feature outside the viewable map to the geojson file shown at below.</p>
  
  <pre><code>{ "type": "FeatureCollection",
    "features": [
        { "type": "Feature",
          "geometry": {"type": "Point", "coordinates": [29.0, 41.060]},
          "properties": {"name": "IST J1", "img": "img/marker.png"}
        },
        { "type": "Feature",
          "geometry": {"type": "Point", "coordinates": [29.0, 41.100]},
          "properties": {"name": "IST J2", "img": "img/marker.png"}
        },
        { "type": "Feature",
          "geometry": {"type": "Point", "coordinates": [59.0, 41.100]},
          "properties": {"name": "IST J3", "img": "img/marker.png"}
        }
    ]
  }
  </code></pre>
  
  <p>To validate, I've added an alert to the function myReadFunction which shows
  the json string. But the alert shows all features in geojson file. I
  suppose our feature server sends all geojson content instead of viewable
  features? How can I validate or observe whether the BBOX strategy works successfully?</p>
  
  <pre><code>        function myReadFunction(json, type, filter) {
              alert("json: " + json);
  
              type = (type) ? type : "FeatureCollection";
              var results = null;
              var obj = null;
              if (typeof json == "string") {
                  obj = OpenLayers.Format.JSON.prototype.read.apply(this, [json, filter]);
              } else {
                  obj = json;
              }
              if (!obj) {
                  OpenLayers.Console.error("Bad JSON: " + json);
              } else if (typeof (obj.type) != "string") {
                  OpenLayers.Console.error("Bad GeoJSON - no type: " + json);
              } else if (this.isValidType(obj, type)) {
                  switch (type) {
                      case "Geometry":
                          try {
                              results = this.parseGeometry(obj);
                          } catch (err) {
                              OpenLayers.Console.error(err);
                          }
                          break;
                      case "Feature":
                          try {
                              results = this.parseFeature(obj);
                              results.type = "Feature";
                          } catch (err) {
                              OpenLayers.Console.error(err);
                          }
                          break;
                      case "FeatureCollection":
                          // for type FeatureCollection, we allow input to be any type
                          results = [];
                          switch (obj.type) {
                              case "Feature":
                                  try {
                                      results.push(this.parseFeature(obj));
                                  } catch (err) {
                                      results = null;
                                      OpenLayers.Console.error(err);
                                  }
                                  break;
                              case "FeatureCollection":
                                  for (var i = 0, len = obj.features.length; i &lt; len; ++i) {
                                      try {results.push(this.parseFeature(obj.features[i]));
                                      } catch (err) {
                                          results = null;
                                          OpenLayers.Console.error(err);
                                      }
                                  }
                                  break;
                              default:
                                  try {
                                      var geom = this.parseGeometry(obj);
                                      results.push(new OpenLayers.Feature.Vector(geom));
                                  } catch (err) {
                                      results = null;
                                      OpenLayers.Console.error(err);
                                  }
                          }
                          break;
                  }
              }
              return results;
  }
  </code></pre>
  
  <p>Thanks a lot for your helps and explanations,
  Yasemin</p>