I am in need of a few shapefiles with bad geometry for testing some Python code. How can I intentionally create bad geometry in a shapefile? Preferably I would be able to create three (point, line, polygon).
1 Answer
You could use QGIS to edit line and polygon shapefiles. Rightclick a shapelayer then "toggle editing". Use the "node tool" to drag lines across each other to cause intersecting(invalid) geometry. Intersecting line points are even highlighted with bright green 'X's.
dd
to sew pieces of files together. You could certainly use Python for the same purpose, but non-conformant shapefiles often invoke undefined behavior rules, which make them exceedingly difficult to test (a valid undefined behavior could include production of a black hole that consumes your server).