@planet/importer
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -413,1 +413,38 @@ import fs from 'fs'; | ||
}); | ||
describe('testing bad geojson format', () => { | ||
/* These are a collection of geojson files that are | ||
* technically broken but are allowed out in the wild. | ||
*/ | ||
it('imports a geojson file with "EPSG:4326"', done => { | ||
const geojson = new File({ | ||
path: './__tests__/data/bad-epsg-spec.json', | ||
type: 'binary/data', | ||
}); | ||
importer([geojson]) | ||
.then(collection => { | ||
expect(collection.features.length).toBe(1); | ||
done(); | ||
}) | ||
.catch(err => { | ||
done(err); | ||
}); | ||
}); | ||
it('evil feature only file', done => { | ||
const geojson = new File({ | ||
path: './__tests__/data/geometry-only.geojson', | ||
type: 'binary/data', | ||
}); | ||
importer([geojson]) | ||
.then(collection => { | ||
expect(collection.features.length).toBe(1); | ||
done(); | ||
}) | ||
.catch(err => { | ||
done(err); | ||
}); | ||
}); | ||
}); |
@@ -133,2 +133,11 @@ "use strict"; | ||
return json; | ||
} else if (json.type === 'Polygon' || json.type === 'MultiPolygon') { | ||
return { | ||
type: 'FeatureColletion', | ||
features: [{ | ||
type: 'Feature', | ||
properties: {}, | ||
geometry: json | ||
}] | ||
}; | ||
} else { | ||
@@ -135,0 +144,0 @@ throw new Error(ERRORS.CORRUPT); |
{ | ||
"name": "@planet/importer", | ||
"public": true, | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Client-side geometry import library", | ||
@@ -6,0 +6,0 @@ "main": "dist/lib/import.js", |
@@ -141,2 +141,13 @@ /** | ||
return json; | ||
} else if (json.type === 'Polygon' || json.type === 'MultiPolygon') { | ||
return { | ||
type: 'FeatureColletion', | ||
features: [ | ||
{ | ||
type: 'Feature', | ||
properties: {}, | ||
geometry: json, | ||
}, | ||
], | ||
}; | ||
} else { | ||
@@ -143,0 +154,0 @@ throw new Error(ERRORS.CORRUPT); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
871562
40
3667