[OpenLayers-Users] Vector layer - getting error "this.renderer has
no properties"
Nick Whitelegg
nick at hogweed.org
Wed Nov 21 18:58:51 EST 2007
Hello everyone,
I'm coming across a problem I can't figure out in "osmajax", the OpenLayers
Vector-based OSM editor I'm developing, at
http://www.free-map.org.uk/freemap/javascript/osmajax-0.5/index.php
The problem relates to the search facility, which moves to another location.
If you select a feature before doing a search, errors continuously come up
reading
this.renderer has no properties (OpenLayers.js line 710)
when you arrive at the new location. (However, the vector data for the new
location is correctly loaded and displayed properly). The problem does not
arise if a feature is not selected before doing the search. This can be
demonstrated in the default location by selecting a feature, and then
entering "Durley" in the search box.
My code to set the centre of the map (in Osmajax.js, occurs in response to the
search):
this.setCentre = function(latlon)
{
if(this.selectedFeature)
this.vectorLayer.removeFeatures(this.selectedFeature);
this.vectorLayer.destroy();
this.vectorLayer=null;
var cvtr=new converter("Mercator");
var prjLL = cvtr.normToCustom(latlon);
this.map.setCenter(prjLL, this.map.getZoom() );
this.vectorLayer = new OpenLayers.Layer.OSM("OSM
Layer",this.statusMsg);
this.setupControls();
this.map.addLayer(this.vectorLayer);
this.load();
}
(I have to delete the layer and create it again, as otherwise, Firefox chokes
because the extent of the vector layer is too large).
Any ideas what might be wrong here? Using OpenLayers 2.4.
Thanks,
Nick
More information about the Users
mailing list