diff --git a/README.md b/README.md index 129d053..8f796ce 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,7 @@ AOI 在包内 `GIS.qgz` 中使用相对路径引用,默认不勾选。`output/ ### 采样点图层.gpkg -来源:`source/Grid_5G.gpkg` 与 `source/Grid_4G.gpkg`。按当前市场范围筛出栅格后,比较栅格图形中心;相距 8 米以内视为同一个栅格,保留 5G 的图形(没有 5G 时保留 4G)。两边都有的 `mro_total_dl`、`mro_total_gd`、`mro_total_yd` 分别相加,写入 `电联采样点`、`广电采样点`、`移动采样点`,`总采样点数` 是这三个和。不计入 `mro_total_dx`、`mro_total_lt`。属性缺失按 0。`透明度` 按本图层里 `总采样点数` 的名次从 5 到 65:相同数量同一档,最少为 5,最多为 65。样式为红色均匀填充和红色边界,符号不透明度等于该百分比,所以采样点越多颜色越深。工程中放在竞对信号上面,默认勾选。 +来源:`source/Grid_5G.gpkg` 与 `source/Grid_4G.gpkg`。按当前市场范围筛出栅格后,比较栅格图形中心;相距 8 米以内视为同一个栅格,保留 5G 的图形(没有 5G 时保留 4G)。两边都有的 `mro_total_dl`、`mro_total_gd`、`mro_total_yd` 分别相加,写入 `电联采样点`、`广电采样点`、`移动采样点`,`总采样点数` 是这三个和。不计入 `mro_total_dx`、`mro_total_lt`。属性缺失按 0。`rank` 按本图层里 `总采样点数` 的名次从 10 到 70:相同数量同一档,最少为 10,最多为 70。样式为红色均匀填充和红色边界,符号不透明度等于该百分比,所以采样点越多颜色越深。工程中放在竞对信号上面,默认勾选。 ### 竞对信号.tif diff --git a/marketgrid/sample_grid.py b/marketgrid/sample_grid.py index 6867095..864b145 100644 --- a/marketgrid/sample_grid.py +++ b/marketgrid/sample_grid.py @@ -15,9 +15,9 @@ from .raster_math import to_float TABLE = "采样点图层" GEOM = "geom" SRS_ID = 4326 -FIELDS = ("电联采样点", "广电采样点", "移动采样点", "总采样点数", "透明度") -OPACITY_MIN = 5.0 -OPACITY_MAX = 65.0 +FIELDS = ("电联采样点", "广电采样点", "移动采样点", "总采样点数", "rank") +OPACITY_MIN = 10.0 +OPACITY_MAX = 70.0 STYLES = Path(__file__).with_name("styles") WGS84 = ( 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,' @@ -52,7 +52,7 @@ def export_sample_grid(grid_5g_conn, grid_5g_layer, grid_5g_rtree, grid_4g_conn, def opacity_by_total(totals): - """总采样点数的名次映射到 5–65。越多越高,最多为 65;相同数量同一档。""" + """总采样点数的名次映射到 10–70。越多越高,最多为 70;相同数量同一档。""" levels = sorted(set(totals)) if not levels: return {} diff --git a/marketgrid/styles/sample_points.qml b/marketgrid/styles/sample_points.qml index 33d3381..4e3084a 100644 --- a/marketgrid/styles/sample_points.qml +++ b/marketgrid/styles/sample_points.qml @@ -9,7 +9,7 @@ diff --git a/tests/test_sample_grid.py b/tests/test_sample_grid.py index 61ef485..e059b8a 100644 --- a/tests/test_sample_grid.py +++ b/tests/test_sample_grid.py @@ -26,18 +26,18 @@ def _record(lon, lat, dl, gd, yd): class SampleOpacityTests(unittest.TestCase): def test_rank_runs_from_five_to_sixty_five(self): mapping = opacity_by_total([1, 1, 5, 9]) - self.assertEqual(mapping[1], 5) - self.assertEqual(mapping[5], 35) - self.assertEqual(mapping[9], 65) + self.assertEqual(mapping[1], 10) + self.assertEqual(mapping[5], 40) + self.assertEqual(mapping[9], 70) def test_single_total_is_the_darkest(self): - self.assertEqual(opacity_by_total([4, 4]), {4: 65}) + self.assertEqual(opacity_by_total([4, 4]), {4: 70}) def test_style_is_solid_red_using_opacity_percent(self): qml = (Path(__file__).resolve().parents[1] / "marketgrid" / "styles" / "sample_points.qml").read_text(encoding="utf-8") self.assertIn('value="solid"', qml) self.assertIn('value="255,0,0,255"', qml) - self.assertIn('value=""透明度""', qml) + self.assertIn('value=""rank""', qml) class SampleMergeTests(unittest.TestCase): @@ -77,11 +77,11 @@ class SampleMergeTests(unittest.TestCase): conn = sqlite3.connect(root / "采样点图层.gpkg") try: row = conn.execute('select "电联采样点","广电采样点","移动采样点","总采样点数" from "采样点图层"').fetchone() - opacity = conn.execute('select "透明度" from "采样点图层"').fetchone()[0] + opacity = conn.execute('select "rank" from "采样点图层"').fetchone()[0] finally: conn.close() self.assertEqual(row, (14, 7, 108, 129)) - self.assertEqual(opacity, 65) + self.assertEqual(opacity, 70) def test_project_places_checked_sample_layer_above_competitor_signal(self): market = MarketFeature(1, "1-甲", "甲", box(0, 0, 1, 1))