Skip to content

Instantly share code, notes, and snippets.

@ceoworks
Created November 20, 2023 13:33
Show Gist options
  • Select an option

  • Save ceoworks/faaab4ba9d8e4f901e4d287b7f2b3c12 to your computer and use it in GitHub Desktop.

Select an option

Save ceoworks/faaab4ba9d8e4f901e4d287b7f2b3c12 to your computer and use it in GitHub Desktop.
Geojson validation does not throw erros on duplicate members
// run with ts-node and there will be no errors.
import { check } from "@placemarkio/check-geojson";
const geojsonHint = require("@mapbox/geojsonhint");
const testPolygon = {
type: "Polygon",
coordinates: [
[
[2, 1],
[2, 1],
[1, 2],
[1, 2],
[0, 0],
[0, 0],
[2, 1],
[2, 1],
],
],
};
try {
const parseValue = check(JSON.stringify(testPolygon));
console.log("parseValue:", parseValue);
} catch (e) {
/// e.issues
console.error(e);
}
const errors = geojsonHint.hint(JSON.stringify(testPolygon), {
noDuplicateMembers: true,
});
console.log("errors:", errors);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment