mxd=arcpy.mapping.MapDocument(r"F:\GeoData\ChinaArea\ChinaVector.mxd")
df= arcpy.mapping.ListDataFrames(mxd)[0]
lyr1=arcpy.mapping.Layer(r" F:\GeoData\ChinaArea\Province.lyr") df.addLayer(lyr1) lyr2=arcpy.mapping.ListLayer(mxd,"",df)[0]
txtElm=arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT")[0]
# coding:utf-8
import arcpy
mxd=arcpy.mapping.MapDocument(r"F:\GeoData\ChinaArea\ChinaVector.mxd")
for pageNum in range(1,mxd.dataDrivenPages.pageCount):
mxd.dataDrivenPages.currentPageID=pageNum
mapName=mxd.dataDrivenPages.pageRow.getValue(mxd.dataDrivenPages.pageNameField.name)
print mapName
arcpy.mapping.ExportToPNG(mxd,r"F:\GeoData\ChinaArea\Province\\"+mapName+".png")
print 'ok'
# coding:utf-8
import arcpy
import os
def GetShpfiles(shpdir):
shpfiles=[]
allfiles=os.listdir(shpdir)
for file in allfiles:
if os.path.isfile(file):
if file.endswith('.shp'):
shpfiles.append(file)
else:
shpfiles.extend(GetShpfiles(file))
return shpfiles
allshps=GetShpfiles(r"F:\GeoData\ChinaArea\Province")
mxd=arcpy.mapping.MapDocument(r"F:\GeoData\ChinaArea\ChinaVector.mxd")
lyr=arcpy.mapping.ListLayer(mxd)[0]
for shp in allshps:
paths=os.path.split(shp)
print paths[1]
lyr.replaceDataSource(paths[0],"SHAPEFILE_WORKSPACE",paths[1])
arcpy.mapping.ExportToPNG(mxd,r"F:\GeoData\ChinaArea\Province\\"+paths[1]+".png")
print 'ok'
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有