Get correct coordinates of feature when projection is wrapped in OpenLayers 3

المشرف العام

Administrator
طاقم الإدارة
In OpenLayers 3 I have a vectormap which is wrapped around the dateline:

new ol.source.Vector({ ... wrapX: true});When I fetch the features at an event pixel via

var feature = map.world.forEachFeatureAtPixel(pixel, function(feature, layer) { return feature;});The coordinates I get via

var coords = feature.getGeometry().getCoordinates()... are always the same no matter in which "repetition" of the wrapped world I hover. Then I position an ol.Overlay via

overlay.setPosition(coords);And this positioning also doesn't detect the repition, which leads to the behaviour, that the overlay is positioned off the view, when the "central world" is panned of the screen.



أكثر...
 
أعلى