[OpenLayers-Users] ensure vector features render for wrapDateLine=true

Ivan Price Ivan.Price at noveltis.fr
Thu May 23 09:58:42 PDT 2013


Hi there,

I'm trying to do something that I can see others have tried to do, but i can't find a working solution.

I have a layer with vector polygons, generated programmatically in the JavaScript. My map is global, in 3857 proj, with dateline wrapping.. hence i would like for the polygons to be represented multiple times when appropriate.

I have tried adding 'mirror' features, i.e. ones where the geometry is shifted right and left by 2*2.003750834E7 meters.. however the new features are rendered on top of the old, despite the fact their geometries are not the same. I have tried defining the map extent to be and extra globe wide on each side.

for e.g.:
            var new_feature1 = feature.clone();
            var new_feature2 = feature.clone();
            new_feature1.geometry.move(20037508.34*2,0);
            extent_layer.addFeatures(new_feature1);
            new_feature2.geometry.move(-20037508.34*2,0);
            extent_layer.addFeatures(new_feature2);
            console.log(new_feature1.geometry.getBounds());
            console.log(new_feature2.geometry.getBounds());

the console shows the geoms are different, but they all render on top of each other.

Is there a way to achieve this, i.e. render vectors beyond the logical extent in order to avoid not drawing features where they indeed exist ?

(note in order to get sufficiently zoomed out with wrapDateLine=true i had to override OpenLayers.Map.adjustZoom)

i am using OpenLayers 2.13-dev

thanks for any ideas,

-i

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130523/36311ac1/attachment-0001.html>


More information about the Users mailing list