{"id":16723331,"url":"https://github.com/chrieke/geojson-invalid-geometry","last_synced_at":"2026-01-02T13:49:49.634Z","repository":{"id":211104865,"uuid":"603289192","full_name":"chrieke/geojson-invalid-geometry","owner":"chrieke","description":"🗺️ List of GeoJSON invalid geometry issues with example files","archived":false,"fork":false,"pushed_at":"2024-12-31T00:30:15.000Z","size":3517,"stargazers_count":39,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-07T01:37:41.862Z","etag":null,"topics":["error","geojson","geometry","geospatial","gis","validation","vector"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrieke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-18T03:39:30.000Z","updated_at":"2025-01-07T19:00:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"8be1319b-13c0-4b74-8a00-74e48fcc9ba0","html_url":"https://github.com/chrieke/geojson-invalid-geometry","commit_stats":null,"previous_names":["chrieke/geojson-invalid-geometry"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrieke%2Fgeojson-invalid-geometry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrieke%2Fgeojson-invalid-geometry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrieke%2Fgeojson-invalid-geometry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrieke%2Fgeojson-invalid-geometry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrieke","download_url":"https://codeload.github.com/chrieke/geojson-invalid-geometry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243738985,"owners_count":20340002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["error","geojson","geometry","geospatial","gis","validation","vector"],"created_at":"2024-10-12T22:37:44.315Z","updated_at":"2026-01-02T13:49:49.596Z","avatar_url":"https://github.com/chrieke.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🗺️ geojson-invalid-geometry\n\n**List of GeoJSON invalid geometry issues with example files**\n\nEver encountered an *invalid geometry* error when dealing with GeoJSON? Even if a GeoJSON conforms to the\n[GeoJSON specification](https://geojson.org/), some tools or APIs might have issues with it.\nThis repo shows the common issues when handling GeoJSON geometries and how to fix them. To validate and fix GeoJSON \nautomatically you can use the [geojson-validator](https://github.com/chrieke/geojson-validator). For a general \nintroduction to GeoJSON see [here](https://macwright.com/2015/03/23/geojson-second-bite.html).\n\n## Invalid by GeoJSON specification\n\n![](repo_images/invalid_examples.png)\n\n### Unclosed \nThe first and last node (corner point, also called vertex/vertices) of a **Polygon's** exterior ring (shell) or inner ring (hole) \nmust be the same, i.e. have identical values. This signifies the start and endpoint of a closed Polygon. \n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.6),\n[Example](examples/invalid_geometries/invalid_unclosed.geojson)\n\n### Less than three unique nodes\nA **Polygon's** exterior ring and inner ring must have four or more nodes: Three or more unique coordinate positions plus\nthe first and last node must be the equivalent to close the Polygon (see above). Otherwise the Polygon would not cover an area.\n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.6),\n[Example](examples/invalid_geometries/invalid_less_three_unique_nodes.geojson)\n\n### Exterior not counter-clockwise winding order\nA **Polygon's** exterior ring must have counterclockwise winding order (often abbreviated ccw). This is often \noverlooked when manually creating Polygons or converting from other formats. As an older specification version did not \ndefine the winding order, most tools will accept Polygons with invalid winding order, but not all.   \nIn this context, many definitions use the term \"right-hand rule\": If you would walk along the ring in the order of the \ncoordinates, if the area enclosed by the ring is on your right-hand side, it has a clockwise winding order; if it is on \nyour left-hand side, it has a counter-clockwise winding order.\n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.6),\n[Example - Exterior](examples/invalid_geometries/invalid_exterior_not_ccw.geojson)\n\n### Interior not clockwise winding order\nThe inner rings (define hole cutouts) of a **Polygon** must be clockwise (often abbreviated cw). For more details also see \nthe \"exterior not ccw\" criterium above. \n[Example - Interior](examples/invalid_geometries/invalid_interior_not_cw.geojson)\n\n### Inner and exterior Polygon rings intersect or cross\nThe inner ring of a **Polygon** must not intersect or cross the exterior ring. Also, no two inner rings may intersect \nor cross each other. The inner and exterior ring, as well as two inner rings may touch only at a single point. \nThis is because the exterior and inner ring of a Polygon bound surfaces.\n[Example](examples/invalid_geometries/invalid_inner_and_exterior_ring_intersect.geojson)\n\n### Incorrect geometry data type\nFor example, a geometry that can be identified as a Polygon by its shape, has the geometry `type` defined as another\ntype, e.g. LineString. Similarly when a single geometry object (e.g., Point, LineString or Polygon) has multiple, disconnected \nparts that should be represented as a MultiPoint, MultiLineString or MultiPolygon.\n[Example](examples/invalid_geometries/invalid_incorrect_geometry_data_type.geojson)\n\n\u003cbr\u003e\n\n## Valid but problematic for some tools/APIs \n\n![](repo_images/valid_problematic.png)\n\n### Coordinate reference system (CRS) defined\nThe GeoJSON specification defines GeoJSON as being in the [WGS84](https://de.wikipedia.org/wiki/World_Geodetic_System_1984)\ncoordinate reference system (CRS) with latitude / longitude decimal coordinates. Thus, the CRS does not need to be\nspecified in the GeoJSON. In older GeoJSON specifications you could define alternative crs (as a \"crs\" key in the FeatureCollection).\nHowever this leads to interoperability issues with many tools/APIs, as they can ignore the crs definition and assume \nlatitude/longitude coordinates (WGS84).\n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-4),\n[Example](examples/problematic_structure/problematic_crs_defined.geojson)\n\n### Holes\nA **Polygon** is allowed to have hole cutouts, this is a feature, not an issue. However, some APIs don't accept\nPolygon geometries with holes as input (e.g. some satellite data providers where the desired area is relevant for\npricing). The holes can be removed by removing the\nPolygon's [inner ring](https://macwright.com/2015/03/23/geojson-second-bite.html#polygons) coordinates. \n[Example](examples/problematic_geometries/problematic_holes.geojson)\n\n### Self-intersection\nHere one or multiple parts of a **Polygon** overlap another part of itself. Often found in complex geometry shapes,\nafter geometry operations without careful cleanup (buffer, raster-to-vector etc.).\nA Polygon is allowed to have self-intersections, this conforms with the GeoJSON specification. However, it frequently\ncauses issues in downstream applications thus is often rejected by APIs and tools.\n\nA common approach for removing the self-intersections is applying a zero-buffer operation (e.g. `.buffer(0)` in\nshapely). This dissolves the overlapping areas and usually is an okay solution for small, undesired self-intersections.\nHowever, especially for larger self-intersections (see example 2) this might lead to unintended changes of the geometry, \nas significant parts of the geometry could be removed by the operation. Here only a manual operation can fix the issue, \nby splitting of the geometry into multiple parts, or adding/removing nodes.\n[Example 1 - Small](examples/problematic_geometries/problematic_self_intersection_small.geojson) \n[Example 2 - Large](examples/problematic_geometries/problematic_self_intersection_large.geojson)\n\n### Duplicate nodes\nExcept the first and last node of a Polygon (see \"unclosed\" rule above), nodes of a **Polygon/LineString** are ideally\nunique.\n[Example](examples/problematic_geometries/problematic_duplicate_nodes.geojson)\n\n### Zero-length LineString\nA **LineString** with identical start and end node coordinates has zero length, which can lead to issues.\n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.4),\n[Example](examples/problematic_geometries/problematic_zero_length_linestring.geojson)\n\n### Excessive coordinate precision\nAlthough not mandatory, the GeoJSON specification recommends a coordinate precision of 6 decimal places. Using more\nthan 6 decimal places may lead to issues with some tools/APIs and unnecessarily increase the file size (6 decimal places\ncorresponds to about 10cm of a GPS).\n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-11.2),\n[Example](examples/problematic_geometries/problematic_excessive_coordinate_precision.geojson)\n\n### Excessive vertices\nSome tools might have an issue with very complex geometries that have many vertices (nodes), e.g. some APIs limit it to \nless than 1000. Even simple geometries can have a high number of nodes, e.g. when a straight line contains additional nodes.\n[Example (1223 vertices)](examples/problematic_geometries/problematic_excessive_vertices.geojson)\n\n### 3D or more coordinates not accepted\nA geometry's nodes/positions/vertices should consist of either two coordinates (order `[longitude, latitude]`) or three\ncoordinates (`[longitude, latitude, elevation]`). Elevation is optional. Some tools and APIs may not accept 3D coordinates.\n\nIn early versions of the GeoJSON specification, it was normal to store more than three coordinates, e.g. storing additional \ninformation like time etc. Technically still allowed but [discouraged](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.1) \nby the current specification, if used in some tools or APIs this may lead to errors or the additional values being ignored. \nThe additional information should now be stored separately in the properties of the feature.\n[Example 1 - 3D coordinates](examples/problematic_geometries/problematic_3d_coordinates.geojson)\n\n### Outside latitude/longitude boundary\nThe most recent GeoJSON specification defines GeoJSON as being in the [WGS84](https://de.wikipedia.org/wiki/World_Geodetic_System_1984)\ncoordinate reference system (CRS) with latitude / longitude decimal coordinates. Latitudes are specified within the range \nof [-90, 90] and longitudes within [-180, 180]. Older GeoJSON specification allowed setting CRS, and using coordinates\nin other coordinate systems is not explicitley forbidden, but leads to interopability issues with many tools.\n[Example](examples/problematic_geometries/problematic_outside_lat_lon_boundaries.geojson)\n\n### Crosses anti-meridian\nA **Polygon/LineString** that extends across the 180th meridian can lead to interoperability issues, and instead\nshould be cut in two as a MultiPolygon or MultiLineString. The anti-meridian goes in vertical direction (north-south), \nthe longitude at this line can be given as either east or west. A geometry crossing it would thus go over it from left to right\nor vice-versa. Also see [\"The 180th Meridian\"](https://macwright.com/2016/09/26/the-180th-meridian.html) by Tom MacWright.\n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.9),\n[Example](examples/problematic_geometries/problematic_crosses_antimeridian.geojson)\n\n### Wrong bounding box coordinate order\nA `bbox` may be defined (but is not required) in the GeoJSON object to summarize the extent on the level of Geometries,\nFeatures, or FeatureCollections. If it is defined, the bbox coordinate order must conform\nto `[west, south, east, north]`.\n[Spec](https://www.rfc-editor.org/rfc/rfc7946#section-3),\n[Example](examples/problematic_geometries/problematic_wrong_bbox_coordinate_order.geojson)\n\n### Multi-type Geometry with just one geometry object\nA **MultiPoint/MultiLineString/MultiPolygon** should represent multiple geometries of the same type\n(e.g. multiple Polygons within a MultiPolygon). While it is not invalid according to the GeoJSON specification, if\na Multi-type object only contains a single geometry object, some tools might complain.\n[Example](examples/problematic_geometries/problematic_multitype_geometry_with_just_one_geometry.geojson)\n\n### Feature has no geometry\nA GeoJSON Feature is allowed to be un-located, meaning it has `null` as a geometry member, see\n[spec](https://www.rfc-editor.org/rfc/rfc7946#section-3.2). But some tools/APIs might expect a geometry and complain.\n[Example](examples/problematic_geometries/problematic_feature_null_geometry.geojson)\n\n### Geometry or Feature not wrapped in a Feature or FeatureCollection\nThe GeoJSON specification allows not wrapping geometry or feature objects in a FeatureCollection,\nsee [spec](https://www.rfc-editor.org/rfc/rfc7946#section-2). Any GeoJSON object on its own is still a valid GeoJSON. \nHowever, some tools might expect a Feature and FeatureCollection and the associated properties.\n\n### Nested GeometryCollections\nWhile a GeometryCollection within a GeometryCollection is allowed, the GeoJSON specification recommends avoiding this to maximize interoparability.\n[Example](examples/problematic_structure/problematic_nested_geometrycollection.geojson)\n\n### GeometryCollection with a single part or only parts of a single type\nGeometryCollections composed of a single part or a number of parts of a single type should be avoided\nwhen that single part or a single object of multipart type (MultiPoint, MultiLineString, or MultiPolygon) could be used instead.\n[Example](examples/problematic_structure/problematic_nested_geometrycollection.geojson)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrieke%2Fgeojson-invalid-geometry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrieke%2Fgeojson-invalid-geometry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrieke%2Fgeojson-invalid-geometry/lists"}