forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request elastic#8000 from thomasneirynck/fix/7882_zoom_pre…
…cision Change mapping from zoom levels to geohash precision Former-commit-id: b98339b
- Loading branch information
Showing
5 changed files
with
130 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import expect from 'expect.js'; | ||
import AggTypesBucketsGeoHashProvider from 'ui/agg_types/buckets/geo_hash'; | ||
|
||
describe('Geohash Agg', function () { | ||
|
||
|
||
describe('write', function () { | ||
|
||
let paramWriter = new AggTypesBucketsGeoHashProvider(function PrivateMock() { | ||
return function BucketMock(geohashProvider) { | ||
return geohashProvider.params[4]; | ||
}; | ||
}, { | ||
get: function () { | ||
return 7;//"visualization:tileMap:maxPrecision" | ||
} | ||
}); | ||
|
||
describe('geohash', function () { | ||
|
||
const zoomToGeoHashPrecision = { | ||
0: 1, | ||
1: 2, | ||
2: 2, | ||
3: 2, | ||
4: 3, | ||
5: 3, | ||
6: 4, | ||
7: 4, | ||
8: 4, | ||
9: 5, | ||
10: 5, | ||
11: 6, | ||
12: 6, | ||
13: 6, | ||
14: 7, | ||
15: 7, | ||
16: 7, | ||
17: 7, | ||
18: 7, | ||
19: 7, | ||
20: 7, | ||
21: 7 | ||
}; | ||
|
||
Object.keys(zoomToGeoHashPrecision).forEach((zoomLevel) => { | ||
it(`zoom level ${zoomLevel} should correspond to correct geohash-precision`, () => { | ||
const output = {params: {}}; | ||
paramWriter.write({ | ||
vis: { | ||
hasUiState: () => true, | ||
uiStateVal: () => zoomLevel | ||
}, | ||
params: { | ||
autoPrecision: true | ||
} | ||
}, output); | ||
expect(output.params.precision).to.equal(zoomToGeoHashPrecision[zoomLevel]); | ||
}); | ||
}); | ||
}); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import expect from 'expect.js'; | ||
import {geohashColumns} from 'ui/utils/decode_geo_hash'; | ||
|
||
describe('decode_geo_hash', function () { | ||
it('geohashColumns', function () { | ||
expect(geohashColumns(1)).to.equal(8); | ||
expect(geohashColumns(2)).to.equal(8 * 4); | ||
expect(geohashColumns(3)).to.equal(8 * 4 * 8); | ||
expect(geohashColumns(4)).to.equal(8 * 4 * 8 * 4); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters