|
POST
|
I'm trying to write a script to add raster layer to my mxd from the server but i am not sure if the path to the server is correct ? import arcpy, os arcpy.env.workspace=(r"S:\Las Cruces SSO\GIS_Master_Data\NAIP_2009\Dona Ana") mxd = arcpy.mapping.MapDocument(r"E:\ArcMap\Retrieve_NAIP.mxd") df = arcpy.mapping.ListDataFrames(mxd,"Layers") addlayer = arcpy.mapping.Layer('S:/Las Cruces SSO/GIS_Master_Data/NAIP_2009/Dona Ana') arcpy.mapping.AddLayer(df, addlayer,"AUTO_ARRANGE") mxd.saveACopy("E:\ArcMap\Retrieve_NAIP.mxd") del mxd, addlayer look at the number 05 here is that the raster reside is on the server . The mxd file is on my hard drive. Thanks, Robert
... View more
02-17-2015
01:32 PM
|
0
|
2
|
4571
|
|
POST
|
On page 169 of the Programming ArcGIS 10.1 with Python cookbook. Step 6 says to type this : for row in sorted(cursor): But if you look at the number 04 which gave the error because PyScripter could not defined cursor ? I have also type this 04 code into Python window and it showed it doesn't defined cursor is .... import arcpy.da arcpy.env.workspace ="c:/ArcpyBook/Ch9" arcpy.da.SearchCursor("Schools.shp",("Facility","Name")) for row in in sorted(cursor): print("School name: " + row[1])
... View more
02-15-2015
11:49 AM
|
0
|
6
|
6154
|
|
POST
|
Hi All, I am trying to write a script to call a variable to inform that your exported has been completed. Please take a take a look at here to see if this is correct or not . Thanks #------------------------------------------------------------------------------- # Name: Export PDF # Purpose: To export MapLayout to PDF # Author: Robert.Pollock # Created: 10/02/2015 # Copyright: (c) Robert.Pollock 2015 #------------------------------------------------------------------------------- import arcpy.mapping, os str = "Your PDF exported has been delivered to your folder, Thank you" mxd = arcpy.mapping.MapDocument("E:\FY2015_projects\Mimbres Ranch River\Mimbres River Ranch2.mxd") arcpy.mapping.ExportToPDF(mxd,r"E:\workspace\PDF\MimbresRiverRanch34x44") ## Print message to complete the exported processed print arcpy.GetMessages(print str.rjust(50, '0') Thank you for your help
... View more
02-12-2015
07:14 AM
|
0
|
1
|
4615
|
|
POST
|
Somebody in the office deleted a point shapefile that has a lyr file as well. How can I recovery it ? Scripts ? Thanks
... View more
02-11-2015
05:52 PM
|
0
|
3
|
5204
|
|
POST
|
Hi all, I am curious if there is a snippet codes that can I get or share from someone so I can write script that allows me to watch the process showing time backwards or show how long the process til the end ? I can't find it on the python documentation or ArcGIS python ? Does someone have a good one that I can share with ? Thanks.
... View more
02-11-2015
01:46 PM
|
0
|
2
|
4991
|
|
POST
|
Never mind. I did checked and ListLayers still there and I think the main problem is I copied and paste when I first started and gave me bunch of problems so I am thinking instead of copy and past . I might have to do typing rather than copy and paste ? What do you say ?
... View more
02-10-2015
12:05 PM
|
0
|
0
|
1005
|
|
POST
|
Thanks. I went back to Pyscripter and try again and change from gridlayers to imagelayer Now I see that ListLayers had the errror so I am thinking that by looking at the Varibales and it is not there... is that why it could not run it ?
... View more
02-10-2015
11:26 AM
|
0
|
1
|
1005
|
|
POST
|
My Pyscripter versions is 2.5.3.0 x86 Is that correct for ArcGIS 10.1 Python 2.7 ?
... View more
02-09-2015
11:40 AM
|
0
|
3
|
1005
|
|
POST
|
I am thinking maybe it is not working.How can Pyscripter communicate with ArcMap if I write these codes ?
... View more
02-09-2015
11:37 AM
|
0
|
1
|
3309
|
|
POST
|
I did the same thing what you suggest. I can try and run it from Python window but Pyscripter should be able to recongize it. Can I run this script from Pyscripter rather than in python window ?
... View more
02-09-2015
10:56 AM
|
0
|
1
|
3309
|
|
POST
|
Here you go: mport arcpy.mapping, os mxd = arcpy.mapping.MapDocument (r"E:\workspace\Test.mxd") arcpy.env.workspace = r"E:/workspace/images/" df = arcpy.mapping.ListDataFrames(mxd)[0] df.scale = 40000 gridlayer = arcpy.mapping.ListLayers(mxd,'JERGRIDINDEX', df,)[0] arcpy.SelectLayerByAttribute_management(gridlayer, "NEW_SELECTION") for row in arcpy.SearchCursor(gridlayer): df.panToExtent(row.shape.extent) arcpy.RefreshActiveView() filename = "E:/workspace/images/" + \ str(row.getValue("PageNumber")).zfill(4) + ".tif" arcpy.mapping.ExportToTIFF(mxd, filename, df, df_export_width= 65000, df_export_height=30000,geoTIFF_tags=True) ## arcpy.mapping.ExportToTIFF(mxd, filename, df, df_export_width= 1280, \ ## df_export_height=440, geoTIFF_tags=True) print arcpy.GetMessages()
... View more
02-09-2015
10:33 AM
|
0
|
3
|
3309
|
|
POST
|
I am having an syntax error from Pyscripter here and not sure why but I have a shapefile at the top of the TOC list which is the first and should be number zero when writing a listlayers as a zero but I still get the error . The error is : Traceback (most recent call last): File "C:\Student\python\GeoTIFF.py", line 16, in <module> gridlayer = arcpy.mapping.ListLayers(mxd,'JERGRIDINDEX', df,)[0] IndexError: list index out of range Take a look here the sytanx:: gridlayer = arcpy.mapping.ListLayers(mxd,'JERGRIDINDEX', df,)[0]
... View more
02-09-2015
10:13 AM
|
0
|
13
|
8041
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Monday | |
| 1 | 04-08-2026 10:11 AM | |
| 1 | 09-01-2022 03:43 PM | |
| 1 | 09-28-2020 09:34 AM | |
| 2 | 09-24-2025 09:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|