6

I'm using ol3 in a mobile hybrid application using sencha touch2 , so I start by drawing a polygon inside a map , after validating this drawing I redirect the user to an other form in order to fill the alphanumeric informations of that polygon , My problem is when I want to get back to my map the layers disappear and the only way to make them get back is to change the device Orientation. so I'm looking for code snippet that can reload (refresh) my layers or the whole map

I tried map.dispatchChangeEvent();

or vectorSource.dispatchChangeEvent();

but nothing works for me


I find the solution is to update the map size like this : map.updateSize();

I

12

Edit:

To solve the issue just use map.updateSize();.

Initial answer

Firstly, I recommended unsuccessfully, to try map.render() or map.renderSync()

The first one map.render() make (citing official doc)

Requests a render frame; rendering will effectively occur at the next browser animation frame.

The second one do

Requests an immediate render in a synchronous manner.

  • 5
    Thanks @b-eyes and @ThomasG77, but why not posting the map.updateSize(); as an answer? That would help people to find a solution to the problem (there seem to be several question on the same topic still unanswered). – Germán Carrillo Aug 1 '15 at 15:56
  • 1
    I've edited my answer – ThomasG77 Aug 1 '15 at 19:22

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.