2

In my map I'm tracking vehicle locations. If a vehicles is clicked a Overlay with additional informations is shown. How can I "bind" the Overlay to the vehicle location. I tried

feature.getGeometry().on(
            'propertychange', 
            function(propEvt) { 
                console.log('I'm here');
                var extent = feature.getGeometry().getExtent();
                var centerOfFeature = getCenterOfExtent(extent);
                popup.setPosition(centerOfFeature);  
            }, 
            feature.getGeometry());

But log message is not shown but the feature is still moving.

-- Rüdiger

1

try to bind it to feature and not the geometry.

feature.on('change',function(e){
 console.log('Im here');
 var extent = feature.getGeometry().getExtent();
 var centerOfFeature = getCenterOfExtent(extent);
 popup.setPosition(centerOfFeature);  
}); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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