I was just going through the documentation for OpenLayers 3.11 and came across Tile(). Now it accepts a lot of properties: opacity, preload , map, etc.), but the one I am interested in is extent. Basically, it allows me to set an extent of which tiles I would like to load, so an initialization with the extent parameter might look like as follows:

new ol.layer.Tile({
    visible: false,
    preload: Infinity,
    extent: [-16655.5402445057125, 6609968.258934638,0,6809968],
    source: new ol.source.BingMaps({
      key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
      imagerySet: styles[i]
      // use maxZoom 19 to see stretched tiles instead of the BingMaps
      // "no photos at this zoom level" tiles
      // maxZoom: 19

Notice how the extent parameter accepts an array with 4 values in it. My question is about getting the correct order of the values inside the extent array.

  • 3
    MinX,MinY,MaxX,MaxY where X is the axis that goes from left to right on the screen (longitude, easting) and Y from bottom to top (latitude, northing). – user30184 Nov 23 '15 at 19:11
  • 3
    A lot depends on context -- GIS vector folks mostly use llx,lly,urx,ury (aka minx,miny,maxx,maxy) while image folks lean toward ulx,uly,lrx,lry, and non-GIS folks gravitate toward llLat,llLon,urLat,urLon. In context, this looks like the first usage. – Vince Nov 23 '15 at 20:04

From ol/layer/Tile documentation, property extent is of type module:ol/extent~Extent, which reads:

An array of numbers representing an extent: [minx, miny, maxx, maxy].

x coordinates are longitude (easting) and y coordinates are latitude (northing).

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.