You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
625 B

  1. class ExportGeoJSON {
  2. constructor (conf) {
  3. this.conf = conf
  4. }
  5. each (ob, callback) {
  6. ob.object.exportGeoJSON(this.conf, callback)
  7. }
  8. finishOne (object) {
  9. return {
  10. content: JSON.stringify(object, null, ' '),
  11. fileType: 'application/json',
  12. extension: 'geojson'
  13. }
  14. }
  15. finish (list) {
  16. if (!this.conf.singleFeature) {
  17. list = {
  18. type: 'FeatureCollection',
  19. features: list
  20. }
  21. }
  22. return {
  23. content: JSON.stringify(list, null, ' '),
  24. fileType: 'application/json',
  25. extension: 'geojson'
  26. }
  27. }
  28. }
  29. module.exports = ExportGeoJSON