import axipy
from rosreestrXml.ui.tools.OutDrv.DbDocuments import DocumentsDb
from rosreestrXml.ui.tools.OutDrv.ObjectToSave import DbGeoOgr, TypeGeometryProviderOgr
from rosreestrXml.ui.tools.kptTools.DbKptDirectory import KptСatalog
from rosreestrXml.ui.tools.kptTools.KptObjXml import FactoryKpt
from rosreestrXml.ui.tools.kptTools.kpt_10 import parse

path_source=r"E:\Download\RossRestr\63_21_Клявлинский 2020\63_21_Клявлинский 2020\*.xml"
path_xml=r"E:\Download\RossRestr\TestOMSPoints\doc5093669.xml"
#list_files=glob.glob(path_source)
path_out_db=r"E:\Download\RossRestr\TestOMSPoints\63_21.gpkg"
dbCatalog=KptСatalog()
dbDoc=None
dbDoc=DocumentsDb(path_out_db)
db=DbGeoOgr(dbCatalog)
db.Create(path_out_db,TypeGeometryProviderOgr.GPKG)
db.setDbDocuments(dbDoc)
cs_wkt='LOCAL_CS["NonEarth_Meter",UNIT["METER",1]]'
mi_style='Pen (3, 9, 255) Brush (18, 65280)'
mi_style='Pen (3, 9, 255) ,Pen (3, 9, 255) Brush (18, 65280)'
mi_style='Symbol (35, 16711680, 12)'
ObjKpt = parse(path_xml, True)
objXmlKpt = FactoryKpt(ObjKpt)
objPoints = objXmlKpt[0].SaveOMSPoints(db, cs_wkt, mi_style,False)

db.Close()
print(" End End")