overture-schema-theme-divisions 0.1.1.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- overture_schema_theme_divisions-0.1.1.dev0/PKG-INFO +19 -0
- overture_schema_theme_divisions-0.1.1.dev0/README.md +4 -0
- overture_schema_theme_divisions-0.1.1.dev0/pyproject.toml +164 -0
- overture_schema_theme_divisions-0.1.1.dev0/pyproject.toml.orig +164 -0
- overture_schema_theme_divisions-0.1.1.dev0/src/overture/schema/divisions/__init__.py +28 -0
- overture_schema_theme_divisions-0.1.1.dev0/src/overture/schema/divisions/_common.py +115 -0
- overture_schema_theme_divisions-0.1.1.dev0/src/overture/schema/divisions/division.py +418 -0
- overture_schema_theme_divisions-0.1.1.dev0/src/overture/schema/divisions/division_area.py +159 -0
- overture_schema_theme_divisions-0.1.1.dev0/src/overture/schema/divisions/division_boundary.py +222 -0
- overture_schema_theme_divisions-0.1.1.dev0/src/overture/schema/divisions/py.typed +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: overture-schema-theme-divisions
|
|
3
|
+
Version: 0.1.1.dev0
|
|
4
|
+
Summary: Overture Maps divisions theme shared structures, division, division area and division boundary types
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Dist: overture-schema-common>=0.1.1
|
|
7
|
+
Requires-Dist: overture-schema-system>=0.1.1
|
|
8
|
+
Requires-Dist: pydantic>=2.13.0
|
|
9
|
+
Maintainer: Overture Maps Schema Working Group
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Project-URL: Homepage, https://overturemaps.org
|
|
12
|
+
Project-URL: Source, https://github.com/OvertureMaps/schema
|
|
13
|
+
Project-URL: Issues, https://github.com/OvertureMaps/schema/issues
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# Overture Schema Divisions Theme
|
|
17
|
+
|
|
18
|
+
Shared structures and validation logic for Overture Maps divisions theme.
|
|
19
|
+
Contains common place types, administrative hierarchy utilities, and validation patterns.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
dependencies = [
|
|
3
|
+
"overture-schema-common>=0.1.1",
|
|
4
|
+
"overture-schema-system>=0.1.1",
|
|
5
|
+
"pydantic>=2.13.0",
|
|
6
|
+
]
|
|
7
|
+
description = "Overture Maps divisions theme shared structures, division, division area and division boundary types"
|
|
8
|
+
version = "0.1.1.dev0"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
name = "overture-schema-theme-divisions"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
|
|
14
|
+
[[project.maintainers]]
|
|
15
|
+
name = "Overture Maps Schema Working Group"
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://overturemaps.org"
|
|
19
|
+
Source = "https://github.com/OvertureMaps/schema"
|
|
20
|
+
Issues = "https://github.com/OvertureMaps/schema/issues"
|
|
21
|
+
|
|
22
|
+
[project.entry-points."overture.models"]
|
|
23
|
+
division = "overture.schema.divisions:Division"
|
|
24
|
+
division_area = "overture.schema.divisions:DivisionArea"
|
|
25
|
+
division_boundary = "overture.schema.divisions:DivisionBoundary"
|
|
26
|
+
|
|
27
|
+
[project.entry-points.pytest11]
|
|
28
|
+
overture_baselines = "overture.schema.system.testing.plugin"
|
|
29
|
+
|
|
30
|
+
[tool.uv.sources.overture-schema-common]
|
|
31
|
+
workspace = true
|
|
32
|
+
|
|
33
|
+
[tool.uv.sources.overture-schema-system]
|
|
34
|
+
workspace = true
|
|
35
|
+
|
|
36
|
+
[tool.uv.build-backend]
|
|
37
|
+
module-name = "overture.schema.divisions"
|
|
38
|
+
|
|
39
|
+
[build-system]
|
|
40
|
+
requires = ["uv_build>=0.11.32,<0.13"]
|
|
41
|
+
build-backend = "uv_build"
|
|
42
|
+
|
|
43
|
+
[[examples.Division]]
|
|
44
|
+
admin_level = 2
|
|
45
|
+
capital_division_ids = ["958c67d3-868a-482d-9dd8-1c65b0c1a9e8"]
|
|
46
|
+
country = "US"
|
|
47
|
+
geometry = "POINT (-159.4945109 22.0557204)"
|
|
48
|
+
hierarchies = [[
|
|
49
|
+
{ division_id = "f39eb4af-5206-481b-b19e-bd784ded3f05", subtype = "country", name = "United States" },
|
|
50
|
+
{ division_id = "a2a08395-e968-4be5-bdd7-7f63db8c2165", subtype = "region", name = "Hawaii" },
|
|
51
|
+
{ division_id = "c9b8adc9-4639-4392-8efe-8401eeb19929", subtype = "county", name = "Kauaʻi County" },
|
|
52
|
+
]]
|
|
53
|
+
id = "c9b8adc9-4639-4392-8efe-8401eeb19929"
|
|
54
|
+
parent_division_id = "a2a08395-e968-4be5-bdd7-7f63db8c2165"
|
|
55
|
+
population = 71735
|
|
56
|
+
region = "US-HI"
|
|
57
|
+
subtype = "county"
|
|
58
|
+
theme = "divisions"
|
|
59
|
+
type = "division"
|
|
60
|
+
version = 5
|
|
61
|
+
wikidata = "Q111517"
|
|
62
|
+
|
|
63
|
+
[examples.Division.bbox]
|
|
64
|
+
xmax = -159.4945068359375
|
|
65
|
+
xmin = -159.49453735351563
|
|
66
|
+
ymax = 22.055721282958984
|
|
67
|
+
ymin = 22.05571746826172
|
|
68
|
+
|
|
69
|
+
[[examples.Division.sources]]
|
|
70
|
+
dataset = "OpenStreetMap"
|
|
71
|
+
license = "ODbL-1.0"
|
|
72
|
+
property = ""
|
|
73
|
+
record_id = "r166560@15"
|
|
74
|
+
update_time = "2025-08-16T14:25:55Z"
|
|
75
|
+
|
|
76
|
+
[examples.Division.names]
|
|
77
|
+
primary = "Kauaʻi County"
|
|
78
|
+
|
|
79
|
+
[examples.Division.names.common]
|
|
80
|
+
haw = "kalana Kauaʻi"
|
|
81
|
+
|
|
82
|
+
[[examples.Division.names.rules]]
|
|
83
|
+
value = "Kauai County"
|
|
84
|
+
variant = "alternate"
|
|
85
|
+
|
|
86
|
+
[examples.Division.local_type]
|
|
87
|
+
en = "county"
|
|
88
|
+
|
|
89
|
+
[[examples.DivisionArea]]
|
|
90
|
+
admin_level = 2
|
|
91
|
+
class = "land"
|
|
92
|
+
country = "US"
|
|
93
|
+
division_id = "c9b8adc9-4639-4392-8efe-8401eeb19929"
|
|
94
|
+
geometry = "MULTIPOLYGON (((-160.5408313 21.6535414, -160.544491 21.6514764, -160.5369253 21.6495783, -160.5408313 21.6535414)), ((-160.0921364 22.005401, -160.1251483 21.9547066, -160.2260792 21.8900136, -160.2470031 21.841157, -160.2339532 21.7921394, -160.2022486 21.7794359, -160.1588705 21.864646, -160.0737812 21.8957962, -160.0826438 21.9302968, -160.05025 21.9848306, -160.0921364 22.005401)), ((-160.0881165 22.0243325, -160.1005193 22.0287469, -160.1026828 22.0166419, -160.0881165 22.0243325)), ((-159.7508422 21.9762242, -159.6679712 21.9531973, -159.604686 21.8923573, -159.5913126 21.9041661, -159.443465 21.8684403, -159.3461084 21.9373297, -159.3624768 21.952083, -159.3309486 21.9590284, -159.3357151 22.0450997, -159.2964497 22.1053479, -159.2926896 22.1434001, -159.335189 22.2040351, -159.4024533 22.2327054, -159.4282799 22.2164343, -159.4864746 22.2298148, -159.5060386 22.2031539, -159.5808829 22.2237075, -159.7228708 22.1497995, -159.7443872 22.099889, -159.7826601 22.0669155, -159.7849578 22.0149525, -159.7508422 21.9762242)))"
|
|
95
|
+
id = "109cfa53-bb13-4e37-aeb0-14f9a08c737d"
|
|
96
|
+
is_land = true
|
|
97
|
+
is_territorial = false
|
|
98
|
+
region = "US-HI"
|
|
99
|
+
subtype = "county"
|
|
100
|
+
theme = "divisions"
|
|
101
|
+
type = "division_area"
|
|
102
|
+
version = 7
|
|
103
|
+
|
|
104
|
+
[examples.DivisionArea.bbox]
|
|
105
|
+
xmax = -159.29266357421875
|
|
106
|
+
xmin = -160.54449462890625
|
|
107
|
+
ymax = 22.23270606994629
|
|
108
|
+
ymin = 21.649578094482422
|
|
109
|
+
|
|
110
|
+
[[examples.DivisionArea.sources]]
|
|
111
|
+
dataset = "OpenStreetMap"
|
|
112
|
+
license = "ODbL-1.0"
|
|
113
|
+
property = ""
|
|
114
|
+
record_id = "r166560@15"
|
|
115
|
+
update_time = "2025-08-16T14:25:55Z"
|
|
116
|
+
|
|
117
|
+
[examples.DivisionArea.names]
|
|
118
|
+
primary = "Kauaʻi County"
|
|
119
|
+
|
|
120
|
+
[examples.DivisionArea.names.common]
|
|
121
|
+
haw = "kalana Kauaʻi"
|
|
122
|
+
|
|
123
|
+
[[examples.DivisionArea.names.rules]]
|
|
124
|
+
value = "Kauai County"
|
|
125
|
+
variant = "alternate"
|
|
126
|
+
|
|
127
|
+
[[examples.DivisionBoundary]]
|
|
128
|
+
admin_level = 2
|
|
129
|
+
class = "land"
|
|
130
|
+
country = "US"
|
|
131
|
+
division_ids = [
|
|
132
|
+
"a546a5ef-ba43-44ce-a7c3-1999b005b20f",
|
|
133
|
+
"0554d43c-de68-433c-9a6c-db58161c8b4a",
|
|
134
|
+
]
|
|
135
|
+
geometry = "LINESTRING (-157.0195397035514 21.183903480793326, -157.0201257 21.180663, -157.0084983 21.1786971, -157.0053877 21.1769627, -157.0060747 21.1738084, -157.0003054 21.1722773, -156.9809248 21.1746356, -156.9710241 21.172431, -156.9670723 21.1613703, -156.9550334 21.1531141, -156.9552315 21.1564667, -156.9607515 21.1621168, -156.9584334 21.162083, -156.9598705 21.1636745, -156.958371 21.1708964, -156.9602176 21.1762534, -156.9577173 21.1760764, -156.9556416 21.1715505, -156.9554893 21.157221, -156.9528625 21.1523977, -156.9442066 21.1504038, -156.9389218 21.1568278, -156.938089 21.1530661, -156.9348977 21.15157, -156.9283241 21.1419085, -156.9262384 21.1360023, -156.9186457 21.1279636, -156.9124605 21.1262614, -156.8975854 21.1285336, -156.8979892 21.1337635, -156.8958138 21.1376515, -156.8970853 21.1421243, -156.8929598 21.1451006, -156.8928438 21.1467406, -156.897116 21.1457141, -156.9036748 21.1485179, -156.9059125 21.1527496, -156.910528 21.1563906, -156.917332 21.1590391, -156.9140393 21.1691869)"
|
|
136
|
+
id = "321ed3ec-23c2-376e-a4fd-0df484cb99ca"
|
|
137
|
+
is_disputed = false
|
|
138
|
+
is_land = true
|
|
139
|
+
is_territorial = false
|
|
140
|
+
region = "US-HI"
|
|
141
|
+
subtype = "county"
|
|
142
|
+
theme = "divisions"
|
|
143
|
+
type = "division_boundary"
|
|
144
|
+
version = 2
|
|
145
|
+
|
|
146
|
+
[examples.DivisionBoundary.bbox]
|
|
147
|
+
xmax = -156.89283752441406
|
|
148
|
+
xmin = -157.02012634277344
|
|
149
|
+
ymax = 21.18390655517578
|
|
150
|
+
ymin = 21.12626075744629
|
|
151
|
+
|
|
152
|
+
[[examples.DivisionBoundary.sources]]
|
|
153
|
+
dataset = "OpenStreetMap"
|
|
154
|
+
license = "ODbL-1.0"
|
|
155
|
+
property = ""
|
|
156
|
+
record_id = "r166564@15"
|
|
157
|
+
update_time = "2025-02-21T16:35:23Z"
|
|
158
|
+
|
|
159
|
+
[[examples.DivisionBoundary.sources]]
|
|
160
|
+
dataset = "OpenStreetMap"
|
|
161
|
+
license = "ODbL-1.0"
|
|
162
|
+
property = ""
|
|
163
|
+
record_id = "r166561@26"
|
|
164
|
+
update_time = "2025-08-16T14:01:24Z"
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
maintainers = [
|
|
3
|
+
{ name = "Overture Maps Schema Working Group" },
|
|
4
|
+
]
|
|
5
|
+
dependencies = [
|
|
6
|
+
"overture-schema-common>=0.1.1",
|
|
7
|
+
"overture-schema-system>=0.1.1",
|
|
8
|
+
"pydantic>=2.13.0",
|
|
9
|
+
]
|
|
10
|
+
description = "Overture Maps divisions theme shared structures, division, division area and division boundary types"
|
|
11
|
+
version = "0.1.1.dev0"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
name = "overture-schema-theme-divisions"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://overturemaps.org"
|
|
19
|
+
Source = "https://github.com/OvertureMaps/schema"
|
|
20
|
+
Issues = "https://github.com/OvertureMaps/schema/issues"
|
|
21
|
+
|
|
22
|
+
[tool.uv.sources]
|
|
23
|
+
overture-schema-common = { workspace = true }
|
|
24
|
+
overture-schema-system = { workspace = true }
|
|
25
|
+
|
|
26
|
+
[build-system]
|
|
27
|
+
requires = ["uv_build>=0.11.32,<0.13"]
|
|
28
|
+
build-backend = "uv_build"
|
|
29
|
+
|
|
30
|
+
[tool.uv.build-backend]
|
|
31
|
+
module-name = "overture.schema.divisions"
|
|
32
|
+
|
|
33
|
+
[project.entry-points."overture.models"]
|
|
34
|
+
division = "overture.schema.divisions:Division"
|
|
35
|
+
division_area = "overture.schema.divisions:DivisionArea"
|
|
36
|
+
division_boundary = "overture.schema.divisions:DivisionBoundary"
|
|
37
|
+
|
|
38
|
+
[project.entry-points.pytest11]
|
|
39
|
+
overture_baselines = "overture.schema.system.testing.plugin"
|
|
40
|
+
|
|
41
|
+
[[examples.Division]]
|
|
42
|
+
admin_level = 2
|
|
43
|
+
capital_division_ids = ["958c67d3-868a-482d-9dd8-1c65b0c1a9e8"]
|
|
44
|
+
country = "US"
|
|
45
|
+
geometry = "POINT (-159.4945109 22.0557204)"
|
|
46
|
+
hierarchies = [
|
|
47
|
+
[
|
|
48
|
+
{ division_id = "f39eb4af-5206-481b-b19e-bd784ded3f05", subtype = "country", name = "United States" },
|
|
49
|
+
{ division_id = "a2a08395-e968-4be5-bdd7-7f63db8c2165", subtype = "region", name = "Hawaii" },
|
|
50
|
+
{ division_id = "c9b8adc9-4639-4392-8efe-8401eeb19929", subtype = "county", name = "Kauaʻi County" },
|
|
51
|
+
],
|
|
52
|
+
]
|
|
53
|
+
id = "c9b8adc9-4639-4392-8efe-8401eeb19929"
|
|
54
|
+
parent_division_id = "a2a08395-e968-4be5-bdd7-7f63db8c2165"
|
|
55
|
+
population = 71735
|
|
56
|
+
region = "US-HI"
|
|
57
|
+
subtype = "county"
|
|
58
|
+
theme = "divisions"
|
|
59
|
+
type = "division"
|
|
60
|
+
version = 5
|
|
61
|
+
wikidata = "Q111517"
|
|
62
|
+
|
|
63
|
+
[examples.Division.bbox]
|
|
64
|
+
xmax = -159.4945068359375
|
|
65
|
+
xmin = -159.49453735351562
|
|
66
|
+
ymax = 22.055721282958984
|
|
67
|
+
ymin = 22.05571746826172
|
|
68
|
+
|
|
69
|
+
[[examples.Division.sources]]
|
|
70
|
+
dataset = "OpenStreetMap"
|
|
71
|
+
license = "ODbL-1.0"
|
|
72
|
+
property = ""
|
|
73
|
+
record_id = "r166560@15"
|
|
74
|
+
update_time = "2025-08-16T14:25:55Z"
|
|
75
|
+
|
|
76
|
+
[examples.Division.names]
|
|
77
|
+
primary = "Kauaʻi County"
|
|
78
|
+
|
|
79
|
+
[examples.Division.names.common]
|
|
80
|
+
haw = "kalana Kauaʻi"
|
|
81
|
+
|
|
82
|
+
[[examples.Division.names.rules]]
|
|
83
|
+
value = "Kauai County"
|
|
84
|
+
variant = "alternate"
|
|
85
|
+
|
|
86
|
+
[examples.Division.local_type]
|
|
87
|
+
en = "county"
|
|
88
|
+
|
|
89
|
+
[[examples.DivisionArea]]
|
|
90
|
+
admin_level = 2
|
|
91
|
+
class = "land"
|
|
92
|
+
country = "US"
|
|
93
|
+
division_id = "c9b8adc9-4639-4392-8efe-8401eeb19929"
|
|
94
|
+
geometry = "MULTIPOLYGON (((-160.5408313 21.6535414, -160.544491 21.6514764, -160.5369253 21.6495783, -160.5408313 21.6535414)), ((-160.0921364 22.005401, -160.1251483 21.9547066, -160.2260792 21.8900136, -160.2470031 21.841157, -160.2339532 21.7921394, -160.2022486 21.7794359, -160.1588705 21.864646, -160.0737812 21.8957962, -160.0826438 21.9302968, -160.05025 21.9848306, -160.0921364 22.005401)), ((-160.0881165 22.0243325, -160.1005193 22.0287469, -160.1026828 22.0166419, -160.0881165 22.0243325)), ((-159.7508422 21.9762242, -159.6679712 21.9531973, -159.604686 21.8923573, -159.5913126 21.9041661, -159.443465 21.8684403, -159.3461084 21.9373297, -159.3624768 21.952083, -159.3309486 21.9590284, -159.3357151 22.0450997, -159.2964497 22.1053479, -159.2926896 22.1434001, -159.335189 22.2040351, -159.4024533 22.2327054, -159.4282799 22.2164343, -159.4864746 22.2298148, -159.5060386 22.2031539, -159.5808829 22.2237075, -159.7228708 22.1497995, -159.7443872 22.099889, -159.7826601 22.0669155, -159.7849578 22.0149525, -159.7508422 21.9762242)))"
|
|
95
|
+
id = "109cfa53-bb13-4e37-aeb0-14f9a08c737d"
|
|
96
|
+
is_land = true
|
|
97
|
+
is_territorial = false
|
|
98
|
+
region = "US-HI"
|
|
99
|
+
subtype = "county"
|
|
100
|
+
theme = "divisions"
|
|
101
|
+
type = "division_area"
|
|
102
|
+
version = 7
|
|
103
|
+
|
|
104
|
+
[examples.DivisionArea.bbox]
|
|
105
|
+
xmax = -159.29266357421875
|
|
106
|
+
xmin = -160.54449462890625
|
|
107
|
+
ymax = 22.23270606994629
|
|
108
|
+
ymin = 21.649578094482422
|
|
109
|
+
|
|
110
|
+
[[examples.DivisionArea.sources]]
|
|
111
|
+
dataset = "OpenStreetMap"
|
|
112
|
+
license = "ODbL-1.0"
|
|
113
|
+
property = ""
|
|
114
|
+
record_id = "r166560@15"
|
|
115
|
+
update_time = "2025-08-16T14:25:55Z"
|
|
116
|
+
|
|
117
|
+
[examples.DivisionArea.names]
|
|
118
|
+
primary = "Kauaʻi County"
|
|
119
|
+
|
|
120
|
+
[examples.DivisionArea.names.common]
|
|
121
|
+
haw = "kalana Kauaʻi"
|
|
122
|
+
|
|
123
|
+
[[examples.DivisionArea.names.rules]]
|
|
124
|
+
value = "Kauai County"
|
|
125
|
+
variant = "alternate"
|
|
126
|
+
|
|
127
|
+
[[examples.DivisionBoundary]]
|
|
128
|
+
admin_level = 2
|
|
129
|
+
class = "land"
|
|
130
|
+
country = "US"
|
|
131
|
+
division_ids = [
|
|
132
|
+
"a546a5ef-ba43-44ce-a7c3-1999b005b20f",
|
|
133
|
+
"0554d43c-de68-433c-9a6c-db58161c8b4a",
|
|
134
|
+
]
|
|
135
|
+
geometry = "LINESTRING (-157.0195397035514 21.183903480793326, -157.0201257 21.180663, -157.0084983 21.1786971, -157.0053877 21.1769627, -157.0060747 21.1738084, -157.0003054 21.1722773, -156.9809248 21.1746356, -156.9710241 21.172431, -156.9670723 21.1613703, -156.9550334 21.1531141, -156.9552315 21.1564667, -156.9607515 21.1621168, -156.9584334 21.162083, -156.9598705 21.1636745, -156.958371 21.1708964, -156.9602176 21.1762534, -156.9577173 21.1760764, -156.9556416 21.1715505, -156.9554893 21.157221, -156.9528625 21.1523977, -156.9442066 21.1504038, -156.9389218 21.1568278, -156.938089 21.1530661, -156.9348977 21.15157, -156.9283241 21.1419085, -156.9262384 21.1360023, -156.9186457 21.1279636, -156.9124605 21.1262614, -156.8975854 21.1285336, -156.8979892 21.1337635, -156.8958138 21.1376515, -156.8970853 21.1421243, -156.8929598 21.1451006, -156.8928438 21.1467406, -156.897116 21.1457141, -156.9036748 21.1485179, -156.9059125 21.1527496, -156.910528 21.1563906, -156.917332 21.1590391, -156.9140393 21.1691869)"
|
|
136
|
+
id = "321ed3ec-23c2-376e-a4fd-0df484cb99ca"
|
|
137
|
+
is_disputed = false
|
|
138
|
+
is_land = true
|
|
139
|
+
is_territorial = false
|
|
140
|
+
region = "US-HI"
|
|
141
|
+
subtype = "county"
|
|
142
|
+
theme = "divisions"
|
|
143
|
+
type = "division_boundary"
|
|
144
|
+
version = 2
|
|
145
|
+
|
|
146
|
+
[examples.DivisionBoundary.bbox]
|
|
147
|
+
xmax = -156.89283752441406
|
|
148
|
+
xmin = -157.02012634277344
|
|
149
|
+
ymax = 21.18390655517578
|
|
150
|
+
ymin = 21.12626075744629
|
|
151
|
+
|
|
152
|
+
[[examples.DivisionBoundary.sources]]
|
|
153
|
+
dataset = "OpenStreetMap"
|
|
154
|
+
license = "ODbL-1.0"
|
|
155
|
+
property = ""
|
|
156
|
+
record_id = "r166564@15"
|
|
157
|
+
update_time = "2025-02-21T16:35:23Z"
|
|
158
|
+
|
|
159
|
+
[[examples.DivisionBoundary.sources]]
|
|
160
|
+
dataset = "OpenStreetMap"
|
|
161
|
+
license = "ODbL-1.0"
|
|
162
|
+
property = ""
|
|
163
|
+
record_id = "r166561@26"
|
|
164
|
+
update_time = "2025-08-16T14:01:24Z"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Divisions theme.
|
|
2
|
+
|
|
3
|
+
Administrative and political divisions representing human settlements at various scales,
|
|
4
|
+
with point, area, and boundary geometries.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
|
|
8
|
+
|
|
9
|
+
from ._common import AdminLevel, DivisionSubtype
|
|
10
|
+
from .division import CapitalOfDivisionItem, Division, DivisionClass, Norms
|
|
11
|
+
from .division_area import AreaClass, DivisionArea
|
|
12
|
+
from .division_boundary import BoundaryClass, DivisionBoundary
|
|
13
|
+
|
|
14
|
+
# Exclude from `__all__`: internal implementation details, and types that are effectively annotated
|
|
15
|
+
# primitives, such as `AdminLevel`, where a person working with one of the feature types likely
|
|
16
|
+
# would not need to import that type because they'll just set the field to a Python primitive value
|
|
17
|
+
# directly. (e.g., `my_division.admin_level = 4`).
|
|
18
|
+
__all__ = [
|
|
19
|
+
"AreaClass",
|
|
20
|
+
"BoundaryClass",
|
|
21
|
+
"CapitalOfDivisionItem",
|
|
22
|
+
"Division",
|
|
23
|
+
"DivisionArea",
|
|
24
|
+
"DivisionBoundary",
|
|
25
|
+
"DivisionClass",
|
|
26
|
+
"DivisionSubtype",
|
|
27
|
+
"Norms",
|
|
28
|
+
]
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import textwrap
|
|
2
|
+
from typing import Annotated, NewType
|
|
3
|
+
|
|
4
|
+
from pydantic import Field
|
|
5
|
+
|
|
6
|
+
from overture.schema.system.doc import DocumentedEnum
|
|
7
|
+
from overture.schema.system.model_constraint import FieldEqCondition
|
|
8
|
+
from overture.schema.system.numeric import int32
|
|
9
|
+
|
|
10
|
+
AdminLevel = NewType(
|
|
11
|
+
"AdminLevel",
|
|
12
|
+
Annotated[
|
|
13
|
+
int32,
|
|
14
|
+
Field(
|
|
15
|
+
description=textwrap.dedent("""
|
|
16
|
+
Integer representing the division's position in its country's administrative
|
|
17
|
+
hierarchy, where lower numbers correspond to higher level administrative units.
|
|
18
|
+
""").strip(),
|
|
19
|
+
ge=0,
|
|
20
|
+
le=16,
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class DivisionSubtype(str, DocumentedEnum):
|
|
27
|
+
"""
|
|
28
|
+
Category of the division from a finite, hierarchical, ordered list of categories (e.g., country,
|
|
29
|
+
region, locality, etc.) similar to a Who's on First placetype.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
COUNTRY = (
|
|
33
|
+
"country",
|
|
34
|
+
"Largest unit of independent sovereignty, e.g., the United States, France.",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
DEPENDENCY = (
|
|
38
|
+
"dependency",
|
|
39
|
+
textwrap.dedent("""
|
|
40
|
+
A place that is not exactly a sub-region of a country but is dependent on a parent
|
|
41
|
+
country for defence, passport control, etc., e.g., Puerto Rico.
|
|
42
|
+
""").strip(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
MACROREGION = (
|
|
46
|
+
"macroregion",
|
|
47
|
+
textwrap.dedent("""
|
|
48
|
+
A bundle of regions, e.g., England, Scotland, Île-de-France. These exist mainly in
|
|
49
|
+
Europe.
|
|
50
|
+
""").strip(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
REGION = (
|
|
54
|
+
"region",
|
|
55
|
+
textwrap.dedent("""
|
|
56
|
+
A state, province, region, etc. Largest sub-country administrative unit in most
|
|
57
|
+
countries, except those that have dependencies or macro-regions.
|
|
58
|
+
""").strip(),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
MACROCOUNTY = (
|
|
62
|
+
"macrocounty",
|
|
63
|
+
"A bundle of counties, e.g. Inverness. These exist mainly in Europe.",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
COUNTY = (
|
|
67
|
+
"county",
|
|
68
|
+
textwrap.dedent("""
|
|
69
|
+
Largest sub-region administrative unit in most countries, unless they have
|
|
70
|
+
macrocounties.
|
|
71
|
+
""").strip(),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
LOCALADMIN = (
|
|
75
|
+
"localadmin",
|
|
76
|
+
textwrap.dedent("""
|
|
77
|
+
An administrative unit existing in some parts of the world that contains localities
|
|
78
|
+
or populated places, e.g. département de Paris. Often the contained places do not
|
|
79
|
+
have independent authority. Often, but not exclusively, found in Europe.
|
|
80
|
+
""").strip(),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
LOCALITY = (
|
|
84
|
+
"locality",
|
|
85
|
+
"A populated place that may or may not have its own administrative authority.",
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
BOROUGH = (
|
|
89
|
+
"borough",
|
|
90
|
+
"A local government unit subordinate to a locality.",
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
MACROHOOD = (
|
|
94
|
+
"macrohood",
|
|
95
|
+
textwrap.dedent("""
|
|
96
|
+
A super-neighborhood that contains smaller divisions of type neighborhood, e.g.
|
|
97
|
+
BoCaCa (Boerum Hill, Cobble Hill, and Carroll Gardens).
|
|
98
|
+
""").strip(),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
NEIGHBORHOOD = (
|
|
102
|
+
"neighborhood",
|
|
103
|
+
textwrap.dedent("""
|
|
104
|
+
A neighborhood. Most neighborhoods will be just this, unless there's enough granular
|
|
105
|
+
detail to justify introducing macrohood or microhood divisions.
|
|
106
|
+
""").strip(),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
MICROHOOD = (
|
|
110
|
+
"microhood",
|
|
111
|
+
"A mini-neighborhood that is contained within a division of type neighborhood.",
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
IS_COUNTRY = FieldEqCondition("subtype", DivisionSubtype.COUNTRY)
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The `Division` feature type model and supporting types.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import textwrap
|
|
8
|
+
from typing import Annotated, Literal, NewType
|
|
9
|
+
|
|
10
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
11
|
+
|
|
12
|
+
from overture.schema.common import (
|
|
13
|
+
OvertureFeature,
|
|
14
|
+
)
|
|
15
|
+
from overture.schema.common.cartography import CartographicallyHinted
|
|
16
|
+
from overture.schema.common.names import CommonNames, Named, Names
|
|
17
|
+
from overture.schema.common.perspectives import (
|
|
18
|
+
Perspectives,
|
|
19
|
+
)
|
|
20
|
+
from overture.schema.common.scoping.side import Side
|
|
21
|
+
from overture.schema.system.doc import DocumentedEnum
|
|
22
|
+
from overture.schema.system.field_constraint import (
|
|
23
|
+
UniqueItemsConstraint,
|
|
24
|
+
)
|
|
25
|
+
from overture.schema.system.geometric import (
|
|
26
|
+
Geometry,
|
|
27
|
+
GeometryType,
|
|
28
|
+
GeometryTypeConstraint,
|
|
29
|
+
)
|
|
30
|
+
from overture.schema.system.model_constraint import (
|
|
31
|
+
FieldEqCondition,
|
|
32
|
+
forbid_if,
|
|
33
|
+
no_extra_fields,
|
|
34
|
+
require_if,
|
|
35
|
+
)
|
|
36
|
+
from overture.schema.system.numeric import int32
|
|
37
|
+
from overture.schema.system.ref import Id, Reference, Relationship
|
|
38
|
+
from overture.schema.system.string import (
|
|
39
|
+
CountryCodeAlpha2,
|
|
40
|
+
RegionCode,
|
|
41
|
+
StrippedString,
|
|
42
|
+
WikidataId,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
from ._common import (
|
|
46
|
+
IS_COUNTRY,
|
|
47
|
+
AdminLevel,
|
|
48
|
+
DivisionSubtype,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@no_extra_fields
|
|
53
|
+
class Norms(BaseModel):
|
|
54
|
+
"""Local norms and standards."""
|
|
55
|
+
|
|
56
|
+
# Optional
|
|
57
|
+
|
|
58
|
+
driving_side: Annotated[
|
|
59
|
+
Side | None,
|
|
60
|
+
Field(
|
|
61
|
+
description="Side of the road on which vehicles drive in the division.",
|
|
62
|
+
),
|
|
63
|
+
] = None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class DivisionClass(str, DocumentedEnum):
|
|
67
|
+
"""
|
|
68
|
+
Further classification of a division that is more specific than its `subtype`.
|
|
69
|
+
|
|
70
|
+
A division's `class` adds detail to the broad classification found in `DivisionSubtype`.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
MEGACITY = (
|
|
74
|
+
"megacity",
|
|
75
|
+
textwrap.dedent("""
|
|
76
|
+
A very large city or metropolitan area, typically having a population of 10 million or
|
|
77
|
+
more. Example: Tokyo, Japan.
|
|
78
|
+
""").strip(),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
CITY = (
|
|
82
|
+
"city",
|
|
83
|
+
"A large, permanent human settlement. Example: Guadalajara, Mexico.",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
TOWN = (
|
|
87
|
+
"town",
|
|
88
|
+
textwrap.dedent("""
|
|
89
|
+
A medium-sized permanent human settlement that is smaller than a city, but larger than a
|
|
90
|
+
village. Example: Walldürn, Germany.
|
|
91
|
+
""").strip(),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
VILLAGE = (
|
|
95
|
+
"village",
|
|
96
|
+
textwrap.dedent("""
|
|
97
|
+
A smallish permanent human settlement that is smaller than a town, but larger than a
|
|
98
|
+
hamlet. Example: Wadi El Karm, Lebanon.
|
|
99
|
+
""").strip(),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
HAMLET = (
|
|
103
|
+
"hamlet",
|
|
104
|
+
"A very small, isolated human settlement in a rural area. Example: Tjarnabyggð, Iceland.",
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@no_extra_fields
|
|
109
|
+
class CapitalOfDivisionItem(BaseModel):
|
|
110
|
+
"""A division of which the owning division is the capital, together with its subtype."""
|
|
111
|
+
|
|
112
|
+
model_config = ConfigDict(frozen=True)
|
|
113
|
+
|
|
114
|
+
# Required
|
|
115
|
+
|
|
116
|
+
division_id: Annotated[
|
|
117
|
+
Id,
|
|
118
|
+
Field(description="ID of the division whose capital is the current division."),
|
|
119
|
+
Reference(Relationship.HIERARCHY, Division, role="capital_of"),
|
|
120
|
+
]
|
|
121
|
+
subtype: DivisionSubtype
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@no_extra_fields
|
|
125
|
+
class HierarchyItem(BaseModel):
|
|
126
|
+
"""One division in a hierarchy."""
|
|
127
|
+
|
|
128
|
+
model_config = ConfigDict(frozen=True)
|
|
129
|
+
|
|
130
|
+
# Required
|
|
131
|
+
|
|
132
|
+
division_id: Annotated[
|
|
133
|
+
Id,
|
|
134
|
+
Field(
|
|
135
|
+
description=textwrap.dedent("""
|
|
136
|
+
ID of a division that is an ancestor of the current division.
|
|
137
|
+
|
|
138
|
+
In the context of division hierarchies, the ancestor divisions of a division include
|
|
139
|
+
the division itself, and any other division that is an ancestor of the division's parent.
|
|
140
|
+
""").strip()
|
|
141
|
+
),
|
|
142
|
+
Reference(Relationship.HIERARCHY, Division, role="descendant_of"),
|
|
143
|
+
]
|
|
144
|
+
subtype: DivisionSubtype
|
|
145
|
+
name: Annotated[
|
|
146
|
+
StrippedString, Field(min_length=1, description="Primary name of the division")
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
Hierarchy = NewType(
|
|
151
|
+
"Hierarchy",
|
|
152
|
+
Annotated[
|
|
153
|
+
list[HierarchyItem],
|
|
154
|
+
Field(
|
|
155
|
+
min_length=1,
|
|
156
|
+
description=textwrap.dedent("""
|
|
157
|
+
A hierarchy of divisions, with the first entry being a country; each subsequent
|
|
158
|
+
entry, if any, being a division that is a direct child of the previous entry; and
|
|
159
|
+
the last entry representing the division that contains the hierarchy.
|
|
160
|
+
|
|
161
|
+
For example, a hierarchy for the United States is simply [United States]. A
|
|
162
|
+
hierarchy for the U.S. state of New Hampshire would be
|
|
163
|
+
[United States, New Hampshire], and a hierarchy for the city of Concord, NH would be
|
|
164
|
+
[United States, New Hampshire, Merrimack County, Concord].
|
|
165
|
+
""").strip(),
|
|
166
|
+
),
|
|
167
|
+
UniqueItemsConstraint(),
|
|
168
|
+
],
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@forbid_if(["parent_division_id"], IS_COUNTRY)
|
|
173
|
+
@require_if(["parent_division_id"], ~IS_COUNTRY)
|
|
174
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.COUNTRY))
|
|
175
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.DEPENDENCY))
|
|
176
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.MACROREGION))
|
|
177
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.REGION))
|
|
178
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.MACROCOUNTY))
|
|
179
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.COUNTY))
|
|
180
|
+
class Division(
|
|
181
|
+
OvertureFeature[Literal["divisions"], Literal["division"]],
|
|
182
|
+
Named,
|
|
183
|
+
CartographicallyHinted,
|
|
184
|
+
):
|
|
185
|
+
"""
|
|
186
|
+
Divisions are recognized official or non-official organizations of people as seen from a given
|
|
187
|
+
political perspective.
|
|
188
|
+
|
|
189
|
+
Examples include countries, provinces, cities, towns, neighborhoods, etc.
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
model_config = ConfigDict(title="division")
|
|
193
|
+
|
|
194
|
+
# Core
|
|
195
|
+
geometry: Annotated[
|
|
196
|
+
Geometry,
|
|
197
|
+
GeometryTypeConstraint(GeometryType.POINT),
|
|
198
|
+
Field(
|
|
199
|
+
description=textwrap.dedent("""
|
|
200
|
+
Approximate location of a position commonly associated with the real-world entity
|
|
201
|
+
modeled by the division feature.
|
|
202
|
+
""").strip(),
|
|
203
|
+
),
|
|
204
|
+
]
|
|
205
|
+
|
|
206
|
+
# Required
|
|
207
|
+
|
|
208
|
+
names: Annotated[
|
|
209
|
+
Names, Field(description="All known names by which the division is called")
|
|
210
|
+
]
|
|
211
|
+
subtype: Annotated[
|
|
212
|
+
DivisionSubtype,
|
|
213
|
+
Field(
|
|
214
|
+
description=textwrap.dedent("""
|
|
215
|
+
A broad classification of the division (e.g., country, region, locality, etc.).
|
|
216
|
+
""").strip()
|
|
217
|
+
),
|
|
218
|
+
]
|
|
219
|
+
country: Annotated[
|
|
220
|
+
CountryCodeAlpha2,
|
|
221
|
+
Field(
|
|
222
|
+
description=textwrap.dedent("""
|
|
223
|
+
ISO 3166-1 alpha-2 country code of the country or country-like entity, that this
|
|
224
|
+
division represents or belongs to.
|
|
225
|
+
|
|
226
|
+
If the entity this division represents has a country code, the country property
|
|
227
|
+
contains it. If it does not, the country property contains the country code of the
|
|
228
|
+
first division encountered by traversing the parent_division_id chain to the root.
|
|
229
|
+
|
|
230
|
+
For example:
|
|
231
|
+
- The country value for the United States is 'US'
|
|
232
|
+
- The country value for New York City is 'US'
|
|
233
|
+
- The country value for Puerto Rico, a dependency of the US, is 'PR'.
|
|
234
|
+
- The country value for San Juan, Puerto Rico is 'PR'.
|
|
235
|
+
|
|
236
|
+
If an entity has an internationally-recognized ISO 3166-1 alpha-2 country code, it
|
|
237
|
+
should always be used. In cases where the schema requires the code but no
|
|
238
|
+
internationally-recognized code is available, a synthetic code may be used provided
|
|
239
|
+
it does not conflict with any internationally-recognized codes.
|
|
240
|
+
""").strip(),
|
|
241
|
+
),
|
|
242
|
+
]
|
|
243
|
+
hierarchies: Annotated[
|
|
244
|
+
list[Hierarchy],
|
|
245
|
+
Field(
|
|
246
|
+
min_length=1,
|
|
247
|
+
description=textwrap.dedent("""
|
|
248
|
+
Hierarchies in which this division participates.
|
|
249
|
+
|
|
250
|
+
Every division participates in at least one hierarchy. Most participate in only one.
|
|
251
|
+
Some divisions may participate in more than one hierarchy, for example if they are
|
|
252
|
+
claimed by different parent divisions from different political perspectives; or if
|
|
253
|
+
there are other real-world reasons why the division or one of its ancestors has
|
|
254
|
+
multiple parents.
|
|
255
|
+
|
|
256
|
+
The first hierarchy in the list is the default hierarchy, and the second-to-last
|
|
257
|
+
entry in the default hierarchy (if there is such an entry) always corresponds to the
|
|
258
|
+
`parent_division_id` property. The ordering of hierarchies after the first one is
|
|
259
|
+
arbitrary.
|
|
260
|
+
""").strip(),
|
|
261
|
+
),
|
|
262
|
+
UniqueItemsConstraint(),
|
|
263
|
+
]
|
|
264
|
+
parent_division_id: Annotated[
|
|
265
|
+
Id | None,
|
|
266
|
+
Field(
|
|
267
|
+
description=textwrap.dedent("""
|
|
268
|
+
Division ID of this division's parent division.
|
|
269
|
+
|
|
270
|
+
Not allowed for top-level divisions (countries) and required for all other
|
|
271
|
+
divisions.
|
|
272
|
+
|
|
273
|
+
The default parent division is the parent division as seen from the default
|
|
274
|
+
political perspective, if there is one, and is otherwise chosen somewhat
|
|
275
|
+
arbitrarily. The hierarchies property can be used to inspect the exhaustive list of
|
|
276
|
+
parent divisions.
|
|
277
|
+
""").strip()
|
|
278
|
+
),
|
|
279
|
+
Reference(Relationship.HIERARCHY, Division, role="child_of"),
|
|
280
|
+
] = None
|
|
281
|
+
admin_level: AdminLevel | None = None
|
|
282
|
+
|
|
283
|
+
# Optional
|
|
284
|
+
|
|
285
|
+
class_: Annotated[
|
|
286
|
+
DivisionClass | None,
|
|
287
|
+
Field(
|
|
288
|
+
alias="class",
|
|
289
|
+
description=textwrap.dedent("""
|
|
290
|
+
A more specific classification of the division than is provided by `subtype`.
|
|
291
|
+
""").strip(),
|
|
292
|
+
),
|
|
293
|
+
] = None
|
|
294
|
+
local_type: Annotated[
|
|
295
|
+
CommonNames | None,
|
|
296
|
+
Field(
|
|
297
|
+
description=textwrap.dedent("""
|
|
298
|
+
Local name for the subtype property, optionally localized.
|
|
299
|
+
|
|
300
|
+
For example, the Canadian province of Quebec has the subtype `"region"`, but in the
|
|
301
|
+
local administrative hierarchy it is referred to as a province. Similarly, the
|
|
302
|
+
Canadian Yukon territory also has subtype `"region"`, but is locally called a
|
|
303
|
+
territory.
|
|
304
|
+
|
|
305
|
+
This property is localized using a standard Overture names structure. So for
|
|
306
|
+
example, in Switzerland the top-level administrative subdivision corresponding to
|
|
307
|
+
subtype 'region' is the canton, which may be translated in each of Switzerland's
|
|
308
|
+
official languages as, 'canton' in French, 'kanton' in German, 'cantone' in Italian,
|
|
309
|
+
and 'chantun' in Romansh.
|
|
310
|
+
""").strip(),
|
|
311
|
+
),
|
|
312
|
+
] = None
|
|
313
|
+
region: Annotated[
|
|
314
|
+
RegionCode | None,
|
|
315
|
+
Field(
|
|
316
|
+
description=textwrap.dedent("""
|
|
317
|
+
ISO 3166-2 principal subdivision code of the subdivision-like entity this division
|
|
318
|
+
represents or belongs to.
|
|
319
|
+
|
|
320
|
+
If the entity this division represents has a principal subdivision code, the region
|
|
321
|
+
property contains it. If it does not, the region property contains the principal
|
|
322
|
+
subdivision code of the first division encountered by traversing the
|
|
323
|
+
`parent_division_id` chain to the root.
|
|
324
|
+
|
|
325
|
+
For example:
|
|
326
|
+
- The region value for the United States is omitted.
|
|
327
|
+
- The region value for the U.S. state of New York is 'US-NY'.
|
|
328
|
+
- The region value for New York City is 'US-NY', which it inherits from the state
|
|
329
|
+
of New York.
|
|
330
|
+
- The region value for Puerto Rico is 'US-PR'.
|
|
331
|
+
""").strip(),
|
|
332
|
+
),
|
|
333
|
+
] = None
|
|
334
|
+
perspectives: Annotated[
|
|
335
|
+
Perspectives | None,
|
|
336
|
+
Field(
|
|
337
|
+
description=textwrap.dedent("""
|
|
338
|
+
Political perspectives from which this division is considered to be an accurate
|
|
339
|
+
representation.
|
|
340
|
+
|
|
341
|
+
If this property is absent, then this division is not known to be disputed from
|
|
342
|
+
any political perspective. Consequently, there is only one division feature
|
|
343
|
+
representing the entire real world entity.
|
|
344
|
+
|
|
345
|
+
If this property is present, it means the division represents one of several
|
|
346
|
+
alternative perspectives on the same real-world entity.
|
|
347
|
+
|
|
348
|
+
There are two modes of perspective:
|
|
349
|
+
|
|
350
|
+
1. `accepted_by` means the representation of the division is accepted by the
|
|
351
|
+
listed entities and would be included on a map drawn from their perspective.
|
|
352
|
+
|
|
353
|
+
2. `disputed_by` means the representation of the division is disputed by the
|
|
354
|
+
listed entities and would be excluded from a map drawn from their perspective.
|
|
355
|
+
|
|
356
|
+
When drawing a map from the perspective of a given country, one would start by
|
|
357
|
+
gathering all the undisputed divisions (with no `perspectives` property), and then
|
|
358
|
+
adding to that first all divisions explicitly accepted by the country, and second
|
|
359
|
+
all divisions not explicitly disputed by the country.
|
|
360
|
+
""").strip(),
|
|
361
|
+
),
|
|
362
|
+
] = None
|
|
363
|
+
# If we decide to include default language, it will go here. But is it really generally-useful information?
|
|
364
|
+
norms: Annotated[
|
|
365
|
+
Norms | None,
|
|
366
|
+
Field(
|
|
367
|
+
description=textwrap.dedent("""
|
|
368
|
+
Collects information about local norms and rules within the division that are
|
|
369
|
+
generally useful for mapping and map-related use cases.
|
|
370
|
+
|
|
371
|
+
If the norms property or a desired sub-property of the norms property is missing
|
|
372
|
+
on a division, but at least one of its ancestor divisions has the norms property
|
|
373
|
+
and the desired sub-property, then the value from the nearest ancestor division
|
|
374
|
+
may be assumed.
|
|
375
|
+
""").strip(),
|
|
376
|
+
),
|
|
377
|
+
] = None
|
|
378
|
+
population: Annotated[
|
|
379
|
+
int32 | None, Field(ge=0, description="Population of the division")
|
|
380
|
+
] = None
|
|
381
|
+
capital_division_ids: Annotated[
|
|
382
|
+
list[
|
|
383
|
+
Annotated[
|
|
384
|
+
Id,
|
|
385
|
+
Reference(Relationship.HIERARCHY, Division, role="has_as_capital"),
|
|
386
|
+
]
|
|
387
|
+
]
|
|
388
|
+
| None,
|
|
389
|
+
Field(
|
|
390
|
+
min_length=1,
|
|
391
|
+
description=textwrap.dedent("""
|
|
392
|
+
Division IDs of this division's capital divisions. If present, this property will
|
|
393
|
+
refer to the division IDs of the capital cities, county seats, etc. of a division.
|
|
394
|
+
""").strip(),
|
|
395
|
+
),
|
|
396
|
+
UniqueItemsConstraint(),
|
|
397
|
+
] = None
|
|
398
|
+
capital_of_divisions: Annotated[
|
|
399
|
+
list[CapitalOfDivisionItem] | None,
|
|
400
|
+
Field(
|
|
401
|
+
min_length=1,
|
|
402
|
+
description="Division IDs and subtypes of divisions this division is a capital of.",
|
|
403
|
+
),
|
|
404
|
+
UniqueItemsConstraint(),
|
|
405
|
+
] = None
|
|
406
|
+
wikidata: WikidataId | None = None
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
# Materialize forward references to `Division`.
|
|
410
|
+
def __materialize_forward_refs(model_class: type[BaseModel]) -> None:
|
|
411
|
+
rebuilt: bool | None = model_class.model_rebuild()
|
|
412
|
+
assert rebuilt, (
|
|
413
|
+
f"expected `{model_class.__name__}` to be rebuilt to materialize forward references to `{Division.__name__}`, but it wasn't"
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
__materialize_forward_refs(CapitalOfDivisionItem)
|
|
418
|
+
__materialize_forward_refs(HierarchyItem)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"""Division area models for Overture Maps divisions theme."""
|
|
2
|
+
|
|
3
|
+
import textwrap
|
|
4
|
+
from typing import Annotated, Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import ConfigDict, Field
|
|
7
|
+
|
|
8
|
+
from overture.schema.common import (
|
|
9
|
+
OvertureFeature,
|
|
10
|
+
)
|
|
11
|
+
from overture.schema.common.names import (
|
|
12
|
+
Named,
|
|
13
|
+
Names,
|
|
14
|
+
)
|
|
15
|
+
from overture.schema.system.doc import DocumentedEnum
|
|
16
|
+
from overture.schema.system.geometric import (
|
|
17
|
+
Geometry,
|
|
18
|
+
GeometryType,
|
|
19
|
+
GeometryTypeConstraint,
|
|
20
|
+
)
|
|
21
|
+
from overture.schema.system.model_constraint import (
|
|
22
|
+
FieldEqCondition,
|
|
23
|
+
require_any_true,
|
|
24
|
+
require_if,
|
|
25
|
+
)
|
|
26
|
+
from overture.schema.system.ref import Id, Reference, Relationship
|
|
27
|
+
from overture.schema.system.string import CountryCodeAlpha2, RegionCode
|
|
28
|
+
|
|
29
|
+
from ._common import AdminLevel, DivisionSubtype
|
|
30
|
+
from .division import Division
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AreaClass(str, DocumentedEnum):
|
|
34
|
+
"""
|
|
35
|
+
Further classification of a division area that is more specific than its `subtype`.
|
|
36
|
+
|
|
37
|
+
A division area's `class` adds detail to the broad classification found in `DivisionSubtype`.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
LAND = ("land", "The area does not extend beyond the coastline.")
|
|
41
|
+
MARITIME = (
|
|
42
|
+
"maritime",
|
|
43
|
+
textwrap.dedent("""
|
|
44
|
+
The area extends beyond the coastline, in most cases to the extent of the division's
|
|
45
|
+
territorial sea, if it has one.
|
|
46
|
+
""").strip(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.COUNTRY))
|
|
51
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.DEPENDENCY))
|
|
52
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.MACROREGION))
|
|
53
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.REGION))
|
|
54
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.MACROCOUNTY))
|
|
55
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.COUNTY))
|
|
56
|
+
@require_any_true(
|
|
57
|
+
FieldEqCondition("is_land", True),
|
|
58
|
+
FieldEqCondition("is_territorial", True),
|
|
59
|
+
)
|
|
60
|
+
class DivisionArea(
|
|
61
|
+
OvertureFeature[Literal["divisions"], Literal["division_area"]], Named
|
|
62
|
+
):
|
|
63
|
+
"""
|
|
64
|
+
Division areas are polygon features that represent the land or maritime area covered by a
|
|
65
|
+
division.
|
|
66
|
+
|
|
67
|
+
Each division area belongs to a division which it references by ID, and for which the division
|
|
68
|
+
area provides an area polygon. For ease of use, every division area repeats the subtype, names,
|
|
69
|
+
country, and region properties of the division it belongs to.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
model_config = ConfigDict(title="division_area")
|
|
73
|
+
|
|
74
|
+
# Core
|
|
75
|
+
geometry: Annotated[
|
|
76
|
+
Geometry,
|
|
77
|
+
GeometryTypeConstraint(GeometryType.POLYGON, GeometryType.MULTI_POLYGON),
|
|
78
|
+
Field(
|
|
79
|
+
description=textwrap.dedent("""
|
|
80
|
+
The area covered by the division with which this area feature is
|
|
81
|
+
associated.
|
|
82
|
+
""").strip(),
|
|
83
|
+
),
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
# Required
|
|
87
|
+
|
|
88
|
+
names: Annotated[
|
|
89
|
+
Names,
|
|
90
|
+
Field(description="All known names by which the owning division is called"),
|
|
91
|
+
]
|
|
92
|
+
subtype: Annotated[
|
|
93
|
+
DivisionSubtype,
|
|
94
|
+
Field(
|
|
95
|
+
description=textwrap.dedent("""
|
|
96
|
+
A broad classification of the division this area belongs to (e.g., country, region,
|
|
97
|
+
locality, etc.).
|
|
98
|
+
|
|
99
|
+
This value is the same as the owning division's `subtype`.
|
|
100
|
+
""").strip()
|
|
101
|
+
),
|
|
102
|
+
]
|
|
103
|
+
class_: Annotated[
|
|
104
|
+
AreaClass,
|
|
105
|
+
Field(
|
|
106
|
+
alias="class",
|
|
107
|
+
description=textwrap.dedent("""
|
|
108
|
+
A more specific classification of the division area than is provided by `subtype`.
|
|
109
|
+
""").strip(),
|
|
110
|
+
),
|
|
111
|
+
]
|
|
112
|
+
is_land: Annotated[
|
|
113
|
+
bool | None,
|
|
114
|
+
Field(
|
|
115
|
+
description=textwrap.dedent("""
|
|
116
|
+
Flag indicating whether or not the feature geometry represents the land-clipped,
|
|
117
|
+
non-maritime boundary. The geometry can be used for map rendering, cartographic
|
|
118
|
+
display, and similar purposes.
|
|
119
|
+
""").strip(),
|
|
120
|
+
strict=True,
|
|
121
|
+
),
|
|
122
|
+
] = None
|
|
123
|
+
is_territorial: Annotated[
|
|
124
|
+
bool | None,
|
|
125
|
+
Field(
|
|
126
|
+
description=textwrap.dedent("""
|
|
127
|
+
Flag indicating whether or not the feature geometry represents Overture's best
|
|
128
|
+
approximation of the division's territorial boundary. For coastal places, this will
|
|
129
|
+
tend to include the water area. The geometry can be used for data processing,
|
|
130
|
+
reverse-geocoding, and similar purposes.
|
|
131
|
+
""").strip(),
|
|
132
|
+
strict=True,
|
|
133
|
+
),
|
|
134
|
+
] = None
|
|
135
|
+
division_id: Annotated[
|
|
136
|
+
Id,
|
|
137
|
+
Field(
|
|
138
|
+
description="Division ID of the parent division of this area.",
|
|
139
|
+
),
|
|
140
|
+
Reference(Relationship.HIERARCHY, Division, role="child_of"),
|
|
141
|
+
]
|
|
142
|
+
country: Annotated[
|
|
143
|
+
CountryCodeAlpha2,
|
|
144
|
+
Field(
|
|
145
|
+
description="ISO 3166-1 alpha-2 country code of the division this area belongs to.",
|
|
146
|
+
),
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
# Optional
|
|
150
|
+
|
|
151
|
+
region: Annotated[
|
|
152
|
+
RegionCode | None,
|
|
153
|
+
Field(
|
|
154
|
+
description=textwrap.dedent("""
|
|
155
|
+
ISO 3166-2 principal subdivision code of the division this area belongs to.
|
|
156
|
+
""").strip(),
|
|
157
|
+
),
|
|
158
|
+
] = None
|
|
159
|
+
admin_level: AdminLevel | None = None
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"""Division boundary models for Overture Maps divisions theme."""
|
|
2
|
+
|
|
3
|
+
import textwrap
|
|
4
|
+
from typing import Annotated, Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import ConfigDict, Field
|
|
7
|
+
|
|
8
|
+
from overture.schema.common import (
|
|
9
|
+
OvertureFeature,
|
|
10
|
+
)
|
|
11
|
+
from overture.schema.common.perspectives import Perspectives
|
|
12
|
+
from overture.schema.system.doc import DocumentedEnum
|
|
13
|
+
from overture.schema.system.field_constraint import UniqueItemsConstraint
|
|
14
|
+
from overture.schema.system.geometric import (
|
|
15
|
+
Geometry,
|
|
16
|
+
GeometryType,
|
|
17
|
+
GeometryTypeConstraint,
|
|
18
|
+
)
|
|
19
|
+
from overture.schema.system.model_constraint import (
|
|
20
|
+
FieldEqCondition,
|
|
21
|
+
forbid_if,
|
|
22
|
+
require_any_true,
|
|
23
|
+
require_if,
|
|
24
|
+
)
|
|
25
|
+
from overture.schema.system.ref import Id, Reference, Relationship
|
|
26
|
+
from overture.schema.system.string import CountryCodeAlpha2, RegionCode
|
|
27
|
+
|
|
28
|
+
from ._common import IS_COUNTRY, AdminLevel, DivisionSubtype
|
|
29
|
+
from .division import Division
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class BoundaryClass(str, DocumentedEnum):
|
|
33
|
+
"""
|
|
34
|
+
The kind of boundary: land or maritime.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
LAND = (
|
|
38
|
+
"land",
|
|
39
|
+
textwrap.dedent("""
|
|
40
|
+
None of the boundary geometry extends beyond the coastline of either associated
|
|
41
|
+
division.
|
|
42
|
+
""").strip(),
|
|
43
|
+
)
|
|
44
|
+
MARITIME = (
|
|
45
|
+
"maritime",
|
|
46
|
+
textwrap.dedent("""
|
|
47
|
+
All the boundary geometry extends beyond the coastline of both associated divisions.
|
|
48
|
+
""").strip(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@forbid_if(["country"], IS_COUNTRY)
|
|
53
|
+
@require_if(["country"], ~IS_COUNTRY)
|
|
54
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.COUNTRY))
|
|
55
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.DEPENDENCY))
|
|
56
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.MACROREGION))
|
|
57
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.REGION))
|
|
58
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.MACROCOUNTY))
|
|
59
|
+
@require_if(["admin_level"], FieldEqCondition("subtype", DivisionSubtype.COUNTY))
|
|
60
|
+
@require_any_true(
|
|
61
|
+
FieldEqCondition("is_land", True),
|
|
62
|
+
FieldEqCondition("is_territorial", True),
|
|
63
|
+
)
|
|
64
|
+
class DivisionBoundary(
|
|
65
|
+
OvertureFeature[Literal["divisions"], Literal["division_boundary"]]
|
|
66
|
+
):
|
|
67
|
+
"""
|
|
68
|
+
Boundaries represent borders between divisions of the same subtype.
|
|
69
|
+
|
|
70
|
+
Some boundaries may be disputed by the divisions on one or both sides.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
model_config = ConfigDict(title="division_boundary")
|
|
74
|
+
|
|
75
|
+
# Core
|
|
76
|
+
geometry: Annotated[
|
|
77
|
+
Geometry,
|
|
78
|
+
GeometryTypeConstraint(
|
|
79
|
+
GeometryType.LINE_STRING, GeometryType.MULTI_LINE_STRING
|
|
80
|
+
),
|
|
81
|
+
Field(
|
|
82
|
+
description="Boundary line or lines",
|
|
83
|
+
),
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
# Required
|
|
87
|
+
|
|
88
|
+
subtype: Annotated[
|
|
89
|
+
DivisionSubtype,
|
|
90
|
+
Field(
|
|
91
|
+
description=textwrap.dedent("""
|
|
92
|
+
A broad classification of the divisions this boundary separates (e.g., country,
|
|
93
|
+
region, locality, etc.).
|
|
94
|
+
""").strip()
|
|
95
|
+
),
|
|
96
|
+
]
|
|
97
|
+
class_: Annotated[
|
|
98
|
+
BoundaryClass,
|
|
99
|
+
Field(
|
|
100
|
+
alias="class",
|
|
101
|
+
description="The kind of boundary: land or maritime.",
|
|
102
|
+
),
|
|
103
|
+
]
|
|
104
|
+
is_land: Annotated[
|
|
105
|
+
bool | None,
|
|
106
|
+
Field(
|
|
107
|
+
description=textwrap.dedent("""
|
|
108
|
+
Flag indicating whether or not the feature geometry represents the land-clipped,
|
|
109
|
+
non-maritime boundary. The geometry can be used for map rendering, cartographic
|
|
110
|
+
display, and similar purposes.
|
|
111
|
+
""").strip(),
|
|
112
|
+
strict=True,
|
|
113
|
+
),
|
|
114
|
+
] = None
|
|
115
|
+
is_territorial: Annotated[
|
|
116
|
+
bool | None,
|
|
117
|
+
Field(
|
|
118
|
+
description=textwrap.dedent("""
|
|
119
|
+
Flag indicating whether or not the feature geometry represents Overture's best
|
|
120
|
+
approximation of the division's territorial boundary. For coastal places, this will
|
|
121
|
+
tend to include the water area. The geometry can be used for data processing,
|
|
122
|
+
reverse-geocoding, and similar purposes.
|
|
123
|
+
""").strip(),
|
|
124
|
+
strict=True,
|
|
125
|
+
),
|
|
126
|
+
] = None
|
|
127
|
+
division_ids: Annotated[
|
|
128
|
+
list[
|
|
129
|
+
Annotated[
|
|
130
|
+
Id,
|
|
131
|
+
Reference(Relationship.COMPOSITION, Division, role="boundary_of"),
|
|
132
|
+
]
|
|
133
|
+
],
|
|
134
|
+
Field(
|
|
135
|
+
min_length=2,
|
|
136
|
+
max_length=2,
|
|
137
|
+
description=textwrap.dedent("""
|
|
138
|
+
Identifies the two divisions to the left and right, respectively, of the
|
|
139
|
+
boundary line. The left- and right-hand sides of the boundary are considered
|
|
140
|
+
from the perspective of a person standing on the line facing in the direction
|
|
141
|
+
in which the geometry is oriented, i.e. facing toward the end of the line.
|
|
142
|
+
|
|
143
|
+
The first array element is the Overture ID of the left division. The second
|
|
144
|
+
element is the Overture ID of the right division.
|
|
145
|
+
""").strip(),
|
|
146
|
+
),
|
|
147
|
+
UniqueItemsConstraint(),
|
|
148
|
+
]
|
|
149
|
+
country: Annotated[
|
|
150
|
+
CountryCodeAlpha2 | None,
|
|
151
|
+
Field(
|
|
152
|
+
description=textwrap.dedent("""
|
|
153
|
+
ISO 3166-1 alpha-2 country code of the country or country-like entity that
|
|
154
|
+
both sides of the boundary share.
|
|
155
|
+
|
|
156
|
+
This property will be present on boundaries between two regions, counties,
|
|
157
|
+
or similar entities within the same country, but will not be present on
|
|
158
|
+
boundaries between two countries or country-like entities.
|
|
159
|
+
""").strip(),
|
|
160
|
+
),
|
|
161
|
+
] = None
|
|
162
|
+
|
|
163
|
+
# Optional
|
|
164
|
+
|
|
165
|
+
region: Annotated[
|
|
166
|
+
RegionCode | None,
|
|
167
|
+
Field(
|
|
168
|
+
description=textwrap.dedent("""
|
|
169
|
+
ISO 3166-2 principal subdivision code of the subdivision-like entity that
|
|
170
|
+
both sides of the boundary share.
|
|
171
|
+
|
|
172
|
+
This property will be present on boundaries between two counties, localadmins
|
|
173
|
+
or similar entities within the same principal subdivision, but will not be
|
|
174
|
+
present on boundaries between different principal subdivisions or countries.
|
|
175
|
+
""").strip(),
|
|
176
|
+
),
|
|
177
|
+
] = None
|
|
178
|
+
admin_level: AdminLevel | None = None
|
|
179
|
+
is_disputed: Annotated[
|
|
180
|
+
bool | None,
|
|
181
|
+
Field(
|
|
182
|
+
description=textwrap.dedent("""
|
|
183
|
+
Flag indicating whether this boundary is either disputed outright or is a "best
|
|
184
|
+
guess" in a case where the boundary between two divisions is unclear.
|
|
185
|
+
|
|
186
|
+
If the boundary is disputed outright, this flag is true and the entities disputing
|
|
187
|
+
it are listed in the `perspectives` property. If the boundary is simply a "best
|
|
188
|
+
guess", this flag is true but no disputing entities are listed in `perspectives`.
|
|
189
|
+
""").strip(),
|
|
190
|
+
strict=True,
|
|
191
|
+
),
|
|
192
|
+
] = None
|
|
193
|
+
perspectives: Annotated[
|
|
194
|
+
Perspectives | None,
|
|
195
|
+
Field(
|
|
196
|
+
description=textwrap.dedent("""
|
|
197
|
+
Political perspectives from which this division boundary is considered to be
|
|
198
|
+
an accurate representation.
|
|
199
|
+
|
|
200
|
+
If this property is absent, then this boundary is not known to be disputed
|
|
201
|
+
from any political perspective. Consequently, there is only one boundary
|
|
202
|
+
feature representing the entire real world entity.
|
|
203
|
+
|
|
204
|
+
If this property is present, it means the boundary represents one of several
|
|
205
|
+
alternative perspectives on the same real-world entity.
|
|
206
|
+
|
|
207
|
+
There are two modes of perspective:
|
|
208
|
+
|
|
209
|
+
1. `accepted_by` means the representation of the boundary is accepted by the
|
|
210
|
+
listed entities and would be included on a map drawn from their perspective.
|
|
211
|
+
|
|
212
|
+
2. `disputed_by` means the representation of the boundary is disputed by the
|
|
213
|
+
listed entities and would be excluded from a map drawn from their
|
|
214
|
+
perspective.
|
|
215
|
+
|
|
216
|
+
When drawing a map from the perspective of a given country, one would start by
|
|
217
|
+
gathering all the undisputed boundaries (those with no `perspectives` value); and
|
|
218
|
+
then adding to that: first, all boundaries explicitly accepted by the country, and
|
|
219
|
+
second, all boundaries not explicitly disputed by the country.
|
|
220
|
+
""").strip(),
|
|
221
|
+
),
|
|
222
|
+
] = None
|
|
File without changes
|