(cherry picked from commit 13aacf3590)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
co-authored by
Ryan McKinley
parent
25033280fd
commit
f997ac8532
@@ -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,
|
||||
],
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user