from arcpy import CheckOutExtension as check_licence
from arcpy import CalculateField_management as calc_champ
from arcpy import MakeFeatureLayer_management as trans_lyr
from arcpy import SelectLayerByAttribute_management as sel_attr

from arcpy.sa import PointStatistics as stats_pts
from arcpy.sa import NbrCircle

from sys import exit as EXIT



# Environnement de travail
env.workspace = "D:\\Julien\\tratamientos\\mask"

# Masque
env.mask = "D:\\Julien\\tratamientos\\mask\\t_t328.ovr"

# Variables
pts = "D:\\Julien\\tratamientos\\mask\\New_Manzana_poblacion_punto.shp"
lyr = trans_lyr(pts)
chp = "3tipos_5cl"

cell = 15
neighb = NbrCircle(600, "CELL")

# Vérification des licences nécessaires
check_licence("Spatial")

res_stat_pts = stats_pts(pts, chp, cell, neighb, "MAJORITY")
res_stat_pts.save("D:\\Julien\\tratamientos\\mask\\statpts_output")
Пример #2
0
        chps_code = chps[0:3] + chps[-2:] + "_code"
        new_champ(mailles, chps_code, "TEXT", 1)
        provis.append(chps_code)


def eff_prov(li_chps):
    """Efface les champs provisoires"""
    print "Suppression des champs provisoires"
    for chps in li_chps:
        del_champ(mailles, chps)


### Couche cible
mailles = "D:\\Julien\\tratamientos\\mallas\\shp\\LE_octogonos-tipo_aglo49D.shp"
print "Transformation du shape en .lyr"
lyr = trans_lyr(mailles)

### Fichier excel
print "Création et configuration du fichier excel"
book = xlwt.Workbook(encoding="Latin-1")
feuy1 = book.add_sheet("Global", cell_overwrite_ok=True)
feuy2 = book.add_sheet("Esenciales", cell_overwrite_ok=True)
feuy3 = book.add_sheet("Frequences", cell_overwrite_ok=True)
font1 = xlwt.Font()  # création police 1
font1.name = "Times New Roman"
font1.bold = True

entete = xlwt.XFStyle()  # création style pour les en-têtes
entete.font = font1

# Intitulé