|
POST
|
Thanks. I understand the concept and am glad there will be improved status reporting. However I still can't get either method to work. Here is the code: class PostReconcile(object):
"""Implementation for street_centerlines_addin.btn1 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
arcpy.ReconcileVersions_management(db,"ALL_VERSIONS","SDE.Default","CD_LYN.lyn","LOCK_ACQUIRED","NO_ABORT","BY_OBJECT","FAVOR_TARGET_VERSION","POST","KEEP_VERSION")
arcpy.CopyFeatures_management(fc,shp1)
arcpy.CopyFeatures_management(fc,shp2)
arcpy.CopyFeatures_management(fc,shp3)
arcpy.CopyFeatures_management(fc,shp4)
arcpy.CopyFeatures_management(fc,shp5)
pythonaddins.MessageBox('Copied files to local drive', 'INFO', 0) When I press the button, it just runs with no message popup. I also tried a print statement, but nothing shows in the Python window. Must have it in the wrong spot... Just as a test, try eliminating everything except for your message --- maybe something in the code above it is failing and causing the message to not display?
class PostReconcile(object):
"""Implementation for street_centerlines_addin.btn1 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
pythonaddins.MessageBox('Copied files to local drive', 'INFO', 0)
... View more
05-22-2014
05:41 AM
|
0
|
0
|
2208
|
|
POST
|
positives = arcpy.SearchCursor("cwdpts4Anlys",' "ELISALYMPHNODE" = \'Positive\' ' , "", "SAMPLE_ DATE" ' Just a quick note: you have it as "SAMPLE_ DATE", not "SAMPLE_DATE". It could just be a copy/paste into the forum post editor, but you may want to take a quick look at your source code to verify this isn't the problem.
... View more
05-16-2014
12:28 PM
|
0
|
0
|
1209
|
|
POST
|
https://www.google.com/search?q=this+installation+package+is+not+supported+by+this+processor&rls=com.microsoft:en-us&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1#q=cx_oracle+this+installation+package+is+not+supported+by+this+processor&rls=com.microsoft:en-us http://stackoverflow.com/questions/18275802/cx-oracle-module-installation-error-message
... View more
05-16-2014
05:04 AM
|
0
|
0
|
1402
|
|
POST
|
...In 10.3 we've thought about this and we're adding a progress dialog into the pythonaddins module. kewl. Now about those UI's.....
... View more
05-15-2014
10:36 AM
|
0
|
0
|
2208
|
|
POST
|
Depends on where in the Add-In you are wanting to generate the message popup. Here is the onMouseDownMap event of a ToolClass implementation: import pythonaddins def onMouseDownMap(self, x, y, button, shift): msg = "You just clicked in the map display" pythonaddins.MessageBox(msg, 'Report Click Event', 0)
... View more
05-15-2014
08:52 AM
|
0
|
0
|
2208
|
|
POST
|
for fld in arcpy.ListFields('my_feature_class'):
if fld.name == 'unwanted_field':
'add field delete code here
... View more
05-15-2014
06:44 AM
|
0
|
0
|
2236
|
|
POST
|
can you inform me about the version of cx_Oracle and Python that i should install that are compatible with the above mentioned softwares? I have no idea. also what are the steps that i must execute to access Oracle from Python, and use cx_oracle with python ?? is it obligate to install ArcGIS if yes what is the version that I should install?? thank you very much. There's tons of examples with a simple google search. Here's some snipets from an implementation we have (it's been modified for posting here and is for generic example only)
### Build a DSN (can be subsitited for a TNS name)
dsn = cx_Oracle.makedsn("myconn", instance, schema)
oradb = cx_Oracle.connect("User", "Password", dsn)
cursor = oradb.cursor()
_sqlQry = """SELECT table1.Field1, table1.Field2 FROM table1 WHERE table1.Field1 IN (""" + parameter1 + """)""""
cursor.execute(_sqlQry)
datArray = []
cxRows = cursor.fetchall()
for cxRow in cxRows:
datArray.append(cxRow)
#close the conn to ora
cursor.close()
oradb.close()
del cxRows, cursor
#I also incorporate the Pandas library for doing computations and table operations
DF = DataFrame(datArray, columns=['field1', 'field2'])
#convert pandas DataFrame result into a numpyarray
dfar = DF.to_records()
nmpyar = np.array(dfar, np.dtype([('field1', '|S25'), ('field2', '<f8')]))
##now covert the numpyarray to the gdb table in the default.gdb
arcpy.da.NumPyArrayToTable(nmpyar, r"H:\Documents\ArcGIS\Default.gdb\numpytab")
... View more
05-13-2014
05:10 AM
|
0
|
0
|
1402
|
|
POST
|
Derscribe works on rasters too but just use arcpy.GetRasterProperties_management method to get extents.
ws = r'C:\MyDir\MyFGDB.gdb'
arcpy.env.workspace = ws
rasters = arcpy.ListRasters()
for raster in rasters:
desc = arcpy.Describe(raster)
nam = desc.name
print "Results for " + str(nam)
result_top = arcpy.GetRasterProperties_management(raster, "TOP")
result_bot = arcpy.GetRasterProperties_management(raster, "BOTTOM")
result_left = arcpy.GetRasterProperties_management(raster, "LEFT")
result_right = arcpy.GetRasterProperties_management(raster, "RIGHT")
print "extent top: " + str(result_top)
print "extet bottom: " + str(result_bot)
print "extent left" + str(result_left)
print "extent right" + str(result_right)
... View more
05-12-2014
07:45 AM
|
0
|
0
|
2348
|
|
POST
|
Assuming that your ClimateData table is non-spatial, not registered with ArcSDE --- we utilize the cx_Oracle library for integrating non-spatial Oracle schemas/db's/tables/views/etc... Basically it goes like: 1. Fill cx_Oracle cursor with a parameterized SQL statement that executes against the table/view and fills the cursor with the results. 2. Convert the cursor to a NumPy Array, then to a table (arcpy.da.NumPyArrayToTable) 3. Join the table to the Feature Class. 4. Create a new layer with the joined attributes. 5. Symbolize the new output FC using the attributes joined. Also, the majority of this occurs in_memory workspace and just the output FC is written to disk somehwere so it makes things easy to cleanup.
... View more
05-12-2014
07:36 AM
|
0
|
0
|
1402
|
|
POST
|
http://forums.arcgis.com/threads/98696-Turning-fields-on-and-off-using-arcpy
... View more
05-07-2014
10:54 AM
|
0
|
0
|
729
|
|
POST
|
In my tests, the registered events on python app extension add-in was fired fine! The unique problem is: I need the feature owner of this fired event. (like AO does with class extension) If you need, i can send the python add-in and the code base here. I have yet to build an Add-In Extension and unfamiliar with it's features.
... View more
05-07-2014
10:12 AM
|
0
|
0
|
1706
|
|
POST
|
Hi James, I'm not confusing with ArcObject COM component, it is new for me too. Look this link http://resources.arcgis.com/en/help/main/10.1/index.html#/application_extension/014p00000018000000/ I'm just following the ESRI sample to create a python add-in application extension, and assign-in to listen the ChangeFeatureEvent. When i was testing to do in this way (python add-in) i have seen a differences between AO ClassExtension x Python add-in Application Extension In AO Class extension we need to "install" in all class that we want to this extension will be called. In Python extension we need to enable the extension that we create on Extensions toolbar and then the python application extension will listen all layers (registered events on python add-in app extension) Ah I see. All of the google results reference ArcObjects development.
... View more
05-07-2014
09:56 AM
|
0
|
0
|
1706
|
|
POST
|
I'm doing tests with python addin, capturing the event onChangeFeature to can manipulate fields of the changed feature. I could capture the event, but the event don't give me the changed feature. I believe there is a simple way to get the changed feature, right? How can i do it? I wasn't aware that a Python Add-In had an OnChangeFeature event. Could you show us what you are testing? An Add-In could have a ButtonClass with an onClick event or a ToolClass can have onMouseDown, onDblClick, onRectangle, etc... events but no such thing as a way to capture onChangeFeature. http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_a_Python_add_in/014p00000025000000/ Are you confusing this with an ArcObjects COM component?
... View more
05-07-2014
09:38 AM
|
0
|
0
|
1706
|
|
POST
|
PythonWin gives you row and column numbers of the cursor postion down at the lower right corner of the app window.
... View more
05-06-2014
07:32 AM
|
0
|
0
|
1287
|
|
POST
|
for lyr in arcpy.mapping.ListLayers(mxd): if lyr.isGroupLayer: #Then lyr is a Group Layer for sublyr in lyr: #now sublyr is an item in the group or something to this effect. (above is pulled from existing tool that is just to show a general idea and will not work exactly for your needs)
... View more
05-01-2014
06:12 AM
|
0
|
0
|
3971
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|