title: How to simplify a GML vector layer depending on zoom in OpenLayers?
body: <p>I have a performance problem on Firefox with a pretty big (Canada wide) GML vector layer in OpenLayers. My website is in JavaScript/PHP. The layer is created like that:</p>
  
  <pre><code>map.addLayer(new OpenLayers.Layer.Vector(openlayers_gml_layer_canada_bv, {
      strategies: [   new OpenLayers.Strategy.Fixed()],
      protocol:       new OpenLayers.Protocol.HTTP({
          url: "./images/GML/BV - Canada.gml",
          format: gml_format
      }),
      styleMap: RegionsStyles,
      visibility: false
  }));
  </code></pre>
  
  <p>I checked everywhere and the solutions given where to add this line to select renders:</p>
  
  <pre><code>OpenLayers.Layer.Vector.prototype.renderers = ["SVG2", "VML", "Canvas"];
  </code></pre>
  
  <p>It help with drag and drop <em>when dragging</em> but when I let go, it loads for 3-5 seconds (so it lags a big shot after instead of lagging the whole time, but it's still lagging a lot).</p>
  
  <p>The other answers where saying to either simplify the vectors or process the tiles outside OpenLayers, with GeoServers.</p>
  
  <p>I would like to simplify my vectors if possible but I have no idea how to implement correctly the simplify method that OpenLayers has. Would you have an idea on how to simplify my layer?</p>
  
  <p>My code (map.addLayer...) is in a function where I add all my vector maps. The others are not lagging as they are much more simple. Is there an easy way? Do I have to loop in my features to simplify each of them? And if yes, how can I transform my features <em>before</em> actually loading them on the map (so it doesn't lag)?</p>
  
  <p>It would be perfect if I could simplify the map depending on the zoom level. So if it's far away (if I see all of Canada) I want the layer to be more simplified, and less if I zoom (as I will have less vectors on screen and at some point it stops lagging completely).</p>
  
  <p>Thanks a lot everyone. I hope my question is clear.</p>