美文网首页
提取shp四至坐标

提取shp四至坐标

作者: 峤桓 | 来源:发表于2019-04-13 17:37 被阅读0次

    利用ArcGIS提取shp四至坐标,以下是源代码。

    # -*- coding: utf-8 -*-  
    
    # Import arcpy module  
    
    import arcpy  
    
    Shp = arcpy.GetParameterAsText(0)  
    
    if Shp == '#' or not Shp:  
    
      Shp ="shp" # provide a default value if unspecified  
    
    maxX = Shp  
    
    maxY = maxX  
    
    minX = maxY  
    
    minY = minX  
    
    minYC = minY  
    
    minXC = minYC  
    
    maxYC = minXC  
    
    maxXC = maxYC  
    
    arcpy.AddField_management(Shp,"maxX", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")  
    
    arcpy.AddField_management(maxX,"maxY", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")  
    
    arcpy.AddField_management(maxY,"minX", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")  
    
    arcpy.AddField_management(minX,"minY", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")  
    
    arcpy.CalculateField_management(minY,"minY", "!shape.extent.ymin!", "PYTHON_9.3", "")  
    
    arcpy.CalculateField_management(minYC,"minX", "!shape.extent.xmin!", "PYTHON_9.3", "")  
    
    arcpy.CalculateField_management(minXC,"maxY", "!shape.extent.ymax!", "PYTHON_9.3", "")  
    
    arcpy.CalculateField_management(maxYC,"maxX", "!shape.extent.xmax!", "PYTHON_9.3", "")
    
    

    相关文章

      网友评论

          本文标题:提取shp四至坐标

          本文链接:https://www.haomeiwen.com/subject/hijrwqtx.html