|
POST
|
Hi Charles, You can export your model to a python script by clicking on the Model menu within ModelBuilder > Export > To Python Script. Once the script is export and you add your additional code, you can add it back to the toolbox by right-clicking on the toolbox > Add > Script. Next, run the script by double-clicking on it. Once it completes successfully, open up the Results window (Geoprocessing menu > Results). Under Current Session, right-click on the completed script > Share As > Geoprocessing Service.
... View more
08-28-2013
04:43 AM
|
0
|
0
|
1401
|
|
POST
|
Here is an example on how to accomplish this. First, you will want to create a sample graph in ArcMap. Here is a screen shot of the parameters I used: [ATTACH=CONFIG]27045[/ATTACH] After the graph is created, right-click on it and save it out as a .grf file. Now you can use the below code to create a graph of the "KW Demand by Meter" by specifying a meter number: import arcpy
from arcpy import env
env.overwriteOutput = 1
env.workspace = r"C:\temp\python\test.gdb"
table = "Meters"
arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + arcpy.GetParameterAsText(0))
out_graph_name = arcpy.GetParameterAsText(0)
out_graph_pdf = r"C:\Temp\python\Userdata" + "\\" + arcpy.GetParameterAsText(0) + ".pdf"
input_template = r"C:\Temp\Python\UserData\KW Demand.grf" #grf file previously saved
input_data = r"in_memory\table_sel"
# Create the graph
graph = arcpy.Graph()
# Add a vertical bar series to the graph
graph.addSeriesBarVertical(input_data, "KW_DEMAND")
# Specify the title of the left axis
graph.graphAxis[0].title = "KW Demand"
# Specify the title of the bottom axis
graph.graphAxis[2].title = "Meter Number"
# Specify the title of the Graph
graph.graphPropsGeneral.title = "KW Demand by Meter"
# Output a graph, which is created in-memory
arcpy.MakeGraph_management(input_template, graph, out_graph_name)
# Save the graph as an image
arcpy.SaveGraph_management(out_graph_name, out_graph_pdf, "MAINTAIN_ASPECT_RATIO", 600, 375)
... View more
08-28-2013
03:59 AM
|
0
|
0
|
4507
|
|
POST
|
Here is an example on how to accomplish this. First, you will want to create a sample graph in ArcMap. Here is a screen shot of the parameters I used: [ATTACH=CONFIG]27044[/ATTACH] After the graph is created, right-click on it and save it out as a .grf file. Now you can use the below code to create a graph of the "KW Demand by Meter" by specifying a meter number: import arcpy
from arcpy import env
env.overwriteOutput = 1
env.workspace = r"C:\temp\python\test.gdb"
table = "Meters"
arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + arcpy.GetParameterAsText(0))
out_graph_name = arcpy.GetParameterAsText(0)
out_graph_pdf = r"C:\Temp\python\Userdata" + "\\" + arcpy.GetParameterAsText(0) + ".pdf"
input_template = r"C:\Temp\Python\UserData\KW Demand.grf" #grf file previously saved
input_data = r"in_memory\table_sel"
# Create the graph
graph = arcpy.Graph()
# Add a vertical bar series to the graph
graph.addSeriesBarVertical(input_data, "KW_DEMAND")
# Specify the title of the left axis
graph.graphAxis[0].title = "KW Demand"
# Specify the title of the bottom axis
graph.graphAxis[2].title = "Meter Number"
# Specify the title of the Graph
graph.graphPropsGeneral.title = "KW Demand by Meter"
# Output a graph, which is created in-memory
arcpy.MakeGraph_management(input_template, graph, out_graph_name)
# Save the graph as an image
arcpy.SaveGraph_management(out_graph_name, out_graph_pdf, "MAINTAIN_ASPECT_RATIO", 600, 375)
... View more
08-28-2013
03:54 AM
|
0
|
0
|
3570
|
|
POST
|
Hi Jonathan, This is unfortunately a bug at 10.2, and has been logged, #NIM093766: When uploading to My Hosted Services, arcpy.UploadServiceDefinition fails with error "000732 Server: Dataset My Hosted Services does not exist or is not supported".]. The severity of the bug has been marked as High. The only workaround at the moment is to manually upload the service.
... View more
08-27-2013
12:56 PM
|
0
|
0
|
1847
|
|
POST
|
Hi Caroline, Are you looking to create a feature class for each column in the attribute table? If so, you can run the Feature Class to Feature Class tool and delete the fields from the Field Map section that you do not want to include.
... View more
08-27-2013
08:38 AM
|
0
|
0
|
784
|
|
POST
|
It looks like it isn't the saving of the raster that is taking a long time, but the series of processes executed beforehand. Can you post your entire script?
... View more
08-27-2013
08:28 AM
|
0
|
0
|
1790
|
|
POST
|
Hi Alcaraz, You can use the Fishnet tool to create a polygon fishnet using the extent and cell size of your raster. You can then use the Search Cursor to return the xmin, ymin, xmax, and ymax of each polygon. cursor = arcpy.SearchCursor(fc)
for row in cursor:
print row.Shape.extent.XMin, row.Shape.extent.YMin, row.Shape.extent.XMax, row.Shape.extent.YMax
del cursor, row
... View more
08-27-2013
07:13 AM
|
0
|
0
|
2454
|
|
POST
|
Hi Zuoqi, Try executing the following: import arcpy
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
myRaster = CreateRandomRaster(100, 0.25, Extent(0, 0, 750, 625))
path = r"C:\path"
myRaster.save(path+"\\raster" ) How long does it take to execute?
... View more
08-27-2013
06:57 AM
|
0
|
0
|
1790
|
|
POST
|
Hi Greg, You can use a wildcard in the ListFields function, and then pass the returned list to the DeleteField function. Ex: fc = r"C:\temp\test.gdb\project" list = [] PR = "some text" for field in arcpy.ListFields(fc, "FID_GE41_REG_SBPD_MOB_"+PR+"_WOR_*"): list.append(field.name) arcpy.DeleteField_management(fc, list)
... View more
08-27-2013
06:39 AM
|
0
|
0
|
2309
|
|
POST
|
Hi Nadeem, If you don't have to use the field calculator, the below should work: import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"
list = []
rows = arcpy.SearchCursor("Table")
for row in rows:
Class = row.getValue("Class")
list.append(Class)
del row, rows
#remove duplicates from list
list = dict.fromkeys(list)
list = list.keys()
for n in list:
rec = 0
rows = arcpy.UpdateCursor("Table")
for row in rows:
if row.Class == n:
pInterval = 1
if (rec == 0):
rec = 1
row.SeqNumber = rec
else:
rec = rec + pInterval
row.SeqNumber = rec
rows.updateRow(row)
del row, rows
... View more
08-27-2013
04:26 AM
|
0
|
0
|
639
|
|
POST
|
Try using the Recover File Geodatabase tool, and then see if you can run the arcpy.ListTables function on the recovered FGD.
... View more
08-20-2013
05:47 AM
|
0
|
0
|
2466
|
|
POST
|
Yes, you can use the InsertCursor with an SDE connection file. Just set your env.workspace variable to wherever your .sde file is. Ex: import arcpy from arcpy import env env.workspace = r"Database Connections\GIS.sde"
... View more
08-20-2013
05:07 AM
|
0
|
0
|
1103
|
|
POST
|
If you are looking to insert a row into a SQL Server table, take a look at the ArcSDESQLExecute class. If you are looking to insert a row into an SDE geodatabase table, you can use the InsertCursor function.
... View more
08-20-2013
03:23 AM
|
0
|
0
|
1103
|
|
POST
|
Are you using the GP tools to create the replica? Try using the 'Create Replica' tool on the Distributed Geodatabase toolbar and see if you receive the same error.
... View more
08-06-2013
02:46 AM
|
0
|
0
|
2834
|
|
POST
|
Hi Manoj, This is not new functionality at 10.2. At the beginning of the tutorial, it states the following: The steps in this tutorial assume that you have an available ArcGIS Server that has an enterprise geodatabase registered as its managed geodatabase. See more information about a managed geodatabase here. If the service type you want to publish requires an enterprise geodatabase, you must first create an enterprise geodatabase and register it as ArcGIS Server's Managed Database. When you publish, the data referenced by your GIS resource will be copied into this enterprise geodatabase.
... View more
08-05-2013
03:52 AM
|
0
|
0
|
843
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM |
| Online Status |
Online
|
| Date Last Visited |
7 hours ago
|