POST
|
Thanks, this works by confirming the calculation of date difference. timedelta is definitely the key. I will now work on incorporating Joshua's example to use a cursor. import arcpy
import datetime
from datetime import timedelta
# Set Date Variables
today = datetime.date.today()
daysAgo30 = today - timedelta(days=30)
print "Today is: " + " " + str(today)
print "30 days ago is:" + " " + str(daysAgo30)
... View more
01-31-2018
08:03 AM
|
0
|
0
|
897
|
POST
|
Thanks for the advice. SYSDATE - Is this from the import sys module ? I tried this but with an error using SYSDATE
... View more
01-30-2018
03:47 PM
|
0
|
1
|
897
|
POST
|
I am trying to use a search cursor to look up a date field to only return LastUpdates within the last 30 days. today = datetime.date.today() I want to use the datetime and date field types which are in different formats and is why I can't calculate the difference. How can I format them the same to accomplish this ?
... View more
01-30-2018
03:21 PM
|
0
|
20
|
2441
|
POST
|
Great advice, I don't have access to Pro yet. Would have been real easy to use this setting. I have looked at the correlated documentation and have not come across a solution. This Optimized Hot Spot Analysis is convenient also since it gives me counts per polygon . My alternative requires several steps. Point density (raster) Change raster (float to integer) Raster to polygon Spatial Join to get counts (Requires cleaning up or ensuring all point density output have 100 foot squares.
... View more
12-20-2017
09:17 AM
|
0
|
3
|
622
|
POST
|
I keep getting a cell size of 57 feet which is automatically set. I want to manually set the cell size of the generated fishnet polygons around the points. I tried the environment settings XY Resolution Tolerance but the tool ignores my input. How can I get this to work or is there another way ? Thank you
... View more
12-20-2017
08:44 AM
|
0
|
6
|
1485
|
POST
|
Thanks, I used the Raster Calculator syntax helper to double click the Int option to correctly complete the expression.
... View more
12-19-2017
07:56 AM
|
0
|
0
|
20210
|
POST
|
Perfect, that is what I needed. It works now . Thank you.
... View more
12-18-2017
03:54 PM
|
0
|
0
|
20210
|
POST
|
I am using the Raster Calculator Tool to change my raster from a float to a integer so I can eventually change run Raster to Polygon (need to integer raster input) I ran the tool several times using the following expression)but my result is still a float. "pointden100ft" * 1000000000 The expression is very easy as I consulted the following ESRI tips https://support.esri.com/en/technical-article/000012554 Any ideas what is causing the issue ?
... View more
12-18-2017
01:28 PM
|
0
|
6
|
33830
|
POST
|
I changed it up trying to get it to work and used while instead for loop. I noticed that all the records all selected then all records unselected so the cursor is not working like I want it to. One by one import arcpy, time
mxd = arcpy.mapping.MapDocument ('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
field = "OBJECTID"
# y = input("Type Layer Name :")
fc = r'Orders_High_RD'
lyr = arcpy.mapping.ListLayers(mxd, fc, df)[0]
##df.extent = lyr.getSelectedExtent()
df.scale = 1000 # we set the scale to 1000
##arcpy.RefreshActiveView()
cursor = arcpy.SearchCursor(fc)
row = cursor.next()
while row:
row = cursor.next()
## print (row.getValue(field))
## time.sleep(5)
arcpy.SelectLayerByAttribute_management(fc,"NEW_SELECTION")
time.sleep(5)
df.extent = lyr.getSelectedExtent()
arcpy.RefreshActiveView()
## df.zoomToSelectedFeatures()
## arcpy.RefreshTOC()
... View more
11-09-2017
10:00 AM
|
0
|
1
|
519
|
POST
|
great advice, I will work with this, and it seems I would not want the DF.zoomToSelectedFeatures()
... View more
11-09-2017
09:11 AM
|
0
|
0
|
519
|
POST
|
This makes sense, where exactly would I put it, as I know I want to pause after each selected record. What is the difference between using df.zoomToSelectedFeatures() & df.extent = lyr.getSelectedExtent()
... View more
11-09-2017
07:47 AM
|
0
|
2
|
519
|
POST
|
I know I almost have this right but it selects all records and doesn't zoom to each record - one by one import arcpy
mxd = arcpy.mapping.MapDocument ('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
# y = input("Type Layer Nmae :")
fc = r'Orders_High_RD'
lyr = arcpy.mapping.ListLayers(mxd, fc, df)[0]
#df.extent = lyr.getSelectedExtent()
df.scale = 1000 # we set the scale to 1000
#arcpy.RefreshActiveView()
with arcpy.da.SearchCursor(fc, "OBJECTID") as cursor:
row = cursor.next()
for row in cursor:
df.extent = lyr.getSelectedExtent()
arcpy.SelectLayerByAttribute_management(fc,"NEW_SELECTION")
#df.zoomToSelectedFeatures()
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
... View more
11-08-2017
04:00 PM
|
0
|
7
|
1022
|
POST
|
I would like to post it after I modify the code some more to use ListFields rather than manually hardcode the field names. Also, one last section of tying in the max() value to the auto increment () function, which I haven't had a chance to test yet, but soon.
... View more
10-16-2017
02:36 PM
|
0
|
0
|
759
|
Title | Kudos | Posted |
---|---|---|
1 | 11-03-2016 06:52 AM | |
1 | 05-10-2016 10:27 AM | |
1 | 02-06-2017 01:22 PM | |
1 | 05-01-2018 07:23 AM | |
1 | 03-03-2017 02:46 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|