[OpenLayers-Dev] Vector layer fails, if constructed before the page has finished loading

Christopher Schmidt crschmidt at metacarta.com
Mon Mar 19 17:29:06 EDT 2007


On Mon, Mar 19, 2007 at 03:38:45PM -0500, Jeff Dege wrote:
> OK - further info.
> 
> You can't declare a vector layer in inline javascript, you have to
> declare it in a function that's called by a client-side event.
> 
> The vectorfeatures example declares a vector layer in an init()
> function, and init() is called on the onload event of <body>.  This
> worked.
> 
> My ASPX conversion called init() in an emitted Javascript block, placed
> near the end of the file
> by ClientScript.RegisterStartupScript().  This did not work.

This doesn't surprise me. This thread is now linked from
http://trac.openlayers.org/wiki/VectorFAQ . This actually explains why
Google goes with making people add the xmlns:v to their documents
manually. That might be worth examining as an option for a future
release.

Thanks for the report and resolution info. Sorry I don't have a
workaround to tell you how to fix it.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list