1

How can i duplicate an already initialised map state? I would like to save the hassle of re-initialising the same map then copying the layers over.

vicgoyso
  • 636
  • 1
  • 14
  • 35

1 Answers1

1

You can reuse the map object on different tags just by changing the target div when you want to use it on different pages.

    map.setTarget('map-holder');

If you want to display both maps at the same time then you can try this example https://openlayersbook.github.io/ch03-charting-the-map-class/example-05.html.

One map cannot have two targets at the same time as far as I know. Hope that helps.

Amir
  • 76
  • 5