Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
    
The problem appears to be a regression that appeared between 2.10 and 2.12. Tough they partly solved the 180° problem it seems to have just moved sideways a bit. I'm working on a jsfiddle to demonstrate it –  Craig Nov 26 '12 at 9:55
    
Filed as a bug github.com/openlayers/openlayers/issues/771 still looking for a solution –  Craig Nov 26 '12 at 10:43
    
@ ahocevar : it works nicely for me (after a few hours of pain) –  user1629472 Dec 11 '13 at 13:03

2 Answers 2

up vote 2 down vote accepted

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

share|improve this answer
    
@Craig: Did this resolve your problem? –  CaptDragon Nov 28 '12 at 14:27
    
Indeed it did, thanks. –  Craig Dec 2 '12 at 19:45

Another workaround, if the Canvas renderer isn't an option (like for us, where we added some additional SVG to our app), is to increase the domain that SVG can support. Older SVG renderers were known to have a limited coordinate range1, which is where this becomes a problem.

The workaround we ended up using was to change the max value that SVG natively supports. This can be done with a command such as:

OpenLayers.Renderer.SVG.prototype.MAX_PIXEL = Number.MAX_VALUE;

Of course, your mileage may vary with a solution2 like this, but it worked in the testing that we did for our app (and seems compatible with MODERN browsers3, and may just be an artifact of OpenLayers trying to maintain a huge amount of compatibility).

Edit: Adding Fiddle
Demonstration Fiddle

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.