[OpenLayers-Users] vector layer has ID problem!

Christopher Schmidt crschmidt at metacarta.com
Thu Oct 4 11:28:59 EDT 2007


On Thu, Oct 04, 2007 at 05:02:34AM -0700, Prasad Choudhary wrote:
> 
> hello all,
> 
> I was experimenting with OpenLayers.Layer.Vector . I just put id attribute
> for vector layer result me an error as this.container has no property.
> without id attribute its working fine, but I want to use it for
> map.getLayer("id") stuff, so need id.
> both pages for live are on 
> http://prasad.choudhary.googlepages.com/vectorLayer.html
> http://prasad.choudhary.googlepages.com/vectorLayer_with_id.html
> please correct me where I am going wrong.

This is probably the wrong way to go about it. Instead of setting the
layer id manually, after you create the layer, store the id:

var myLayer = new OpenLayers.Layer.Vector()
var myId = myLayer.id;

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list