1.0.5 • Published 2 years ago

rasterized-interpolation v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

rasterized-interpolation

generate route paths using WGS84 grid data and the xy velocity components of points.

Usage

:earth_asia: data

GridData

paramtypedescribe
headerJSONgrid data format description
xuArraythe velocity component in the x-direction
yvArraythe velocity component in the y-direction

header

paramtypedescribe
westnumberwesternmost
eastnumbereasternmost
southnumbersouthernmost
northnumbernorthernmost
dxnumbergrid x direction accuracy
dynumbergrid y direction accuracy
nxnumbernumber of grids in the x direction
nynumbernumber of grids in the y direction

example

  const gridData = {
      header: {

          // scope
          east: 110,
          west: 120,
          south: 70,
          north: 80,

          // direction accuracy 
          dx: 1,
          dy: 1,

          // number of grids
          nx: 10,
          ny: 10
    },
    
      // sort from east to west and from north to south
      xu: [-0.24, -0.25, -0.26, -0.24, -0.24, -0.25, -0.26, -0.24, -0.24, -0.25],
      yu: [-0.24, -0.25, -0.26, -0.24, -0.24, -0.25, -0.26, -0.24, -0.24, -0.25]
  }

Synchronous

synchronous interpolation prediction data. It is recommended to use asynchronous data loading if your data volume is too large.

example

  import { InterpolationRandom, InterpolationAll } from './worker/rasterized-interpolation.js';
  const data: GardData = {...};

  // generate random paths
  InterpolationRandom({ data, randomTotal: 10000 });

  // generate all paths
  InterpolationAll({ data })

Asynchronous

if you need to use a worker to process a large amount of data.

worker configuration

you need to configure the project worker to load the script. If you don't want to configure it, you can use synchronous loading method.

  copyPlugins({
      from: path.join('node_modules/rasterized-interpolation/core/', 'rasterized-interpolation-worker.js'),
      to: 'rootPath'
  })

example

  import { createWorker } from 'rasterized-interpolation';

  const myWorker = createWorker();

  const data: GardData = {...};

  myWorker.send(data)

  // Get your interpolation prediction data
  myWorker.onmessage = function(e) {
    ...
  }
1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago