mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
New methods in 0.6. Additional tests added. Old typings didn't make options optional. Linting was disabled.
39 lines
853 B
TypeScript
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;
|
|
});
|