Hello,

I've been in need for a function to get a layer by name instead of by id, i've added the following method to map.js. Maybe this could be interesting to have it in the API.

   /**
    * @param {String} name
    *
    * @returns The Layer with the corresponding name from the map's
    *           layer collection, or null if not found.
    * @type OpenLayers.Layer
    */
   getLayerByName: function(name) {
       var foundLayer = null;
       for (var i = 0; i < this.layers.length; i++) {
           var layer = this.layers[i];
           if (layer.name == name) {
               foundLayer = layer;
           }
       }
       return foundLayer;
   },

Regards,

Tchule.

_________________________________________________________________
Now you can see troubleĀ…before he arrives http://newlivehotmail.com/?ocid=TXT_TAGHM_migration_HM_viral_protection_0507

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to