DefinitelyTyped/types/shapefile/shapefile-tests.ts
James Bromwell bcf1c001b0 [shapefile] Update to 0.6
New methods in 0.6.  Additional tests added.
Old typings didn't make options optional.
Linting was disabled.
2018-08-16 12:36:22 +02:00

39 lines
853 B
TypeScript

import { open, openDbf, openShp, read } from 'shapefile';
open('./example.shp', new ArrayBuffer(123))
.then(source => {
source.bbox;
source.read()
.then(result => {
result.value.geometry;
result.done;
});
});
openDbf('./example.dbf', {encoding: "utf8"})
.then(source => {
source.bbox;
source.read()
.then(result => {
result.value;
result.done;
});
});
openShp('./example.shp', {highWaterMark: 0xabad1dea})
.then(source => {
source.bbox;
source.read()
.then(result => {
result.value;
result.done;
});
});
read("example.shp")
.then(result => {
result.bbox;
result.features;
result.type;
});