I am adding new features to a map solution which is using OpenLayers 2.13. This solution displays features over Norway, so we're using UTM33N (EPSG:32633) Projection.
Currently I am trying to add selectable/tooltip functionality to a new layer which should display GPS-tracks (Linestrings) The solution already has similar "selectable" functionality on several of its layers. These layers are added as an array to an OpenLayers.Control.SelectFeature.
Before I added the GPS layer to the SelectFeature, I could see it being displayed correctly in the map and in the right position. (Image 1)
During setting up the map, I add the GPS layer to the layers in the SelectFeature control which is inside a custom made TooltipControl:
tooltipControl.getSelectFeatureControl().selectFeatureControl.layers.push(gpsLayer);
When I add it to the SelectFeature control however, it is displayed with a considerable offset from where it should have been. (Image 2) The offset is actually dependent on zoom level, because when I zoom in the features approach their correct position, but still aren't correct.
From inspecting the DOM I can see that before adding the GPS layer to the SelectFeature control the layer was being rendered inside a div called "OpenLayers_Layer_Vector_55". When panning the map, the div's style is being changed, more specifically the "left" and "top" properties of the div are being changed to ensure the linestring is rendered at the correct position.
After adding it to SelectFeature, it is being rendered inside a div called "OpenLayers_Layer_Vector_RootContainer_283" along with all the other selectable layers. Now the GPS layer is not rendered in the correct position on the map anymore. OpenLayers is still updating the "left" and "top" properties of the Vector_55 div when I pan, but the GPS layer is unaffected by this since it is now contained in the RootContainer_283 div.
How can I render the GPS layer in the correct position and still have it in the SelectFeature control?
Image 2 - Incorrect rendering:
Thanks in advance!