Options
All
  • Public
  • Public/Protected
  • All
Menu

@placemarkio/check-geojson

Index

Functions

  • check(jsonStr: string): GeoJSON
  • This catches the same issues as getIssues, but instead of returning a list of issues, it will throw a HintError if any errors are detected, and return the parsed GeoJSON as an object if no errors are.

    Parameters

    • jsonStr: string

    Returns GeoJSON

  • Given a string of possibly valid GeoJSON data, return an array of issues. This will handle invalid JSON data, invalid GeoJSON structure, and anything else that will prevent this string of data from being parsed and displayed on a map.

    check-geojson looks for invalid structure and invalid syntax. It does not check for complex geometry issues like self-intersections, which are hard to detect and don't cause failures in most display & manipulation software.

    Parameters

    • jsonStr: string

    Returns HintIssue[]

  • scavenge(jsonStr: string): { rejected: { feature: any; reasons: HintIssue[] }[]; result: GeoJSON }
  • This method will allow you to parse a possibly-valid bit of GeoJSON data. If nothing can be parsed, it will throw a HintError. However, if the GeoJSON can be parsed, it will return an object with valid features and rejected features along with the reasons why those features were rejected.

    Parameters

    • jsonStr: string

    Returns { rejected: { feature: any; reasons: HintIssue[] }[]; result: GeoJSON }

    • rejected: { feature: any; reasons: HintIssue[] }[]
    • result: GeoJSON

Generated using TypeDoc