I'm working with a GeoJSON file that represents the area of the United States at 0 feet elevation. However, when I load it into QGIS, a strange diagonal line appears, stretching across the map. This line shouldn't be there, and it's creating a weird shape in the GeoTIFF I’m trying to generate.
Here are some details:
The GeoJSON covers all areas within 0 feet elevation in the U.S. The diagonal line cuts through the middle of the map and distorts the intended shape. I’ve checked the GeoJSON file for obvious issues but couldn’t find anything unusual. What I’ve tried so far:
Loaded the GeoJSON in QGIS and checked for geometry validity using the Check Validity tool – didn’t return any clear issues. Attempted to simplify the geometry to remove any potential rogue vertices – didn’t fix the problem. Manually inspected the GeoJSON file, but nothing stands out. I suspect there might be some invalid geometries or unwanted vertices causing this diagonal line to appear.
Questions: What could be causing this diagonal line to show up in QGIS? Are there any other tools or methods I can use to inspect or fix this GeoJSON? Has anyone encountered this kind of issue before with GeoJSON files and QGIS? Any help would be greatly appreciated!
There are many tools which visualize GeoJSON files, just do a web search for "geojson viewer" and you will get plenty of results. However, all these viewers will show you the same results as QGIS. Thus, it is not a problem of QGIS but of your file.
Opening the file in a text editor, you will see that the GeoJSON is a feature collection with around 15,000 features. There are two large features with more than 10,000 coordinate points, while all other features are small in comparison. When you remove the two large features and visualize the remaining features, you will see outlines of all islands in North America (not just the United States!).
When visualizing the large features, it will become clear that one feature represents the east coast of North America (from Alaska down to Venezuela) while the other shows the west coast (from Alaska down to Columbia). So these are actually lines and not polygons, even if geometry type in the GeoJSON file states it differently.