Пример #1
0
def updateMDLASGeometry(geometry_type, filegdb_path, md_path, area_percent, point_interval):
    '''
    geometry_type = ["BOUNDARY", "FOOTPRINT"]
    '''
    geometry_name = "LAS"
    # Create an in-memory feature class to hold the geometry
    geometry_export = os.path.join(filegdb_path, "{}_{}_Export".format(geometry_type, geometry_name))
    if arcpy.Exists(geometry_export):
        arcpy.Delete_management(geometry_export)
        Utility.addToolMessages()
    
    # Export the geometry to the in-memory feature class  
    arcpy.ExportMosaicDatasetGeometry_management(md_path, geometry_export, where_clause="#", geometry_type=geometry_type)
    Utility.addToolMessages()
    
    # Remove the holes and save to a feature class in the file geodatabase
    geometry_no_holes = os.path.join(filegdb_path, "{}_{}_NoHoles".format(geometry_type, geometry_name))
    if arcpy.Exists(geometry_no_holes):
        arcpy.Delete_management(geometry_no_holes)
        Utility.addToolMessages()
    
    arcpy.EliminatePolygonPart_management(geometry_export, geometry_no_holes, condition="PERCENT", part_area="0 SquareMeters", part_area_percent=area_percent, part_option="CONTAINED_ONLY")
    Utility.addToolMessages()

    # Smooth the polygons
    geometry_smooth = os.path.join(filegdb_path, "{}_{}".format(geometry_type, geometry_name))
    if arcpy.Exists(geometry_smooth):
        arcpy.Delete_management(geometry_smooth)
        Utility.addToolMessages()
    
    arcpy.SmoothPolygon_cartography(geometry_no_holes, geometry_smooth, "PAEK", point_interval, "FIXED_ENDPOINT", "NO_CHECK")
    Utility.addToolMessages()
      
    # Clean up
    if arcpy.Exists(geometry_export):
        arcpy.Delete_management(geometry_export)
        Utility.addToolMessages()
    if arcpy.Exists(geometry_no_holes):
        arcpy.Delete_management(geometry_no_holes)
        Utility.addToolMessages()
    
    # import simplified Footprints/boundary
    arcpy.ImportMosaicDatasetGeometry_management(md_path, target_featureclass_type=geometry_type, target_join_field="OBJECTID",
                                                 input_featureclass=geometry_smooth, input_join_field="OBJECTID")
    Utility.addToolMessages()
Пример #2
0
def getRaster1(url,fileName,imageguids,selection_feature,ds_name,download_path,sde_file):
    print("arcpy is ok")
    #arcpy.env.workspace = download_path
    #arcpy.CreateFolder_management(arcpy.env.workspace, fileName)
    arcpy.CreateFolder_management(download_path, fileName)
    count = 0;
    where = ""
    for imageryguid in imageguids:
        if (count == 0):
            where += "imageryguid='" + imageryguid + "'"
        else:
            where += " or imageryguid='" + imageryguid + "'"
        count += 1
        downloadRasterWhere="imageryguid='" + imageryguid + "'"
        ##不标准代码
        print(downloadRasterWhere)
        print()
        url1=url.replace("https://xingyun.national-space.com/gxyh/rest/","http://xingyunserver.national-space.com:6080/arcgis/rest/")
        print(url1)
        print(ds_name)
        if ds_name=='DS_PSI':
            print("DS_type1")
            arcpy.DownloadRasters_management(url1,download_path+"/"+fileName, downloadRasterWhere,"", "", "", "", "","", "MAINTAIN_FOLDER")
        else:
            print("DS_type2")
            arcpy.ExportMosaicDatasetItems_management(sde_file+"/"+ds_name,download_path+"/"+fileName,"", downloadRasterWhere,"TIFF", "", "NONE","", "")

    arcpy.CreateFileGDB_management(download_path+"/"+fileName, "data", "Current")

    arcpy.ExportMosaicDatasetGeometry_management(sde_file+"/"+ds_name,
                                                 download_path+"/"+fileName+""+"/data.gdb/footprints",
                                                 where, "FOOTPRINT")
    copyQuickview(url,imageguids,fileName,download_path)
    #exportRaster(ds_name,where,fileName,download_path,sde_file)
    ZipRaster(download_path+"/"+fileName,download_path,fileName)
    print(fileName)
Пример #3
0
m = m_location + "\\" + mosaic_name

