1

How can I migrate my application from OpenLayers 2 to OpenLayers 3 or 4 without any code changes? Is there any wrapper which support OpenLayers 2 code structure but actually call the OpenLayers 3 or 4 methods?

For example, when I run this:

map.setCenter(center, 5);

It will run the below code in background (something that I call wrapper):

old3.getView().setCenter(center); 
old3.getView().setZoom(5);      

The wrapper is actually a namespace like this:

var map = {
 setCenter: function(center,ZoomLevel){
   old3.getView().setCenter(center); 
   old3.getView().setZoom(ZoomLevel); 
 }
};

The map is wrapper (what I'm looking for) and ol3 is OpenLayers 3 library

Ahmad Payan
  • 1,933
  • 1
  • 19
  • 31
  • As of i Know there is no wrapper or tool which will convert openlayers 2 to 3. – Sumanth Shastry Apr 30 '17 at 13:05
  • @SumanthShastry Thanks! So I have to write my own wrapper or completely migrate to new OpenLayers. – Ahmad Payan May 01 '17 at 02:15
  • Do you mind sharing why you don't want to port it or just stay with ol2? – Corey Alix May 09 '17 at 01:36
  • @CoreyAlix Actually it's take too many times to write from scratch with ol3 and ol3 is much more flexible to work with. ex: the Raster-Reprojection functionality that implemented in ol3 is one of the feature that I considered to use it. – Ahmad Payan May 09 '17 at 01:57

0 Answers0