mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Geomap: Fix geohash editor settings #54058
This commit is contained in:
parent
657e1683d2
commit
13aacf3590
@ -51,7 +51,7 @@ export function addLocationFields<TOptions>(
|
||||
|
||||
case FrameGeometrySourceMode.Geohash:
|
||||
builder.addFieldNamePicker({
|
||||
path: `${prefix}.geohash`,
|
||||
path: `${prefix}geohash`,
|
||||
name: 'Geohash field',
|
||||
settings: {
|
||||
filter: (f: Field) => f.type === FieldType.string,
|
||||
|
@ -67,4 +67,31 @@ describe('handle location parsing', () => {
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
it('auto support geohash fields', async () => {
|
||||
const frame = toDataFrame({
|
||||
name: 'simple',
|
||||
fields: [
|
||||
{ name: 'name', type: FieldType.string, values: names },
|
||||
{ name: 'geohash', type: FieldType.string, values: ['9q94r', 'dr5rs'] },
|
||||
],
|
||||
});
|
||||
|
||||
const matchers = await getLocationMatchers({
|
||||
mode: FrameGeometrySourceMode.Geohash,
|
||||
});
|
||||
const geo = getGeometryField(frame, matchers).field!;
|
||||
expect(geo.values.toArray().map((p) => toLonLat((p as Point).getCoordinates()))).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Array [
|
||||
-122.01416015625001,
|
||||
36.979980468750014,
|
||||
],
|
||||
Array [
|
||||
-73.98193359375,
|
||||
40.71533203125,
|
||||
],
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user