# Process: Build Footprints
arcpy.BuildFootprints_management(m, "", "RADIOMETRY", "0", "65535", "80", "0",
                                 "NO_MAINTAIN_EDGES", "NO_SKIP_DERIVED_IMAGES",
                                 "UPDATE_BOUNDARY", "2000", "100", "NONE", "",
                                 "20", "0,05")
print "Se han generado las huellas (footprints)"

# Process:  Color balance
arcpy.ColorBalanceMosaicDataset_management(m, "DODGING", "FIRST_ORDER", "", "",
                                           "NONE", "", "")
print "Se ha aplicado mejoramiento de color"

# Process: Build Seamlines

shp_name = "m_seamlines"

arcpy.BuildSeamlines_management(m, "", "NORTH_WEST", "", "", "", "",
                                "RADIOMETRY", "10", "BOTH", "", "PIXELS",
                                "PIXELS")
print "Se han generado las lineas de costura (seamlines)"
# Process: Export Mosaic Dataset Geometry
arcpy.ExportMosaicDatasetGeometry_management(m, m_location + "\\" + shp_name,
                                             "", "SEAMLINE")
print "se ha exportado la capa para editar seamlines"
print "Ya puede verificar el mosaico"
t1 = time.time()
duration = t1 - t0
print(
    "successfully executed - total elapsed time: {} seconds".format(duration))
Пример #4
0
                if imagecollection == 'DOQQ':
                    sr = arcpy.Describe(imageuploadpath).spatialReference
                    mosaicfp = os.path.join(scratch, 'image_boundary.shp')
                    arcpy.CreateMosaicDataset_management(
                        os.path.join(scratch, 'temp.gdb'), 'raster', 4326)
                    arcpy.AddRastersToMosaicDataset_management(
                        os.path.join(scratch, 'temp.gdb', 'raster'),
                        "Raster Dataset",
                        imageuploadpath,
                        'NO_CELL_SIZES',
                        True,
                        False,
                        spatial_reference=sr)
                    arcpy.ExportMosaicDatasetGeometry_management(
                        os.path.join(scratch, 'temp.gdb', 'raster'), mosaicfp,
                        "OBJECTID = 1", "FOOTPRINT")
                    cellsizeX = arcpy.GetRasterProperties_management(
                        imageuploadpath, 'CELLSIZEX')
                    cellsizeY = arcpy.GetRasterProperties_management(
                        imageuploadpath, 'CELLSIZEY')
                    if cellsizeY > cellsizeX:
                        spatial_res = cellsizeY
                    else:
                        spatial_res = cellsizeX
                    desc = arcpy.Describe(mosaicfp)
                    result_top = desc.extent.YMax
                    result_bot = desc.extent.YMin
                    result_left = desc.extent.XMin
                    result_right = desc.extent.XMax
                    arcpy.AddMessage(result_top)
Пример #5
0
 def exportgeometry(self, ofile, **kwargs):
     arcpy.ExportMosaicDatasetGeometry_management(self.fname, ofile.fname,
                                                  **kwargs)
     DisplayMessages()
Пример #6
0
print "Create Mosaic Dataset"

arcpy.CreateMosaicDataset_management(File_GDB_Name, Mosaic_Dataset_Name,
                                     Coordinate_System, "", "", "NONE", "")

print "Add Rasters To Mosaic Dataset"
md_name = File_GDB_Name + "\\" + Mosaic_Dataset_Name
arcpy.AddRastersToMosaicDataset_management(
    md_name, "Raster Dataset", Input_Data, "UPDATE_CELL_SIZES",
    "UPDATE_BOUNDARY", "NO_OVERVIEWS", "", "0", "1500", "", "", "SUBFOLDERS",
    "ALLOW_DUPLICATES", "NO_PYRAMIDS", "NO_STATISTICS", "NO_THUMBNAILS", "",
    "NO_FORCE_SPATIAL_REFERENCE")

print "Build Footprints"
arcpy.BuildFootprints_management(md_name, "", "RADIOMETRY", "1", "65535", "80",
                                 "0", "NO_MAINTAIN_EDGES",
                                 "SKIP_DERIVED_IMAGES", "UPDATE_BOUNDARY",
                                 "2000", "100", "NONE", "", "20", ".05")

print "Export Mosaic Dataset Geometry"
arcpy.ExportMosaicDatasetGeometry_management(md_name, Mosaicshp, "",
                                             "FOOTPRINT")

print "Delete Mosaicshp Fields"
arcpy.DeleteField_management(
    Mosaicshp,
    "MinPS;MaxPS;LowPS;HighPS;Category;Tag;GroupName;CenterX;CenterY;ZOrder;TypeID;ItemTS;UriHash"
)

raw_input("finish Running")