README.hbs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. [![npm version][npm-img]][npm-url]
  2. [npm-img]: https://img.shields.io/npm/v/lerc.svg?style=flat-square
  3. [npm-url]: https://www.npmjs.com/package/lerc
  4. # Lerc JS
  5. > Rapid decoding of Lerc compressed raster data for any standard pixel type, not just rgb or byte
  6. ## Browser
  7. ```html
  8. <script type="text/javascript" src="https://unpkg.com/lerc"></script>
  9. ```
  10. ```js
  11. Lerc.decode(xhrResponse, {
  12. inputOffset: 10, // start from the 10th byte (default is 0)
  13. pixelType: "U8", // only needed for lerc1 (default is F32)
  14. returnPixelInterleavedDims: false // only applicable to n-dim lerc2 blobs (default is false)
  15. });
  16. ```
  17. ## Node
  18. ```js
  19. npm install lerc && npm install node-fetch
  20. ```
  21. ```js
  22. const fetch = require('node-fetch');
  23. const Lerc = require('lerc');
  24. fetch('http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/0/0/0')
  25. .then(response => response.arrayBuffer())
  26. .then(body => {
  27. const image = Lerc.decode(body);
  28. image.width // 257
  29. });
  30. ```
  31. ## API Reference
  32. {{>main}}
  33. * * *
  34. ## Licensing
  35. Copyright &copy; 2017-2021 Esri
  36. Licensed under the Apache License, Version 2.0 (the "License");
  37. you may not use this file except in compliance with the License.
  38. You may obtain a copy of the License at
  39. http://www.apache.org/licenses/LICENSE-2.0
  40. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  41. See the License for the specific language governing permissions and limitations under the License.
  42. A local copy of the license and additional notices are located with the source distribution at:
  43. http://github.com/Esri/lerc/