zoukankan      html  css  js  c++  java
  • arcgis python 一个mxd打包mpk

    def onempk(fileName):
        if fileName:
            mxd = arcpy.mapping.MapDocument(fileName)
        else:
            mxd = arcpy.mapping.MapDocument("current")
            fileName=mxd.filePath
        filepath, filename = os.path.split(fileName)
    
        b=False
        if mxd.title==None:
            mxd.title="yl create"+filename
            b=True
        if mxd.description==None:
            mxd.description="yl auto create"+filename
            b=True
        elif mxd.description=="":
            mxd.description="yl auto create"+filename
            b=True
    
        if mxd.author==None:
            mxd.author="yanlei auto create"
            b=True
        if mxd.summary==None:
            mxd.summary="yanlei auto create summary"
            b=True
        if mxd.relativePaths==False:
            mxd.relativePaths=True
            b=True
        if b==True:
            mxd.save()
        arcpy.env.workspace = filepath
        mpk=filename.lower().replace(".mxd",".mpk")
    
        #arcpy.AddMessage("mpk:"+mpk+","+mpk[0:1])
        if (is_number(mpk[0:1])):
            mpk="YL_"+mpk #邮件附件不能数字开头
    
        arcpy.PackageMap_management(filename, mpk, "PRESERVE", "#", "#", "ALL")
        return filepath+os.sep+mpk
  • 相关阅读:
    Java 之Integer相等比较
    Java 之HashMap.values()方法误用
    Java 异常归纳总结
    MySQL之GROUP BY用法误解
    Java 类的成员初始化顺序
    十三、java_GUI
    十二、java_网络编程
    十一、java线程
    十、java_IO
    九、java容器
  • 原文地址:https://www.cnblogs.com/gisoracle/p/11388971.html
Copyright © 2011-2022 走看看