README.hbs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. pixelType: "U8", // leave pixelType out in favor of F32 for lerc1
  13. inputOffset: 10 // start from the 10th byte
  14. });
  15. ```
  16. ## Node
  17. ```js
  18. npm install lerc && npm install node-fetch
  19. ```
  20. ```js
  21. const fetch = require('node-fetch');
  22. const Lerc = require('lerc');
  23. fetch('http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/0/0/0')
  24. .then(response => response.arrayBuffer())
  25. .then(body => {
  26. const image = Lerc.decode(body);
  27. image.width // 257
  28. });
  29. ```
  30. ## API Reference
  31. {{>main}}
  32. * * *
  33. ## Licensing
  34. Copyright &copy; 2017-2018 Esri
  35. Licensed under the Apache License, Version 2.0 (the "License");
  36. you may not use this file except in compliance with the License.
  37. You may obtain a copy of the License at
  38. http://www.apache.org/licenses/LICENSE-2.0
  39. 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.
  40. See the License for the specific language governing permissions and limitations under the License.
  41. A local copy of the license and additional notices are located with the source distribution at:
  42. http://github.com/Esri/lerc/