feat: 合并 4G 和 5G 为采样点图层
同一市场内中心相距 8 米以内的栅格合成一条,三个采样字段分别相加, 图层放在竞对信号上面。
This commit is contained in:
+21
-2
@@ -164,12 +164,14 @@ class TaskIntegrationTest(unittest.TestCase):
|
||||
def test_parallel_market_settings_reach_spawned_workers(self):
|
||||
a, b = box(112, 22, 112.01, 22.01), box(112.02, 22, 112.03, 22.01)
|
||||
create_gpkg(self.root / "markets.gpkg", "MarketMap", '"Name" text', [(31, a, ["甲"]), (42, b, ["乙"])])
|
||||
fields = list(dict.fromkeys([*config.CSV_SOURCE_FIELDS, config.MOBILE_TOTAL_FIELD, config.MOBILE_WEAK_COVER_FIELD]))
|
||||
fields = list(dict.fromkeys([*config.CSV_SOURCE_FIELDS, config.MOBILE_TOTAL_FIELD, config.MOBILE_WEAK_COVER_FIELD, "mro_total_gd"]))
|
||||
values = {field: 0 for field in fields}
|
||||
values.update(mro_total_yd=100, rsrp_lt_neg105_yd=10, ssb_rsrp_dl=-115, mro_total_dl=0)
|
||||
create_gpkg(self.root / "grid.gpkg", "grid", ','.join(f'"{f}" real' for f in fields),
|
||||
[(1, a, [values[f] for f in fields]), (2, b, [values[f] for f in fields])])
|
||||
create_gpkg(self.root / "grid4.gpkg", "grid4", '"grid20_id" text', [(1, a, ["g1"])])
|
||||
create_gpkg(self.root / "grid4.gpkg", "grid4",
|
||||
'"longitude" real,"latitude" real,"mro_total_dl" real,"mro_total_gd" real,"mro_total_yd" real',
|
||||
[(1, a, [0, 0, 4, 6, 8]), (2, b, [0, 0, 1, 2, 3])])
|
||||
create_gpkg(self.root / "buildings.gpkg", "BuildingInfo", '"name" text,"floor" integer,"height" real', [(1, a, ["建筑甲", 2, 7.8]), (2, b, ["建筑乙", 3, 11.7])])
|
||||
from marketgrid.building_themes import THEMES, ACTIVE_THEMES
|
||||
nr_fields = list(dict.fromkeys(n for t in THEMES for n, _ in t["fields"] if n not in ("floor", "height")))
|
||||
@@ -215,6 +217,23 @@ class TaskIntegrationTest(unittest.TestCase):
|
||||
boundary = next(item for item in xml.iter("layer-tree-layer") if item.get("name") == boundary_name)
|
||||
self.assertEqual(boundary.get("checked"), "Qt::Checked")
|
||||
self.assertIn(boundary_name + ".gpkg", members)
|
||||
self.assertEqual(names[names.index("竞对信号") - 1], "采样点图层")
|
||||
sample_node = next(item for item in xml.iter("layer-tree-layer") if item.get("name") == "采样点图层")
|
||||
self.assertEqual(sample_node.get("checked"), "Qt::Checked")
|
||||
self.assertIn("采样点图层.gpkg", members)
|
||||
sample_path = self.root / f"sample-{name}.gpkg"
|
||||
sample_path.write_bytes(archive.read("采样点图层.gpkg"))
|
||||
sample_conn = sqlite3.connect(sample_path)
|
||||
try:
|
||||
totals = {row[-1] for row in sample_conn.execute('select "mro_total_dl","mro_total_gd","mro_total_yd","总采样点数" from "采样点图层"')}
|
||||
finally:
|
||||
sample_conn.close()
|
||||
if name == "31-甲.zip":
|
||||
self.assertEqual(totals, {118})
|
||||
elif name == "42-乙.zip":
|
||||
self.assertEqual(totals, {106})
|
||||
else:
|
||||
self.assertEqual(totals, {118, 106})
|
||||
if name == "全量网格图层.zip":
|
||||
self.assertNotIn("online", names)
|
||||
expected_count = 2
|
||||
|
||||
Reference in New Issue
Block a user