fix: 修正楼宇边界 GeoPackage 几何编码

This commit is contained in:
nixevol
2026-09-21 10:51:44 +08:00
parent 3cacd332b1
commit c7e1777207
2 changed files with 16 additions and 3 deletions
+12
View File
@@ -39,3 +39,15 @@ class NrDataTest(unittest.TestCase):
self.assertEqual(conn.execute("select count(*) from rtree_NRBuildingsData_geom").fetchone()[0], 1)
finally:
conn.close()
def test_build_gpkg_is_idempotent_after_csv_already_contains_wkt(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
polygon = root / "NRBuildPolygon.csv"
data = root / "NRBuildingsData.csv"
output = root / "NRBuildingsData.gpkg"
polygon.write_text("WKT,building_id\n\"POLYGON ((0 0,1 0,1 1,0 0))\",A\n", encoding="utf-8")
data.write_text("building_id,WKT\nA,\"POLYGON ((0 0,1 0,1 1,0 0))\"\n", encoding="utf-8")
build_gpkg(data, polygon, output)
with data.open(encoding="utf-8", newline="") as stream:
self.assertEqual(next(csv.reader(stream)), ["building_id", "WKT"])