-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathopen_vsigzip.test.js
64 lines (59 loc) · 1.75 KB
/
open_vsigzip.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const gdal = require('../lib/gdal.js')
const path = require('path')
const assert = require('chai').assert
describe('Open', () => {
afterEach(gc)
describe('vsigzip', () => {
let filename, ds
it('should not throw', () => {
filename = path.join(__dirname, 'data/vsigzip/hp40ne.gz')
ds = gdal.open(filename)
})
it('should be able to read layer count', () => {
assert.equal(ds.layers.count(), 4)
})
describe('layer', () => {
let layer
before(() => {
layer = ds.layers.get(0)
})
it('should have all fields defined', () => {
assert.equal(layer.fields.count(), 8)
assert.deepEqual(layer.fields.getNames(), [
'fid',
'featureCode',
'featureDescription',
'anchorPosition',
'font',
'height',
'orientation',
'textString'
])
})
let layer2
before(() => {
layer2 = ds.layers.get(1)
})
describe('field properties', () => {
it('should evaluate datatypes', () => {
assert.equal('string', layer2.fields.get(0).type)
assert.equal('integer', layer2.fields.get(1).type)
assert.equal('string', layer2.fields.get(2).type)
})
})
describe('features', () => {
it('should be readable', () => {
assert.equal(layer2.features.count(), 381)
// layer2.features.get(0); doesn't work, as there is no 'id', but 'fid' instead
const feature = layer2.features.next()
const fields = feature.fields.toObject()
assert.deepEqual(fields, {
fid: 'ID_105',
featureCode: 15600,
featureDescription: 'Water Feature'
})
})
})
})
})
})