[OpenLayers-Users] Vector layer - getting error "this.renderer
has no properties"
Eric Lemoine
eric.c2c at gmail.com
Thu Nov 22 08:04:03 EST 2007
On Nov 22, 2007 12:58 AM, Nick Whitelegg <nick at hogweed.org> wrote:
>
> 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.
Hi Nick,
I haven't looked into detail but I think this might be related to the
SelectFeature control. Since you delete the osm layer and create a new
one, the SelectFeature may still be trying to work with the old layer.
I'm not sure...
Cheers,
--
Eric
More information about the Users
mailing list