geojsondataset

0.0.6 • Public • Published

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 });
  • 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
    });
  • 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);
  • 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);
    
    })

Readme

Keywords

none

Package Sidebar

Install

npm i geojsondataset

Weekly Downloads

20

Version

0.0.6

License

BSD 3-Clause License

Unpacked Size

30.9 kB

Total Files

9

Last publish

Collaborators

  • hudeyi