Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GeoJSON validation #1052

Merged
merged 4 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,13 @@
"uglify-js": "^3.0.22",
"unassertify": "^2.0.3"
},
"peerDependencies": {
"mapbox-gl": ">=0.27.0"
},
"dependencies": {
"@mapbox/geojson-area": "^0.2.1",
"@mapbox/geojson-extent": "^0.3.2",
"@mapbox/geojson-normalize": "0.0.1",
"@mapbox/geojsonhint": "3.0.0",
"@mapbox/point-geometry": "0.1.0",
"@mapbox/geojson-area": "^0.2.2",
"@mapbox/geojson-extent": "^1.0.0",
"@mapbox/geojson-normalize": "^0.0.1",
"@mapbox/point-geometry": "^0.1.0",
"hat": "0.0.3",
"lodash.isequal": "^4.2.0",
"xtend": "^4.0.1"
"lodash.isequal": "^4.5.0",
"xtend": "^4.0.2"
}
}
5 changes: 0 additions & 5 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import normalize from '@mapbox/geojson-normalize';
import hat from 'hat';
import featuresAt from './lib/features_at';
import stringSetsAreEqual from './lib/string_sets_are_equal';
import geojsonhint from '@mapbox/geojsonhint';
import * as Constants from './constants';
import StringSet from './lib/string_set';

Expand Down Expand Up @@ -74,10 +73,6 @@ export default function(ctx, api) {
};

api.add = function (geojson) {
const errors = geojsonhint.hint(geojson, { precisionWarning: false }).filter(e => e.level !== 'message');
if (errors.length) {
throw new Error(errors[0].message);
}
const featureCollection = JSON.parse(JSON.stringify(normalize(geojson)));

const ids = featureCollection.features.map((feature) => {
Expand Down
14 changes: 0 additions & 14 deletions test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,6 @@ test('Draw.add -- GeometryCollection', (t) => {
t.end();
});

test('Draw.add -- Invalid geojson', (t) => {
t.throws(() => {
Draw.add({
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
coordinates: 7
}
});
}, /coordinates/, 'Invalid GeoJSON throws an error');
t.end();
});

test('Draw.add - accept lots of decimal percision', (t) => {
for (let i = 0; i < 30; i++) {
const div = Math.pow(10, i);
Expand Down
Loading