|
POST
|
You can try using openpyxl to write the excel 2007 documents: http://packages.python.org/openpyxl/ For pre-2007 documents try http://www.python-excel.org/
... View more
06-10-2011
06:33 AM
|
0
|
0
|
548
|
|
POST
|
Use the arcpy.NetCDFFileProperties() to examine the NetCDF's properties and dimension values. Here is some code that will examine the netcdf's properties and display all the values for each dimension. You can easily modify the code to you liking to only look the dimension value you specified in your code.
import arcpy
InNetCDF = r"C:\temp\tos_O1_2001-2002.nc"
try:
ncFP = arcpy.NetCDFFileProperties(InNetCDF)
ncDim = ncFP.getDimensions()
# loop through all dimension and show the value
for dim in ncDim:
print dim
top = ncFP.getDimensionSize(dim)
for i in range(0,top):
print ncFP.getDimensionValue(dim,i)
except:
print arcpy.GetMessages(2)
... View more
06-10-2011
04:20 AM
|
0
|
0
|
3358
|
|
POST
|
There is a layer property called isGroupLayer which returns a boolean value (true/false).
path = r"C:\temp\ds.mxd"
mxd = arcpy.mapping.MapDocument(path)
df = arcpy.mapping.ListDataFrames(mxd)
for frame in df:
for layer in arcpy.mapping.ListLayers(mxd, "*",frame):
print layer.name
print "isFeatureLayer - " + str(layer.isFeatureLayer)
print "isGroupLayer - " + str(layer.isGroupLayer)
del mxd
... View more
06-08-2011
02:54 AM
|
0
|
0
|
1431
|
|
POST
|
I made some changes to your model and it worked from ArcGIS Server 10 .NET. 1. Removed the delete in_memory at end of model 2. Remove in_memory from layer names 3. Changed the 2nd parameter in your zip script from required to derived 4. Dropped the custom save location, the server's scratch workspace should be used. The model will now return a zip file and that file can be used in the second step of your tool. Some other things to consider when publishing: 1. Do the SOM and SOC accounts have the proper permissions to run this task? 2. Is all the required data accessible by the SOC? 3. Enable local jobs directory 4. Turn on show messages when debugging online gp tools
... View more
05-27-2011
09:31 AM
|
0
|
0
|
1366
|
|
POST
|
Ok, how about just posting the model and script source code and describe what type of data you are using as inputs. Points, lines, polygons, etc... Thank you
... View more
05-27-2011
06:51 AM
|
0
|
0
|
1366
|
|
POST
|
Can you post your model with sample data? Thanks Hi Andrew, I initiated and tested the zip tool. See attached model. It works well on desktop and it did publish to a service without errors. Can you or anyone else see why this service is failing? Info about model: Enter a Graphical Boundary or a Boundary Feature Class: Data Type - Feature Set Sel_Bound: Managed - in_memory\Sel_Bound Bound_Lyr: in_memory\Bound_Lyr_%Model_Value% Parcel: %scratchworkspace%\Scratch.gdb\Output\Parcel_%Model_Value% InputFolderString: \\\GEOSERVER1\ServerData\Model1a\Scratch (it crashes on desktop without the extra \ ) Data Type - String Calculate Value: Expression - "%InputFolderString%", Data type - Folder Zip Folder script - Input Data Type: Any Value, Output Data Type: file Enter the location to place the Output Zip File (must be named *.zip): %scratchworkspace%\scratch.zip Thanks!
... View more
05-27-2011
05:18 AM
|
0
|
0
|
2896
|
|
POST
|
Like I said, multiple output feature classes are not supported right now. Can you combine your whole process into a single model without using sub-models? Maybe you should consider using a python script instead of doing a pure model builder process.
... View more
05-26-2011
07:02 AM
|
0
|
0
|
2896
|
|
POST
|
Iterate value worked for my published model, I think your problem stems from the return type. It looks like you are trying to return each feature class, which isn't supported at this time. In short, Multi-feature outputs aren't supported yet. I would suggest returning a zip file to the end user of your extracted data. Andrew
... View more
05-26-2011
06:24 AM
|
0
|
0
|
2896
|
|
POST
|
Did you follow all the guidelines found here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Checklist_for_authoring_and_publishing_geoprocessing_services/002v0000000w000000/ Are all results being written to %ScratchWorkspace% or %ScratchWorkspace%\scratch.gdb ?
... View more
05-26-2011
05:28 AM
|
0
|
0
|
2896
|
|
POST
|
You need to create a layer object and add the then pass a description text as a string to the layer property. You can try something like this:
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
lyr.description = "some text"
lyr.save()
del mxd
See the layer properties here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s300000008000000.htm for more information.
... View more
04-18-2011
05:37 AM
|
0
|
0
|
1610
|
|
POST
|
Try checking out your 3D extension.
class LicenseError(Exception):
pass
import arcview
import arcpy
from arcpy import env
try:
if arcpy.CheckExtension("3D") == "Available":
arcpy.CheckOutExtension("3D")
else:
# raise a custom exception
#
raise LicenseError
#<Enter your code here>#
arcpy.CheckInExtension("3D")
except LicenseError:
print "3D Analyst license is unavailable"
except:
print arcpy.GetMessages(2)
... View more
04-01-2011
07:05 AM
|
0
|
0
|
942
|
|
POST
|
Hello, Here are some links that explain the syntax a little better from the web help: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s500000033000000.htm and http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Building_a_query_expression/00s50000002t000000/ Hope this helps, Andrew
... View more
03-04-2011
01:23 AM
|
0
|
0
|
2287
|
|
POST
|
Try not putting the field name in quotes and the like statement should work. Here is what I did to get it to work:
import arcpy
expression = "Text LIKE '?%'"
cadFile = r"c:\temp\CADfile.dwg\Annotation"
cursor = arcpy.SearchCursor(cadFile, expression)
for row in cursor:
print row.getValue("Text")
del row, cursor
Result:
>>>
?69570190
?69570430
?69570440
?69570550
>>>
... View more
03-02-2011
02:55 AM
|
0
|
0
|
2287
|
|
POST
|
In your code you have this: desc = arcpy.Describe(prjFile). The variable prjFile is not defined. Since you are pointing to a featureclass, you can just access the featureclass' spatial reference directly without having to use the .prj file:
import arcpy
# Get the feature class to describe
#
featureClass = arcpy.GetParameterAsText(0)
desc = arcpy.Describe(featureClass)
# Print some SpatialReference object properties
SR = desc.spatialReference
print SR.name
# shows results in commandline of IDLE
print SR.exportToString()
# Show results in geoprocessing tool dialog
arcpy.AddMessage(SR.name)
arcpy.AddMessage(SR.exportToString())
... View more
02-22-2011
08:08 AM
|
0
|
0
|
2637
|
|
POST
|
You can use Describe and tool validation to check the projections before running tools. Hope this helps
... View more
02-22-2011
02:11 AM
|
0
|
0
|
2637
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2017 05:56 AM | |
| 1 | 03-28-2018 03:28 AM | |
| 1 | 07-24-2017 05:39 AM | |
| 1 | 06-01-2016 03:48 AM | |
| 1 | 01-27-2016 02:53 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|