管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2022-11-10 4ba319270563d27ec0b19827d97e6a901cd5898d
ExportMap/Sources/render.py
@@ -82,11 +82,14 @@
# map = layout.itemById(r'地图')
map = layout.referenceMap()
# map.zoomToExtent(map.extent())
map.zoomToExtent(map.extent())
print('1:' + str(math.ceil(map.scale())))
size = map.sizeWithUnits()
print('size: ' + str(size.width()) + " * " + str(size.height()) + " mm")
if size.width() > 280 or size.height() > 174:
    map.attemptResize(QgsLayoutSize(280, 174, QgsUnitTypes.LayoutMillimeters))
    print('size: ' + str(map.sizeWithUnits().width()) + " * " + str(map.sizeWithUnits().height()) + " mm")
# 设置图层
# "阀室", "站场", "管道中心线", "矢量注记", "矢量图", "高德影像注记", "高德影像", "影像注记", "影像图"