[GIS] Openlayers vector layer markers disappear near dateline

openlayers-2

See demonstration of the bug here: http://jsfiddle.net/3ECSb/4/

I have seen and solved similar problems before with OpenLayers but the usual "three world" concept isn't fixing it this time so I'm putting this out there in case the slight differences can help someone identify the problem.

I have a bunch of points I am adding to my vector layer.

var point = new OpenLayers.Geometry.Point(result['longitude'], result['latitude']);
point.transform(map.displayProjection, map.getProjectionObject());

var feature = new OpenLayers.Feature.Vector(
        point,
        {lakeData:result}
    );
vectorLayer.addFeatures(feature);

The map is centered on New Zealand and the points appear. I zoom in one step and they are gone. Then I pan the map so NZ is almost off the map on the right (the important part is the antimeridian is gone) and the points reappear. If I click and drag the map around the points stay on the screen. However if I release the mouse when the antimerdian is still to the right of center the points disappear. I can then center the map on the Chatham Islands (-176 Longitude) and the points reappear and will stay on screen even if I go back to the previous position when they were not visible.

So to clarify. If I am centered at 179 latitude the points are only visible if I was previously centered at a negative latitude since the last time the antimeridian was brought on to screen from the right.

I have sphericalMercator and wrapDateLine set on every layer, I'm using Google layers as my basemaps, I have tried adding copies of the points at +/- 360 from their original places. But nothing has worked.

Best Answer

Apparently:

It is a known issue with a known workaround: in your vector layer's options, configure

renderers: ['Canvas', 'VML']

The reason is that the SVG renderer, which is used by default in Chrome and Firefox, has a limited coordinate range.

Source ahocevar comment

Updated Working JSFIDDLE