zoukankan      html  css  js  c++  java
  • 通过GP加载卫星云图-雷达图-降雨预报图

    # ---------------------------------------------------------------------------
    # MeteorologicalImageLoad.py
    # Created on: 2014-01-24 08:33:03.00000
    # Created by SmartMap
    # Usage: MeteorologicalImageLoad <analyzeType> <analyzeResult>
    # Description:
    # ---------------------------------------------------------------------------


    import arcpy
    import shutil
    import os,sys

    arcpy.env.overwriteOutput = True


    projectNameSatelliteImage = 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",4326]]'
    projectNameWaterReport = 'PROJCS["Asia_North_Equidistant_Conic",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Equidistant_Conic"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",95.0],PARAMETER["Standard_Parallel_1",15.0],PARAMETER["Standard_Parallel_2",65.0],PARAMETER["Latitude_Of_Origin",30.0],UNIT["Meter",1.0],AUTHORITY["ESRI",102026]]'
    projectNameWeatherRadar = 'PROJCS["Asia_Lambert_Conformal_Conic",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",105.0],PARAMETER["Standard_Parallel_1",30.0],PARAMETER["Standard_Parallel_2",62.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["ESRI",102012]]'

    analyzeResult = "%scratchworkspace%\analyzeResult.img"

    # Script arguments
    analyzeType = arcpy.GetParameterAsText(0)
    if analyzeType == '#' or not analyzeType:
    analyzeType = "SatelliteImage"

    imageDirectory = "D:\data\SpatialData\sourceDir\" + analyzeType
    copyTargetPath = "D:\data\SpatialData\targetDir\default" + analyzeType + ".jpg"
    inputLinkFile = "D:\data\SpatialData\targetDir\" + analyzeType + "Tic.txt"

    lastTime = 0
    lastFilePath = "#"
    if imageDirectory and imageDirectory != '#':
    fileList = os.listdir(imageDirectory) #列出目录下的所有文件和目录
    for line in fileList:
    filepath = os.path.join(imageDirectory,line)
    if os.path.isfile(filepath):
    # os.stat(filepath).st_ctime
    lastModifyTime = os.path.getctime(filepath)
    if lastModifyTime > lastTime :
    lastTime = lastModifyTime
    lastFilePath = filepath

    if lastFilePath == "#":
    lastFilePath = "D:\data\SpatialData\default" + analyzeType + ".jpg"

    shutil.copy(lastFilePath, copyTargetPath)
    # Process: Register Raster
    arcpy.RegisterRaster_management(copyTargetPath, "REGISTER", "", inputLinkFile, "POLYORDER1", "")

    # Process: Copy Raster
    arcpy.CopyRaster_management(copyTargetPath, analyzeResult, "", "", "256", "NONE", "NONE", "", "NONE", "NONE")

    # Process: 定义投影
    if analyzeType == 'SatelliteImage':
    projectName = projectNameSatelliteImage
    elif analyzeType == 'WeatherRadar':
    projectName = projectNameWeatherRadar
    elif analyzeType == 'WaterReport':
    projectName = projectNameWaterReport
    else:
    projectName = projectNameSatelliteImage

    arcpy.DefineProjection_management(analyzeResult, projectName)

    arcpy.SetParameterAsText(1, analyzeResult)

  • 相关阅读:
    Codeforces Round #439 (Div. 2) B. The Eternal Immortality
    Codeforces Round #439 (Div. 2) A. The Artful Expedient
    Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0
    ClassLoader
    UVA 10790 How Many Points of Intersection?
    HDU 4628 Pieces
    Java学习笔记——可视化Swing中JTable控件绑定SQL数据源的两种方法
    thrift之TTransport层的分帧传输类TFramedTransport
    VB6基本数据库应用(四):数据的提取,新增和修改
    android 开发中判断网络是否连接的代码
  • 原文地址:https://www.cnblogs.com/gispathfinder/p/5693827.html
Copyright © 2011-2022 走看看