|
1 |
| -import glob |
2 | 1 | import numpy as np
|
3 | 2 | import os
|
4 | 3 | from plateauutils.abc.plateau_parser import PlateauParser
|
5 | 4 | from plateauutils.mesh_geocorder.polygon_to_meshcode_list import PolygonToMeshCodeList
|
6 | 5 | from shapely.geometry import Polygon
|
7 |
| -import shutil |
8 | 6 | import xml.etree.ElementTree as ET
|
9 | 7 | import zipfile
|
10 | 8 |
|
@@ -202,20 +200,28 @@ def _parse(
|
202 | 200 | ".//uro:buildingStructureType", ns
|
203 | 201 | )
|
204 | 202 | # uro:codeSpaceを取得
|
205 |
| - code_space = building_structure_type.get("codeSpace") |
206 |
| - # codeSpaceから値を取得 |
207 |
| - code_space_path = os.path.normpath(os.path.join(target, "..", code_space)) |
208 |
| - code_space_root = ET.fromstring(zip_file.read(code_space_path)) |
209 |
| - building_structure_type_text = None |
210 |
| - for code_space_root_root_child in code_space_root.findall( |
211 |
| - ".//gml:dictionaryEntry", ns |
212 |
| - ): |
213 |
| - gml_name = code_space_root_root_child.find(".//gml:name", ns) |
214 |
| - if str(gml_name.text) == str(building_structure_type.text): |
215 |
| - building_structure_type_text = str( |
216 |
| - code_space_root_root_child.find(".//gml:description", ns).text |
217 |
| - ) |
218 |
| - break |
| 203 | + try: |
| 204 | + code_space = building_structure_type.get("codeSpace") |
| 205 | + # codeSpaceから値を取得 |
| 206 | + code_space_path = os.path.normpath( |
| 207 | + os.path.join(target, "..", code_space) |
| 208 | + ) |
| 209 | + code_space_root = ET.fromstring(zip_file.read(code_space_path)) |
| 210 | + building_structure_type_text = None |
| 211 | + for code_space_root_root_child in code_space_root.findall( |
| 212 | + ".//gml:dictionaryEntry", ns |
| 213 | + ): |
| 214 | + gml_name = code_space_root_root_child.find(".//gml:name", ns) |
| 215 | + if str(gml_name.text) == str(building_structure_type.text): |
| 216 | + building_structure_type_text = str( |
| 217 | + code_space_root_root_child.find( |
| 218 | + ".//gml:description", ns |
| 219 | + ).text |
| 220 | + ) |
| 221 | + break |
| 222 | + except AttributeError: |
| 223 | + print("uro:buildingStructureType is NoneType in", gid, "in", target) |
| 224 | + building_structure_type_text = "不明" |
219 | 225 | # bldg:lod1Solidを取得
|
220 | 226 | lod1_solid = city_object_member.find(".//bldg:lod1Solid", ns)
|
221 | 227 | # 返り値に入る値を作成
|
|
0 commit comments