[OpenLayers-Users] Markers disappear when resizing my map

cliffiicous Cliff.Pereira at EFTAS.com
Fri Oct 26 03:18:46 PDT 2012


Hi mailinglist,

I have a tiny problem using openlayers. I'm trying to implement it in the
MVC structure of EXT JS 4. And got everything working. My only problem is,
that all my markers disappear when the map is resized. Here are the steps I
made...

Created a simple map in my view:
var map = new OpenLayers.Map({...})

Then in the controller I apply a MarkersLayer to the map and register a
click event:
map.addLayer(new OpenLayers.Layer.Markers("StartMarker"));
map.events.on({
   "click": this.onMapClick,
   scope: this
});

And in the onMapClick function I add markers to the position where the user
clicked.
...
var markersLayer = map.getLayersByName('StartMarker')[0];
markersLayer.addMarker(new OpenLayers.Marker(lonlat));
...


Funny thing now. When I use markersLayer.redraw() in the onMapClick function
only the last added marker is shown. If I disable it, all markers are shown.
Now when the map is resized all the markers disappear and I have no clue why
this happens. Is there any options I have overseen? I had a look at the
openlayers example and they do not use any additional options either....

Any help is highly appreciated.
Thank you



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Markers-disappear-when-resizing-my-map-tp5011490.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list