fix: 修正楼宇边界 GeoPackage 几何编码
This commit is contained in:
@@ -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"])
|
||||
|
||||
Reference in New Issue
Block a user