|
POST
|
If that's how you want to use the date field (not worrying about real date), add 2000 to each seems to be a easy solution. 🙂 Yep, that is the easy part! 🙂 But this is the problem: The customer says, "Why does the label start at "2001"? It should be "0001"!". Since the dynamic time display label is based upon the date field, it cannot be manipulated or masked in a way that I could alter the 2001 to read 0001. Maybe I am missing something simple there, but from what I have found this simply cannot be altered as needed. Also, for some reason the "Export to Video" is sooo clunky. I can never get it to export individual frames (1 year is 1 frame) and it wants to skip years in irregular intervals even though I have all of the appropriate properties set on the layer and time slider. Very frustrating when you hit preview/play and it steps thru everything correctly but when attempting to export you get a video that starts at 2000 then year 2003, 20011, 2014... etc --- it never exports 2001, 2002, 2003...etc...
... View more
09-23-2013
09:51 AM
|
0
|
0
|
1379
|
|
POST
|
The File Geodatabase date field only supports dates from 12/31/1899 forward. I know this because the internal representation of the data is a number (exposed through the Summary Statistics tool). I know the internal representation of July 28, 2013 is 41483 days, which only allows 113 years back to day 0. The date field does not support negative numbers internally. I verified that the number of days between 12/31/1899 and 7/28/2013 is 41483 in Excel. So you will not be able to use an fgdb date field to do what you want. This should be documented with the other field data type descriptions and limitations in the help, but it isn't. Thanks Richard! I'm open to suggestions on where to go from here. I have 500 rasters in a raster catalog with a name sequence starting at "0001" and go thru to "0500". I had hoped to use this as a Year value, which I could then use in time enabled properties and get it to animate based upon this.
... View more
09-23-2013
06:44 AM
|
0
|
0
|
1379
|
|
POST
|
I need to calculate a date field of a FGDB raster catalog (but I guess it could be any table or fc for that matter). The field I need to convert is a string that contains date values in the format: '2013-09-23 10:01:50' or for your Python referenced format it is: '%Y-%m-%d %H:%M:%S' My problem is that (I think) the ESRI Date field has trouble with really early dates. For example, this how could I correctly set a date field value with this string: '0001-01-01 00:00:00' Yes, that is year "1". When I run the code below, it calculates the field but this example value above is set to '1/1/2001', dropping the hh:mm:ss and always starts in the 21st century. I need the date field to save it as the original string, but stored as a date --- I am using the Time Slider to create time-series animations and it is very finicky about using dates. Any help is appreciated! fld = "_dateText_str" updFld = "_dateText_str_Converted" cursor = arcpy.UpdateCursor(ras) for row in cursor: strVal = row._dateText_str dtVal = datetime.datetime.strptime(strVal, '%Y-%m-%d %H:%M:%S') row.setValue(updFld, dtVal) cursor.updateRow(row)
... View more
09-23-2013
06:16 AM
|
0
|
5
|
2143
|
|
POST
|
Hi, Our python script library is starting to get large and complex to the point that we are introducing unit testing to keep problems manageable. Has anyone had any experience creating Unit Tests for their python. How did you mock ArcGIS objects? Thanks Do you have a specific example in mind? I'm interested in this topic myself, but since the number of arcpy developers in our org is very small, the code base and testing we conduct is very project-focused and simply not much need to unit test a bunch of related libraries. My limited unit testing is usually kept to small items and not related to GIS objects. So things like string validation or variation tests might be done, but things such as database objects (cursors, rows of things, sql statements, etc...) are just not good candidates in my experience and I simply setup smaller functions/methods to perform a test (this allows me to clearly define connection and close operations to make sure things get killed properly).
... View more
09-12-2013
03:37 AM
|
0
|
0
|
4234
|
|
POST
|
dear members here i have been asked. what is the total time. here total time is numer of hours That is not specific enough answer. What FIELD TYPE is it? I assumed in my last post it is INTEGER, which would be an appropriate choice. See above for your solution.
... View more
09-12-2013
03:06 AM
|
0
|
0
|
3444
|
|
POST
|
Hornbydd, thanks for your time... I don't necessarily need a Python Addin, I need to write code to let a user define a custom Toolbar with custom commands and menus on the fly and make them persistent. What those commands and menus are supposed to do is currently not so important. The problem is, that I can't seem to create them otherwise and would like to know if I can create the Toolbars with Python. Hope, this makes it clearer. Regards Kianar Your most appropriate options are: 1. COM/ArcObjects Components 2. .NET Add-In Without knowing what kind of functionality you plan to build, I'd say any significant map interaction should be handled with ArcObjects as the Python mapping library simply is not that extensive and will limit your options. But as Hornbydd alludes to, it depends on the functionality you plan to provide. The biggest difference between the two options listed above I think resides with getting your tools distributed. I don't have experience with the .NET Add-in, but from what I understand it affords much more UI development tools than the Python Add-In does, but is more limited than a full-blown COM component. The .NET Add-In has the advantage of easy distribution, while the COM/ArcObjects tools will need to have Installer.msi/.exe component and must be run to get your tools installed on the end-user's workstation. I can assure you that IToolBardef, BaseCommand, ICommandItem all work fine and you simply need to do more research and testing to get it to work.
... View more
09-11-2013
03:28 AM
|
0
|
0
|
2157
|
|
POST
|
What is your output workspace/storage? Here is the Raster Storage Matrix to see if those parameters are available for the storage type you are writing to: http://resources.arcgis.com/en/help/main/10.1/index.html#//001w00000024000000
... View more
08-30-2013
04:53 AM
|
0
|
0
|
2552
|
|
POST
|
Stacy- Thank you for the ideas. I have playing around with the SearchCursor in Python and so far all I am getting it to do is to "Print" to the screen. What else would I have to do to extract this data out? I would get my Search Cursor into a pandas data frame and use that to group and plot as needed.
FeatClassArray = []
fc = r"H:\Documents\ArcGIS\Default.gdb\MyFeatureClass"
fields = [f.name for f in arcpy.ListFields(fc)]
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
FeatClassArray.append(row)
df = DataFrame(FeatClassArray)
#now use the df with matplotlib functionality to build your plots/graphs
... View more
08-27-2013
07:29 AM
|
0
|
0
|
3544
|
|
POST
|
# set the workspace
arcpy.env.workspace = r"C:\pathtomyworkspace"
#set a different workspace
arcpy.env.workspace = r"C:\pathtomydifferentworkspace"
#clean up all items in the workspace
fcs = arcpy.ListFeatureClasses()
tabs = arcpy.ListTables()
rasters = arcpy.ListRasters()
### for each FeatClass in the list of fcs's, delete it.
for f in fcs:
arcpy.Delete_management(f)
arcpy.AddMessage("deleted: " + f)
### for each TableClass in the list of tab's, delete it.
for t in tabs:
arcpy.Delete_management(t)
arcpy.AddMessage("deleted: " + t)
### for each Raster in the workspace, delete it
for r in rasters:
arcpy.Delete_management(r)
arcpy.AddMessage("deleted " + str(r))
Post the code you percieve to be too slow for opinions or suggestions on how to improve it.
... View more
08-26-2013
07:37 AM
|
0
|
0
|
1768
|
|
POST
|
matplotlib is definitely a good option. We also incorporate pandas data frames to help shape and group data and date ranges. As a final step, Attachements are enabled and populated in a File Geodatabase. Lots of possibilities and learning to do!
... View more
08-26-2013
04:12 AM
|
0
|
0
|
3544
|
|
POST
|
Please list the exact Feature Class name, its storage container type and the where clause you'd like to filter by. The way you have it now is an invalid SQL statement as the "SELECT *" is hardcoded into it and cannot include DISTINCT or GROUP BY, this requires a subquery (which also depends upon the storage database you are using). http://resources.arcgis.com/en/help/main/10.1/index.html#//00s50000002t000000 http://resources.arcgis.com/en/help/main/10.1/index.html#//00s500000033000000
... View more
08-26-2013
03:45 AM
|
0
|
0
|
916
|
|
POST
|
Don't you also need to specify the full layer.fieldname in the calculate (it looks like you did it for 'parcelTv.parcel_key' but what about "PARCEL_KEY"?)
arcpy.CalculateField_management('calcLyr',"originallyrname.PARCEL_KEY", 'parcelTv.parcel_key')
... View more
08-23-2013
10:26 AM
|
0
|
0
|
3038
|
|
POST
|
Not sure if this helps or hurts, but couldn't you: 1. Run RasterToPolygon_conversion to arrive at a polygon Feature Class. http://resources.arcgis.com/en/help/main/10.1/index.html#/Raster_to_Polygon/001200000008000000/ 2. Then go through a SearchCursor, set the shape extent for each row and this would get you the X Min, X Max, Y Min, Y Max values. Perhaps you could just populate a list or data frame with which you could pass back to your process/calling application. (sorry no working code to show on this one but you could probably whip something together pretty easily).
... View more
08-23-2013
07:58 AM
|
0
|
0
|
2442
|
|
POST
|
First, where are you setting "accdbtable1" or "Access_Trans_NodeTypeDetails" before invoking the TransportationAccess() method??? Second, I am unsure if the Access_Trans_NodeTypeDetails meets the requirement of the join operation. From the help http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000064000000 [INDENT]The Join Table can be any of the following types of tables: a geodatabase table (ArcSDE, file, or personal), a dBASE file, an INFO table, or an OLE DB table.[/INDENT] ...which I don't think your .accdb table meets any of these. One thing I would try is apply this to a TableView first, then join that to the FeatureLayer
def TransportationAccess(accdbtable1,gdbfeat1):
tblv = "accdbtab"
arcpy.MakeTableView_management(accdbtable1, tblv)
cursor.execute("delete * from " + accdbtable1) #clear table
#join Trans_NodeTypeDetails from geodatabase to Acces_Trans_NodeTypeDetails. Join fields NodeType and Stations
arcpy.joinfield_management((InputTransport+"\\"+gdbfeat1),"NodeType",tblv,"NodeType","Stations")
But why exactly are you attempting to "clear" accdbtable1 before the join operation??? That makes no sense to join an empty table. Also, that is untested above and I am not even sure if this is the problem but maybe worth a try.
... View more
08-19-2013
03:32 AM
|
0
|
0
|
1848
|
|
POST
|
Post the complete code. What is the error(s)? How are you connecting to the MS Access db? Perhaps you need to provide fully qualified table/field names for the join? Jut not enough info to give you a direct answer. james
... View more
08-16-2013
03:56 AM
|
0
|
0
|
1848
|
| 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
|