make-geo-picking-texture-ogc.js 691 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* global parseGeom */
  2. const fs = require( 'fs' );
  3. const path = require( 'path' );
  4. require( './ogc-parser' );
  5. const baseDir = process.argv[ 2 ];
  6. function readJSON( name ) {
  7. return JSON.parse( fs.readFileSync( path.join( baseDir, name ), { encoding: 'utf-8' } ) );
  8. }
  9. function main() {
  10. const areas = readJSON( 'level1.json' );
  11. areas.forEach( ( area, ndx ) => {
  12. console.log( ndx );
  13. try {
  14. const buf = new Uint8Array( Buffer.from( area.geom, 'base64' ) );
  15. area.geom = parseGeom( buf );
  16. } catch ( e ) {
  17. console.log( 'ERROR:', e );
  18. console.log( JSON.stringify( area, null, 2 ) );
  19. throw e;
  20. }
  21. } );
  22. console.log( JSON.stringify( areas, null, 2 ) );
  23. }
  24. main();
粤ICP备19079148号