|
POST
|
Caleb, Thanks for you reply. Yes GridValue is and integer--actually it will most likely be a float value. The code should actually look like this: field = "ELEVATION"
cursor = arcpy.SearchCursor(GAGELayer)
for row in cursor:
ElValue = float(row.getValue(field))
exp = "\"" + field + "\" = " + ElValue + ""\"
arcpy.SelectLayerByAttribute_management (GAGEMergeLayer, "NEW_SELECTION", exp) I tried exp = '"{0}" = {1}'.format(field, GridValue) and I'm still getting: ExecuteError: ERROR 000358: Invalid expression Could it be because ElValue is an integer and you are attempting to concatenate it into a string? Maybe try changing this line: exp = "\"" + field + "\" = " + str(ElValue) + "\""
... View more
06-07-2013
09:54 AM
|
0
|
0
|
1356
|
|
POST
|
Curt or anyone else that has experience with the USGS waterservices webservice, We have developed some Geoprocessing tools that are integrating the Instantaneous Values Web Service (http://waterservices.usgs.gov/rest/IV-Service.html) and using the return xml to create hydrographs, dynamic maps (.mxd's) that add these hydrographs as attachments to a FGDB, and some limited efforts to publish these to our internal ArcGIS Online portal. These are mostly tools for status reporting and supplemental materials in larger reports. All is working great but we'd like to expand them a bit... Without getting too far into the details of the geoprocessing tools and the outputs, we are also interested in accessing some of the other more detailed statistics that are available from the groundwaterwatch page(s) that generate the percentile ranking statistics over the period of record for individual wells for each month. What is not clear is that the DV Webservice (http://waterservices.usgs.gov/rest/DV-Test-Tool.html) inidcates that a statistic "statCd" parameter can be included in the url string. And looking at the list of Statistics Codes (http://help.waterdata.usgs.gov/stat_code), it appears that these percentile values are available. However, when ever I include this parameter into the url string, nothing is returned. For example, http://waterservices.usgs.gov/nwis/dv/?format=waterml,1.1&sites=262218080070101&period=P120D¶meterCd=62601&statCd=01900 Any tips? Is the chart in the site statistic section from this page http://groundwaterwatch.usgs.gov/AWLSites.asp?S=264005080233501&ncd= available from one of the webservices? Can it generate an XML construct? Thanks! james
... View more
06-07-2013
09:29 AM
|
0
|
2
|
1291
|
|
POST
|
Not sure what the format of you table is, but is sounds like it is actually a FGDB table. According to the help docs here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000002n000000 Perhaps you just need to makeTableView first, then join to that? R_ Thanks again for the tip. Yes, I am correctly applying the join operation with both arcpy.MakeFeatureLayer_management and arcpy.MakeTableView_management.
... View more
06-06-2013
04:23 AM
|
0
|
0
|
2201
|
|
POST
|
I can confirm that it doesn't work by doing a simple join when inside of an FGDB, you'd need to perform arcpy.CopyRows_management() prior to joining. But better than that, have you seen arcpy.da.ExtendTable? That looks to do what you need in one command. EDIT/Update: the CopyRows_management is a viable workaround since I am not dealing with a large amount of rows and is a much simpler approach rather than trying to include the ExtendTable method. Still I am frustrated the NumpyArrayToTable doesn't work as expected. Shaun, Thanks for the input! The ExtendTable is used to join to an existing table, so the first thing I do is build a numpy.array with a single field from a simplified DataFrame (one that contains all of the correct/necessary value for the join operation) and pass this into the arcpy.da.NumPyArrayToTable. So this gives me an existing table to execute the ExtendTable method, using the full numpy array I wish to join with the Feature Class. The output table is all correct. However, when I run the final join operation to the Feature Class I get the same result (no matches found). I'll change some things up and see if I can get this working. Thanks again, j
... View more
06-05-2013
06:24 AM
|
0
|
0
|
2201
|
|
POST
|
Hopefully I am missing the obvious here, but there are issues with an output FGDB table (Default.gdb) that is the product of NumPyArrayToTable. Has anyone had any issues with this? There are no apparent issues or problems with the actual conversion, no errors and the output table appears just fine (I can load it into ArcMap and view the contents, even the field properties are all correct). But for some reason, this output does not succesfully join to another layer (either programatically or manually). The join operation does not fail or error, but no matches are found. However, if I export this FGDB table to a .dbf, it joins as expected. code snip: ##convert final pandas DataFrame result into a numpyarray dfar = dfarrcombo.to_records() nmpyar = np.array(dfar, np.dtype([('staname', '|S25'), ('STATION', '|S25'), ('site', '|S25'),('change', '<f8'),('pastvalue', '<f8'), ('currentvalue', '<f8')])) ##now covert the numpyarray to the gdb table in the default.gdb arcpy.da.NumPyArrayToTable(nmpyar, r"H:\Documents\ArcGIS\Default.gdb\numpytab") #....the rest of the code is a join operation
... View more
06-04-2013
10:53 AM
|
0
|
5
|
3130
|
|
POST
|
so only saved rasters in a file geodatabase seem to work - IMGs and GRIDs and temporary grids cause errors in decimal seconds. We've just resigned to the fact that the system engineers and developers at ESRI must have integrated the FGDB into the software (Default.gdb) for a good reason and that perhaps it's a good idea to just use them too. Most raster processing problems we've encountered have been overcome by switching to FGDB's as the default output containers. I think you have made a good choice in doing the same. The problem I have is this. For some relatively long (geoprocessing wise) period of time after I've finished reading from or writing to a raster, the raster remains locked, and cannot be overwritten nor deleted. Currently, I'm working around this problem by writing each intermediate raster to a unique filename. This leaves me with a massive collection of unneeded intermediate files cluttering up my geodatabase. I'm a little confused: can you not delete each unique raster? You should be able to and seems like an okay approach to get around your scratch raster issue. You may have to post up some code snippets.
... View more
05-30-2013
04:01 AM
|
0
|
0
|
3365
|
|
POST
|
Ah yes, one of those new 10.1 arcpy.da features I was referring to. However, I need a v.10 solution. 😛 But your idea is a good one. Regards doh! bummer!
... View more
05-23-2013
12:21 PM
|
0
|
0
|
1670
|
|
POST
|
Thanks for the replies. I'm aware of the options you have suggested but I really need to invoke a function because one of the parameters needs to be a clob. I could use the cx_Oracle module but then I get back a non-ESRI cursor that I then have to convert. Ordinarily not a big deal but I have to do this a lot on a lot of data and in the interest of performance and maintenance. I see v.10.1 has expanded the arcpy.da module with functionality that may do the trick. Just to throw this out there, what about NumPyArrayToTable? Wondering if you just add the cx_Oracle cursor (from the result of your function call) into an array then let the method do the work -- rather than doing all the gymnastics to get the field mapping done. Not sure but I may have to look into this myself. http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000016000000
... View more
05-23-2013
11:49 AM
|
0
|
0
|
1670
|
|
POST
|
Does the ArcSDESQLExecute class support calling Oracle functions? If yes, does it further support the return of a ref_cursor? I've tried sql = "call BlahFunction()" sdeReturn = conn.execute(sql) Regards I am not sure if this is supported. We are implementing the cx_Oracle library for all of our attribute queries and other data processing (it's then utilized with arcpy in one form or another). It is a bit of a pain to get the field mapping done, but it has been an overall great way to integrate non-spatial data stored in Oracle db's. Here is an example of calling a function (we are not doing this yet. We simply construct and pass in complete SQL statements to build cx_oracle cursor objects). http://stackoverflow.com/questions/8048124/cx-oracle-can-callfunc-return-list
... View more
05-23-2013
04:03 AM
|
0
|
0
|
1670
|
|
POST
|
By the looks of this http://gis.stackexchange.com/questions/23914/how-to-get-the-size-of-a-file-geodatabase-feature-class-on-disk you could probably get at this info with ArcObects someway. edit: yup.. http://gis.stackexchange.com/questions/24242/how-to-programmatically-determine-the-size-of-a-feature-class-in-a-file-geodatab ArcObjects will get it done.
... View more
05-21-2013
11:34 AM
|
0
|
0
|
6654
|
|
POST
|
Unless its a shapefile, I don't believe there is currently a way to do this with arcpy in v10.1. Good point. I guess you'd have to implement some kind of your own logging process on the gdb to maintain info on modification dates. Not sure exactly how you'd work out the size of GDB elements too other than creating individual .shp files or gdb's of each item. ewww.
... View more
05-21-2013
11:27 AM
|
0
|
0
|
6654
|
|
POST
|
There doesn't appear to be a function in arcpy to return the file size of a feature class or it's date modified timestamp. Anyone have any idea how to do this? I know there is a property somewhere because you can setup ArcCatalog to display the information. However, I want to see it returned in a Python Script so that I can write a two-way synchronization function. os.path has both of the methods you want (I have not worked with these myself). os.path.getmtime os.path.getsize http://docs.python.org/2/library/os.path.html
... View more
05-21-2013
07:24 AM
|
0
|
0
|
6654
|
|
POST
|
Ok I'm a newbie in this area so I need to understand how exceptions are raised... Below is my Add-in code which is essentially the example for a button on a toolbar in the ArcGIS 10.1 Python wizard help. I've added the error handling..... So the problem is that nothing happens - the button does not work but neither are there any exceptions raised... So what am I doing wrong? The add-in toolbar appears in the project, the button is enabled but no exceptions appear in the python window and I have no indication the code is executing. import arcpy
import pythonaddins
class ButtonClass11(object):
"""Implementation for test_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
try:
# Implementation of OnClick method of Button's class
def onClick(self):
# Get the current map document and the first data frame.
mxd = arcpy.mapping.MapDocument('current')
df = arcpy.mapping.ListDataFrames(mxd)[0]
# Call the zoomToSelectedFeatures() method of the data frame class
df.zoomToSelectedFeatures()
pass
except Exception, e:
traceback.print_exc() Maybe a dumb question, but do you have any features selected when you click the button? You can also put a print statement before and after the line you expect to 'do stuff'. In the code above, you can test the zoomToSelectedFeatures method like so,
print "...attempting to run zoomToSelected"
# Call the zoomToSelectedFeatures() method of the data frame class
df.zoomToSelectedFeatures()
print "...finished running zoomToSelected"
This will output the two statements in the Python window when you click the add-in button. Just a quick and dirty way to debug.
... View more
05-21-2013
03:43 AM
|
0
|
2
|
1542
|
|
POST
|
The two feature classes in question are in the same feature dataset, so yes they are the same projection. And the data frame projection is the same as the feature dataset's, so I know it's not a projection issue. If you suspect the tolerance is the issue, perhaps you can attempt to select by location with a search distance parameter. Something like (untested):
arcpy.SelectLayerByLocation_management(lyrL, "WITHIN_A_DISTANCE", lyrP, 2, "NEW_SELECTION")
I am a bit unsure of the linear unit you should set and the above is untested only pulled from the help: http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000072000000 Sorry --- I just don't have specific experience with this scenario. j
... View more
05-21-2013
03:33 AM
|
0
|
0
|
1029
|
| 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
|