bennetjo

wrapAround180 bug

Discussion created by bennetjo on Jun 10, 2015
Latest reply on May 7, 2018 by bennetjo

I've found that the map's wrapAround180 behavior will fail under certain circumstances where it should not.  When instantiating a map with wrapAround180 set to true, and the lods option specified, the map will create an internal TileInfo object based on WGS 84 (4326).  However, if you add a tiled layer based on Web Mercator (which all of mine are), the map will make some internal comparisons between the Web Mercator spatial reference and WGS 84 spatial reference definitions, and conclude wrapping is no longer possible.

 

The problem therefore lies with the default TileInfo created by the map, over which the user has no documented control, and which is created whether or not you have any layers based on WGS 84.  There is a workaround though.  After instantiating your map, create a new TileInfo object based on Web Mercator, and make a couple assignments:

 

var map = new Map("map", options);

 

var tileInfo = new TileInfo({

  dpi: 96,

  height: 256,

  lods: options.lods,

  origin: new Point(-20037508.342787, 20037508.342787, new SpatialReference(102100)),

  spatialReference: new SpatialReference(102100),

  width: 256

});

 

map._params.tileInfo = tileInfo;

map.__tileInfo = tileInfo;

 

 

I'm currently using version 3.13.

Outcomes