本文整理汇总了Python中ogrtools.ogrtransform.ogrconfig.OgrConfig.generate_config方法的典型用法代码示例。如果您正苦于以下问题:Python OgrConfig.generate_config方法的具体用法?Python OgrConfig.generate_config怎么用?Python OgrConfig.generate_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogrtools.ogrtransform.ogrconfig.OgrConfig
的用法示例。
在下文中一共展示了OgrConfig.generate_config方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ili_config
# 需要导入模块: from ogrtools.ogrtransform.ogrconfig import OgrConfig [as 别名]
# 或者: from ogrtools.ogrtransform.ogrconfig.OgrConfig import generate_config [as 别名]
def test_ili_config():
cfg = OgrConfig(ds="./tests/data/ili/roads23.xtf,./tests/data/ili/RoadsExdm2ien.imd")
cfgjson = cfg.generate_config(dst_format="PostgreSQL", srs=21781)
expected = """"roadsexdm2ien_roadsextended_streetaxis": {
"fields": {
"tid": {
"src": "TID",
"type": "String"
},
"street": {
"src": "Street",
"type": "String"
},
"precision": {
"src": "Precision",
"type": "String"
}
},
"geometry_type": "MultiLineString",
"src_layer": "RoadsExdm2ien.RoadsExtended.StreetAxis",
"geom_fields": {
"geometry": {
"src": "Geometry",
"type": "MultiLineString",
"srs": 21781
}
}
}"""
print cfgjson
assert expected in cfgjson
示例2: test_layer_info
# 需要导入模块: from ogrtools.ogrtransform.ogrconfig import OgrConfig [as 别名]
# 或者: from ogrtools.ogrtransform.ogrconfig.OgrConfig import generate_config [as 别名]
def test_layer_info():
cfg = OgrConfig(ds="./tests/data/ili/roads23.xtf,./tests/data/ili/RoadsExdm2ien.imd",
model="./tests/data/ili/RoadsExdm2ien.imd")
assert not cfg.is_loaded()
assert cfg.layer_names() == []
assert cfg.enum_names() == []
assert cfg.layer_infos() == []
assert cfg.enum_infos() == []
cfg.generate_config(dst_format='PostgreSQL')
assert cfg.is_loaded()
print cfg.layer_names()
assert "roadsexdm2ien_roadsextended_roadsign" in cfg.layer_names()
print cfg.enum_names()
assert "_type" in str(cfg.enum_names())
print cfg.layer_infos()
print cfg.enum_infos()
assert {'name': 'roadsexdm2ien_roadsextended_roadsign', 'geom_field': 'position'} in cfg.layer_infos()
assert {'name': 'roadsexdm2ben_roads_lattrs'} in cfg.layer_infos()
assert '_precision' in str(cfg.enum_infos())
示例3: test_shape_config
# 需要导入模块: from ogrtools.ogrtransform.ogrconfig import OgrConfig [as 别名]
# 或者: from ogrtools.ogrtransform.ogrconfig.OgrConfig import generate_config [as 别名]
def test_shape_config():
cfg = OgrConfig(ds="tests/data/osm/railway.shp")
cfgjson = cfg.generate_config(dst_format="PostgreSQL")
expected = """{
"//": "OGR transformation configuration",
"dst_dsco": {},
"dst_lco": {
"SCHEMA": "public"
},
"layers": {
"railway": {
"fields": {
"keyvalue": {
"src": "keyvalue",
"type": "String",
"width": 80
},
"lastchange": {
"src": "lastchange",
"type": "Date",
"width": 10
},
"type": {
"src": "type",
"type": "String",
"width": 255
},
"name": {
"src": "name",
"type": "String",
"width": 255
},
"osm_id": {
"src": "osm_id",
"type": "Real",
"width": 11
}
},
"geometry_type": "LineString",
"src_layer": "railway",
"geom_fields": {}
}
},
"src_format": "ESRI Shapefile",
"dst_format": "PostgreSQL"
}"""
print cfgjson
assert cfgjson == expected
示例4: test_np
# 需要导入模块: from ogrtools.ogrtransform.ogrconfig import OgrConfig [as 别名]
# 或者: from ogrtools.ogrtransform.ogrconfig.OgrConfig import generate_config [as 别名]
def test_np():
cfg = OgrConfig(
ds="tests/data/np/NP_Example.xtf,tests/data/np/NP_73_CH_de_ili2.imd", model="tests/data/np/NP_73_CH_de_ili2.imd"
)
cfgjson = cfg.generate_config(dst_format="PostgreSQL")
expected = """"n0_grundnutzung_zonenflaeche": {
"fields": {
"zonentyp_1": {
"src": "Zonentyp_1",
"type": "String"
},
"herkunft": {
"src": "Herkunft",
"type": "String"
},
"mutation": {
"src": "Mutation",
"type": "String"
},
"tid": {
"src": "TID",
"type": "String"
},
"qualitaet": {
"src": "Qualitaet",
"type": "String"
},
"bemerkungen": {
"src": "Bemerkungen",
"type": "String"
}
},
"geometry_type": "Polygon",
"src_layer": "Nutzungsplanung.Nutzungsplanung.Grundnutzung_Zonenflaeche",
"geom_fields": {
"geometrie": {
"src": "Geometrie",
"type": "Polygon"
}
}
}"""
print cfgjson
assert expected in cfgjson
示例5: test_enums
# 需要导入模块: from ogrtools.ogrtransform.ogrconfig import OgrConfig [as 别名]
# 或者: from ogrtools.ogrtransform.ogrconfig.OgrConfig import generate_config [as 别名]
def test_enums():
cfg = OgrConfig(ds="./tests/data/ili/roads23.xtf,./tests/data/ili/RoadsExdm2ien.imd",
model="./tests/data/ili/RoadsExdm2ien.imd")
cfgjson = cfg.generate_config(dst_format='PostgreSQL')
expected = """_lart": {
"src_name": "RoadsExdm2ben.Roads.LAttrs.LArt",
"values": [
{
"enumtxt": "welldefined",
"enum": "welldefined",
"id": 0
},
{
"enumtxt": "fuzzy",
"enum": "fuzzy",
"id": 1
}
]
}"""
print cfgjson
assert expected in cfgjson