Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
geo
/
format
/
File Content:
geojson.test.ts
import { dataFrameToJSON, FieldType } from '@grafana/data'; import { frameFromGeoJSON } from './geojson'; describe('Read GeoJSON', () => { it('supports simple read', () => { const frame = frameFromGeoJSON({ type: 'FeatureCollection', features: [ { id: 'A', type: 'Feature', geometry: { type: 'Point', coordinates: [0, 0], }, properties: { hello: 'A', }, }, { type: 'Feature', geometry: { type: 'Point', coordinates: [1, 1], }, properties: { number: 1.2, hello: 'B', mixed: 'first', }, }, { type: 'Feature', geometry: { type: 'Point', coordinates: [2, 2], }, properties: { number: 2.3, mixed: 2, }, }, ], }); const msg = dataFrameToJSON(frame); expect(msg.schema).toMatchInlineSnapshot(` { "fields": [ { "config": {}, "name": "id", "type": "string", }, { "config": {}, "name": "geo", "type": "geo", }, { "config": {}, "name": "hello", "type": "string", }, { "config": {}, "name": "number", "type": "number", }, { "config": {}, "name": "mixed", "type": "string", }, ], "meta": undefined, "name": undefined, "refId": undefined, } `); expect( frame.fields.reduce<Record<string, unknown[]>>((acc, v, idx, arr) => { if (v.type !== FieldType.geo) { acc[v.name] = v.values; } return acc; }, {}) ).toMatchInlineSnapshot(` { "hello": [ "A", "B", null, ], "id": [ "A", null, null, ], "mixed": [ null, "first", "2", ], "number": [ null, 1.2, 2.3, ], } `); }); });
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
geohash.test.ts
276 bytes
0644
geohash.ts
1159 bytes
0644
geojson.test.ts
2335 bytes
0644
geojson.ts
2838 bytes
0644
utils.ts
3424 bytes
0644
N4ST4R_ID | Naxtarrr