how to automate ArcGIS map production using Python?

المشرف العام

Administrator
طاقم الإدارة


the problem is when i use the layout of one part from the fishnet i got 24 empty PDFs and only one with the layout i already start with , But when i use the layout of the whole map it kind of works , and i got 25 PDFs with the 25 parts of the Fishnet but it look like this
so who can help me to get PDFs with those parts but on the whole page !

gp=arcgisscripting.create() arcpy.env.overwriteOutput=True mxd=arcpy.mapping.MapDocument(r"D:\PFE\data\carte.mxd") df=arcpy.mapping.ListDataFrames(mxd, "*")[0] print df

source_geod= arcpy.mapping.Layer(r"D:\PFE\data\PFE\traitement\geod.lyr") source_RR= arcpy.mapping.Layer(r"D:\PFE\data\PFE\traitement\RR.lyr") source_oueds= arcpy.mapping.Layer(r"D:\PFE\data\PFE\traitement\oueds.lyr") source_SBKA= arcpy.mapping.Layer(r"D:\PFE\data\PFE\traitement\SBKA.lyr") source_Veg= arcpy.mapping.Layer(r"D:\PFE\data\PFE\traitement\Veg.lyr")

i=0 fc=(r"D:\PFE\data\fishnet1.shp") rows=arcpy.SearchCursor(fc)

for row in rows: print i print row

layerFishnet_src=gp.MakeFeatureLayer_management(fc, "lyr") layerFishnet=gp.SelectLayerByAttribute_management("lyr", "NEW_SELECTION",'("FID" = ' + str(i) + ')' ) geod_i= arcpy.Clip_analysis(r"D:\PFE\data\Geod.shp", layerFishnet, r"D:\PFE\data\Geod_"+str(row.getValue("FID"))+".shp") rr_i= arcpy.Clip_analysis(r"D:\PFE\data\RR.shp", layerFishnet, r"D:\PFE\data\RR_"+str(row.getValue("FID"))+".shp") oueds_i= arcpy.Clip_analysis(r"D:\PFE\data\oueds.shp", layerFishnet, r"D:\PFE\data\oueds_"+str(row.getValue("FID"))+".shp") SBKA_i= arcpy.Clip_analysis(r"D:\PFE\data\SBKA.shp", layerFishnet, r"D:\PFE\data\SBKA_"+str(row.getValue("FID"))+".shp") Veg_i= arcpy.Clip_analysis(r"D:\PFE\data\Veg.shp", layerFishnet, r"D:\PFE\data\Veg_"+str(row.getValue("FID"))+".shp") geoidlyr=gp.MakeFeatureLayer_management(geod_i, "geoidlyr") rrlyr=gp.MakeFeatureLayer_management(rr_i, "rrlyr") ouedslyr=gp.MakeFeatureLayer_management(oueds_i, "ouedslyr") SBKAlyr=gp.MakeFeatureLayer_management(SBKA_i, "SBKAlyr") Veglyr=gp.MakeFeatureLayer_management(Veg_i, "Veglyr") geoid=arcpy.mapping.Layer(geoidlyr) rr=arcpy.mapping.Layer(rrlyr) oueds=arcpy.mapping.Layer(ouedslyr) SBKA=arcpy.mapping.Layer(SBKAlyr) Veg=arcpy.mapping.Layer(Veglyr) lyrr = arcpy.mapping.ListLayers(mxd)[3] print lyrr lygeoid = arcpy.mapping.ListLayers(mxd)[2] print lygeoid lyoueds = arcpy.mapping.ListLayers(mxd)[4] print lyoueds lySBKA = arcpy.mapping.ListLayers(mxd)[6] print lySBKA lyVeg = arcpy.mapping.ListLayers(mxd)[5] print lyVeg arcpy.mapping.UpdateLayer( df, lygeoid ,geoid, false ) arcpy.mapping.UpdateLayer( df, lyrr ,rr, False) arcpy.mapping.UpdateLayer( df, lyoueds ,oueds, False) arcpy.mapping.UpdateLayer( df, lySBKA ,SBKA, False) arcpy.mapping.UpdateLayer( df, lyVeg ,Veg, False) titleTxt= arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "title") titleTxt=row.getValue("name") print titleTxt arcpy.mapping.ExportToPDF(mxd,r"D:\PFE" + row.getValue("name") + ".pdf") i = i + 1

أكثر...
 
أعلى