geojsondataset
v0.0.6
Published
geojson dataset
Downloads
83
Readme
geojsondataset
Introduce
geojson dataset,In the dataset, a large number of geojson can be automatically cut by geojson-seg and consumed by frame
Install
- CDN
<script type="text/javascript" src="https://unpkg.com/geojsondataset/dist/geojsondataset.js"
></script>
- NPM
npm i geojsondataset
#or
yarn add geojsondataset
API
GeoDataSet
constructor(options)
- options.coordinateCount
the count of per geojson file coordinates
- options.loopFPS
the count of fps when loop
import { GeoDataSet } from "geojsondataset"; const geoDataSet = new GeoDataSet({ coordinateCount: 3000, loopFPS: 2 });
- options.coordinateCount
on(dataGroupId,handler)
Listen for a data set to be dequeued
- dataGroupId
the id data group
- handler
callback ,when data is listed
import { GeoDataSet } from "geojsondataset"; const geoDataSet = new GeoDataSet({ coordinateCount: 3000, loopFPS: 2 }); geoDataSet.on("testgeojson", (geojson) => { //do some things });
- dataGroupId
off(dataGroupId,handler)
remove Listen for a data set to be dequeued
- dataGroupId
the id data group
- handler
callback ,when data is listed
import { GeoDataSet } from "geojsondataset"; const geoDataSet = new GeoDataSet({ coordinateCount: 3000, loopFPS: 2 }); const handler = (geojson) => { //do some things }; geoDataSet.on("testgeojson", handler); geoDataSet.off("testgeojson", handler);
- dataGroupId
addGeoData(dataGroupId,geojson)
add geojson data to dataGroupId
- dataGroupId
the id data group
- geojson
geojson data
import { GeoDataSet } from "geojsondataset"; const geoDataSet = new GeoDataSet({ coordinateCount: 3000, loopFPS: 2 }); const handler = (geojson) => { //do some things }; geoDataSet.on("testgeojson", handler); fetch('./data/test.geojson').then(res=>res.json()).then(geojson=>{ geoDataSet.addGeoData('testgeojson',geojson); })
- dataGroupId