brunosan / osm-tracing-candidates

Make a list of places using the discrepancy between OSM nodes ranking and satellite tile filesize ranking gives.
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Fix stopgag for empty vt #2

Open brunosan opened 10 years ago

brunosan commented 10 years ago

Bug on ./live.js 16/34823/32358

Which yields:

/mnt/data/tiles/live.js:68
    var data = output_vt.toGeoJSON(0);
                         ^
TypeError: Zero-based layer index '0' not valid, no layers found in map
    at /mnt/data/tiles/live.js:68:26
    at Gunzip.onEnd (zlib.js:166:5)
    at Gunzip.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

Current stopgag is to catch the error https://github.com/brunosan/osm-tracing-candidates/blob/master/live.js#L75

brunosan commented 10 years ago

Solution can be to add a check with

output_vt.names().length==0