[OpenLayers-Users] Having difficulty creating my own feature layer....

Erik Uzureau euzuro at gmail.com
Thu Jun 22 12:32:23 CDT 2006


Hi Nick,

Thanks for sending the link. So running through debugger real quickly showed me
what the problem was: Context!

The thing is that inside the OpenLayers.loadURL(), we take care to
bind the success()
and failure() functions passed in to "caller" (which in the case of
the WFS call is "this")

So what happens is that when the return call is made to your
"requestSuccess", the
current "this" is the document window, and not the Tile. Thus, it
cannot dereference
"this.layer".

The fix for this, I think, would be to add the following line at the
beginning of your loadFeaturesForRegion():

var success = sucess.bind(this);

I *think* that should fix it.

Let me know if it works out for you.

-Erik

ps. know that this bind() function is from the Prototype.js library.


On 6/22/06, nick at hogweed.org <nick at hogweed.org> wrote:
> Erik,
>
> > Is there any way that you could point me to a working url so that I could
> > step through this with a debugger? I just looked over your code and I
> > can't see why
> > you would be getting an error on "this.layer" -- there must be
> > something broken in the
> > initialization chain or something.
> >
> > Im online for the next six or seven hours and available to help. Let me
> > know... Erik
>
> Sorry for the late reply but haven't had access to my email for a while...
> anyhow, the URL is:
>
> http://nick.dev.openstreetmap.org/openlayers/
>
> As you can see it grabs the annotations from the AJAX server but does not then
> add them successfully to the map. (this.layer has no properties)
>
> Nick
>
>


More information about the Users mailing list