Making the default UTFGrid resolution 2.
According to the latest [spec](https://github.com/mapbox/utfgrid-spec/blob/master/1.2/utfgrid.md): "By default, UTFGrid operates on a 2x2 grid."
This commit is contained in:
@@ -127,7 +127,8 @@
|
|||||||
|
|
||||||
var grid_layer = new OpenLayers.Layer.UTFGrid(
|
var grid_layer = new OpenLayers.Layer.UTFGrid(
|
||||||
'Invisible UTFGrid Layer',
|
'Invisible UTFGrid Layer',
|
||||||
"./utfgrid/world_utfgrid/${z}/${x}/${y}.json"
|
"./utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||||
|
{utfgridResolution: 4} // default is 2
|
||||||
);
|
);
|
||||||
map.addLayer(grid_layer);
|
map.addLayer(grid_layer);
|
||||||
|
|
||||||
|
|||||||
@@ -48,11 +48,13 @@
|
|||||||
|
|
||||||
var world_utfgrid = new OpenLayers.Layer.UTFGrid(
|
var world_utfgrid = new OpenLayers.Layer.UTFGrid(
|
||||||
"World Population",
|
"World Population",
|
||||||
"./utfgrid/world_utfgrid/${z}/${x}/${y}.json"
|
"./utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||||
|
{utfgridResolution: 4} // default is 2
|
||||||
);
|
);
|
||||||
var bio_utfgrid = new OpenLayers.Layer.UTFGrid(
|
var bio_utfgrid = new OpenLayers.Layer.UTFGrid(
|
||||||
"World Bioregions",
|
"World Bioregions",
|
||||||
"./utfgrid/bio_utfgrid/${z}/${x}/${y}.json"
|
"./utfgrid/bio_utfgrid/${z}/${x}/${y}.json",
|
||||||
|
{utfgridResolution: 4} // default is 2
|
||||||
);
|
);
|
||||||
map.addLayers([bio_utfgrid,world_utfgrid]);
|
map.addLayers([bio_utfgrid,world_utfgrid]);
|
||||||
|
|
||||||
|
|||||||
@@ -163,8 +163,8 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* APIProperty: utfgridResolution
|
* APIProperty: utfgridResolution
|
||||||
* {Number}
|
* {Number}
|
||||||
* Ratio of the pixel width to the width of a UTFGrid data point. If an
|
* Ratio of the pixel width to the width of a UTFGrid data point. If an
|
||||||
* entry in the grid represents a 2x2 block of pixels, the
|
* entry in the grid represents a 4x4 block of pixels, the
|
||||||
* utfgridResolution would be 2. Default is 4 (specified in
|
* utfgridResolution would be 4. Default is 2 (specified in
|
||||||
* <OpenLayers.Tile.UTFGrid>).
|
* <OpenLayers.Tile.UTFGrid>).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
|||||||
* Property: utfgridResolution
|
* Property: utfgridResolution
|
||||||
* {Number}
|
* {Number}
|
||||||
* Ratio of the pixel width to the width of a UTFGrid data point. If an
|
* Ratio of the pixel width to the width of a UTFGrid data point. If an
|
||||||
* entry in the grid represents a 2x2 block of pixels, the
|
* entry in the grid represents a 4x4 block of pixels, the
|
||||||
* utfgridResolution would be 2. Default is 4.
|
* utfgridResolution would be 4. Default is 2.
|
||||||
*/
|
*/
|
||||||
utfgridResolution: 4,
|
utfgridResolution: 2,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: json
|
* Property: json
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
layer = new OpenLayers.Layer.UTFGrid(
|
layer = new OpenLayers.Layer.UTFGrid(
|
||||||
null,
|
null,
|
||||||
"../data/utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
"../data/utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||||
{isBaseLayer: true}
|
{isBaseLayer: true, utfgridResolution: 4}
|
||||||
);
|
);
|
||||||
map = new OpenLayers.Map({
|
map = new OpenLayers.Map({
|
||||||
div: "map",
|
div: "map",
|
||||||
|
|||||||
Reference in New Issue
Block a user