rewr
This commit is contained in:
79
main1.py
79
main1.py
@@ -13,30 +13,58 @@ class Data_farame():
|
|||||||
self.availability_coordinates = availability_coordinates #наличие координат
|
self.availability_coordinates = availability_coordinates #наличие координат
|
||||||
self.explanations = explanations #Пояснения
|
self.explanations = explanations #Пояснения
|
||||||
|
|
||||||
class SpecifyParcel():
|
class CadastralErrorsParcels():
|
||||||
|
|
||||||
def chec_koordinat(new_parcel):
|
def chec_koordinat(self,CadastralErrorParcel):
|
||||||
if 'EntitySpatial' in new_parcel:
|
if 'EntitySpatial' in CadastralErrorParcel:
|
||||||
if 'SpatialElement' in new_parcel['EntitySpatial']:
|
if 'SpatialElement' in CadastralErrorParcel['EntitySpatial'][0]:
|
||||||
return "да"
|
return "да"
|
||||||
else:
|
else:
|
||||||
return "нет"
|
return "нет"
|
||||||
else:
|
else:
|
||||||
return "нет"
|
return "нет"
|
||||||
|
|
||||||
|
def __init__(self, xml_dict):
|
||||||
|
try:
|
||||||
|
for item in xml_dict['Package'][0]['CadastralErrorsParcels'][0]['CadastralErrorParcel']:
|
||||||
|
data.append(
|
||||||
|
Data_farame(
|
||||||
|
section_KPTR="Исправление ЗУ",
|
||||||
|
cadastral_number=item['CadastralErrorExistParcel'][0]['@attributes']["CadastralNumber"],
|
||||||
|
cadastral_quarter=item['CadastralErrorExistParcel'][0]['CadastralBlock'][0]['#text'],
|
||||||
|
object_type="",
|
||||||
|
land_plot_area=item['CadastralErrorExistParcel'][0]['Area'][0]['Area'][0]['#text'],
|
||||||
|
error_in_determining_area=item['CadastralErrorExistParcel'][0]['Area'][0]['Inaccuracy'][0]['#text'],
|
||||||
|
availability_coordinates=self.chec_koordinat(item['CadastralErrorExistParcel'][0]),
|
||||||
|
explanations=""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
class SpecifyParcel():
|
||||||
|
|
||||||
def chec_tag_ProvidingPassCadastralNumbers(ProvidingPassCadastralNumbers):
|
def chec_koordinat(self,new_parcel):
|
||||||
if 'ProvidingPassCadastralNumbers' in ProvidingPassCadastralNumbers['ExistParcel'][0]:
|
if 'EntitySpatial' in new_parcel:
|
||||||
return ProvidingPassCadastralNumbers['ExistParcel'][0]['ProvidingPassCadastralNumbers'][0]['Other'][0]['#text']
|
if 'SpatialElement' in new_parcel['EntitySpatial'][0]:
|
||||||
|
return "да"
|
||||||
|
|
||||||
|
return "нет"
|
||||||
|
return "нет"
|
||||||
|
|
||||||
|
def chec_tag_ProvidingPassCadastralNumbers(self,PPCN):
|
||||||
|
if 'ProvidingPassCadastralNumbers' in PPCN['ExistParcel'][0]:
|
||||||
|
return PPCN['ExistParcel'][0]['ProvidingPassCadastralNumbers'][0]['Other'][0]['#text']
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def chec_tag_Explanation(Explanation):
|
def chec_tag_Explanation(self,Explanation):
|
||||||
if 'Explanation' in Explanation['ExistParcel'][0]:
|
if 'Explanation' in Explanation['ExistParcel'][0]:
|
||||||
return Explanation['ExistParcel'][0]['Explanation'][0]['#text']
|
return Explanation['ExistParcel'][0]['Explanation'][0]['#text']
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, xml_dict):
|
||||||
try:
|
try:
|
||||||
for i,item in enumerate(xml_dict['Package'][0]['SpecifyParcels'][0]['SpecifyParcel']):
|
for i,item in enumerate(xml_dict['Package'][0]['SpecifyParcels'][0]['SpecifyParcel']):
|
||||||
data.append(
|
data.append(
|
||||||
@@ -44,10 +72,10 @@ class SpecifyParcel():
|
|||||||
section_KPTR="Уточнение ЗУ",
|
section_KPTR="Уточнение ЗУ",
|
||||||
cadastral_number=item['ExistParcel'][0]['@attributes']["CadastralNumber"],
|
cadastral_number=item['ExistParcel'][0]['@attributes']["CadastralNumber"],
|
||||||
cadastral_quarter=item['ExistParcel'][0]['CadastralBlock'][0]['#text'],
|
cadastral_quarter=item['ExistParcel'][0]['CadastralBlock'][0]['#text'],
|
||||||
object_type=self.chec_tag_ProvidingPassCadastralNumbers(ProvidingPassCadastralNumbers=item),
|
object_type=self.chec_tag_ProvidingPassCadastralNumbers(PPCN=item),
|
||||||
land_plot_area=item['ExistParcel'][0]['Area'][0]['Area'][0]['#text'],
|
land_plot_area=item['ExistParcel'][0]['Area'][0]['Area'][0]['#text'],
|
||||||
error_in_determining_area=item['ExistParcel'][0]['Area'][0]['Inaccuracy'][0]['#text'],
|
error_in_determining_area=item['ExistParcel'][0]['Area'][0]['Inaccuracy'][0]['#text'],
|
||||||
availability_coordinates=self.chec_koordinat(item['ExistParcel'][0]['EntitySpatial'][0]),
|
availability_coordinates=self.chec_koordinat(item['ExistParcel'][0]),
|
||||||
explanations=self.chec_tag_Explanation(Explanation=item)
|
explanations=self.chec_tag_Explanation(Explanation=item)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -124,9 +152,36 @@ def lxml_to_dict(element):
|
|||||||
tree = etree.parse('C:/Users/USER/Downloads/12. ХМЛ КПТР в ексель/Исходные данные/Карта-план в хмл прмиер Копейск на кк 74 30 0104002/MapPlanTerritory_E2DF5B75-E136-48DA-BB4C-8887BA4ABF46.xml')
|
tree = etree.parse('C:/Users/USER/Downloads/12. ХМЛ КПТР в ексель/Исходные данные/Карта-план в хмл прмиер Копейск на кк 74 30 0104002/MapPlanTerritory_E2DF5B75-E136-48DA-BB4C-8887BA4ABF46.xml')
|
||||||
xml_dict = lxml_to_dict(tree.getroot())
|
xml_dict = lxml_to_dict(tree.getroot())
|
||||||
temp = NewParcel(xml_dict)
|
temp = NewParcel(xml_dict)
|
||||||
|
temp = SpecifyParcel(xml_dict)
|
||||||
|
temp = CadastralErrorsParcels(xml_dict)
|
||||||
|
|
||||||
|
def get_cad_block(cad_block):
|
||||||
|
temp = ""
|
||||||
|
for item in cad_block:
|
||||||
|
temp += f"{item['#text']}, "
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def get_object_type(type:str):
|
||||||
|
if type == "002001002000":
|
||||||
|
return "Здание"
|
||||||
|
if type == "002001004000":
|
||||||
|
return "Сооружение"
|
||||||
|
if type == "002001005000":
|
||||||
|
return "Объект"
|
||||||
|
|
||||||
|
for item in xml_dict['Package'][0]['ExistNewObjectsRealty'][0]['ExistNewObjectRealty']:
|
||||||
|
data.append(
|
||||||
|
Data_farame(
|
||||||
|
section_KPTR="Уточнение ОКС",
|
||||||
|
cadastral_number=item['CadastralNumber'][0]['#text'],
|
||||||
|
cadastral_quarter=get_cad_block(item['CadastralBlocks'][0]['CadastralBlock']),
|
||||||
|
object_type=get_object_type(item['ObjectType'][0]['#text']),
|
||||||
|
land_plot_area="нет",
|
||||||
|
error_in_determining_area="нет",
|
||||||
|
availability_coordinates=self.chec_koordinat(new_parcel),
|
||||||
|
explanations=self.add_new_data(new_parcel['Category'][0]['DocCategory'][0])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user