|
POST
|
If you have standard or advanced licensing, I believe you could use Simplify Polygon to get only the corner points, add XY coordinates for each point, then use a tool like Summary Statistics to get specific corners (SW would MIN Y, MIN X, grouped by polygon ID). edit: I wrote that last part too fast. The SW point would be the nearest of the four points to MIN X, MIN Y, not MIN X, MIN Y. You could also find the corner directions by assigning each corner an angle from the centroid and grouping that way.
... View more
10-12-2016
11:08 AM
|
1
|
0
|
10105
|
|
POST
|
Here is a Python translation of Daniel's recipe above. It works, technically, but is exceedingly slow because there is a selection for every fishnet cell. A better solution would involve reading the fishnet features into a data structure of some sort and operating on that, but that gets quite a bit more complicated. fc = 'fishnet' # feature layer
with arcpy.da.UpdateCursor(fc,['SHAPE@','MEAN']) as cursor: # get each fishnet geometry and field to store mean
for row in cursor: # loop
arcpy.SelectLayerByLocation_management(fc,"WITHIN_A_DISTANCE",row[0],'100',"NEW_SELECTION") # make selection
sum = 0 # initialize sum
count = int(arcpy.GetCount_management(fc).getOutput(0)) # count number of selected features
with arcpy.da.SearchCursor(fc,['POP']) as cursor2: # loop through selected features, reading population value
for row2 in cursor2:
sum += row2[0] # add to current sum
row[1] = sum/count # calculate and store mean
cursor.updateRow(row) # write mean to feature layer
... View more
10-12-2016
10:15 AM
|
1
|
1
|
2751
|
|
POST
|
My guess would be to set the sampling type to CELLSIZE and set the sampling value to 1 for both in the LAS Dataset to Raster tool. The tool also honors the Cell Size and Snap Raster environments, so you can try setting those to be double sure that the rasters match exactly..
... View more
10-11-2016
01:10 PM
|
2
|
0
|
3958
|
|
POST
|
Are you starting with the raw LAS pointcloud file or a processed bare earth raster?
... View more
10-11-2016
11:49 AM
|
0
|
2
|
3958
|
|
POST
|
Concatenate the desired fields together in each file to make a unique match. E.g. "Country_State_City" in Excel matches "Country_State_City" in the feature class.
... View more
10-07-2016
11:40 AM
|
1
|
2
|
1459
|
|
POST
|
If I understand correctly, you've got one set of original points (with an ID) and a different set of snapped points (with a matching ID). You can get the distance between the two for each point by adding XY coordinates to each feature class, join together using the ID, and do the math in the new column to get the distance.
... View more
10-06-2016
04:25 PM
|
1
|
1
|
1367
|
|
POST
|
You can do it using Python: >>> import os
... workspace = r'C:\junk' # starting directory
... lyr_dict = {} # empty dictionary
... for root, dirs, files in os.walk(workspace, topdown=True): # starting traversing directories
... for file in files: # loop through file names
... if file.endswith('.mxd'): # if it's an mxd
... mxd = arcpy.mapping.MapDocument(os.path.join(root,file)) # make map object
... lyrs = arcpy.mapping.ListLayers(mxd) # list layers
... for lyr in lyrs: # loop through layers
... if lyr.supports('dataSource'): # if the layer supports dataSource property
... lyr_dict.setdefault(lyr.dataSource,[]).append(mxd.filePath) # add to dictionary The above script creates a dictionary like {layer_path1:[mxd,mxd,mxd...], layer_path2:[mxd,mxd,mxd...]...}
... View more
10-06-2016
04:01 PM
|
1
|
1
|
1570
|
|
POST
|
If this is something you're going to have to do regularly and for an extended period, you should at least be aware of versioned data, which you can reconcile between old and new versions.
... View more
10-06-2016
02:08 PM
|
0
|
0
|
1240
|
|
POST
|
There may be a better way than this, but you can manually insert line break characters at the end of each write statement. Below will result in different lines but no commas. The commented option will add a comma to every line, including the final line. You could add a little extra logic to check if you're at the final item in the list and not add a comma. onlyfiles = [f for f in listdir(dir_src) if isfile(join(dir_src, f))]
file = open("log.txt", 'w')
for onlyfile in onlyfiles:
file.write(str(onlyfile) + '\n') # or ',\n' if you want the trailing comma
file.close()
... View more
10-06-2016
10:41 AM
|
1
|
2
|
2195
|
|
POST
|
You don't need to use Arcpy (but you certainly can). You could use either Summary Statistics or Dissolve, setting the statistics fields to your 50+ fields and statistics type to SUM for all. You can do this manually through the interface, or build a list for Python ([[field1, 'SUM'],[field2,'SUM']...]) by looping through the output of ListFields.
... View more
10-06-2016
09:31 AM
|
1
|
0
|
1045
|
|
POST
|
Yeah, I hate dates, too. I've gotten by only using the final section of the datetime help page, where it explains strptime (converts string to datetime), strftime (converts datetime to string), and the date formatting codes. import datetime
my_string = '7:30AM March 15, 2000' # some date
dt = datetime.datetime.strptime(my_string, '%H:%M%p %B %d, %Y') # create datetime object from string
my_new_string = dt.strftime('%H-----%M') # create a string from some parts of the datetime object
print my_new_string Result: 07-----30 Some things I think about (whether they're wrong or right): - the datetime object is sort of formatless, but has all formats available through strftime (I suspect the format is defined in the help) - datetime objects are very smart when it comes to date operations (like "what is the time 2074 minutes from 9:00pm on Friday, June 29?") - those date formatting codes are important, and that's how you pull out the time components of the datetime object via strftime()
... View more
10-04-2016
06:17 PM
|
0
|
1
|
2357
|
|
POST
|
I think the difference you're seeing between my example and yours, is that I'm writing the datetime object to a geodatabase date field through the field calculator and you're printing the datetime object directly. From Fundamentals of date fields—Help | ArcGIS for Desktop: "A geodatabase formats the date as datetime yyyy-mm-dd hh:mm:ss AM or PM." So, no matter in which date format Python or my system settings would like to display the datetime object, once it's written to the geodatabase date field, it will be yyyy-mm-dd hh:mm:ss AM or PM. Since you're printing the raw datetime object, it's either the Python datetime object itself or your system time settings that control what format it displays in the print output. Regarding time only format, you will have to format the datetime object into a string using strftime(), and write it to a string type field (won't work in date type field).
... View more
10-04-2016
05:28 PM
|
1
|
7
|
5474
|
|
POST
|
Did you import datetime? Otherwise, what's the full error message?
... View more
10-04-2016
05:11 PM
|
1
|
0
|
5474
|
|
POST
|
I'll just point out the minimum requirements: ArcGIS 10.3.x for Desktop system requirements—Help | ArcGIS for Desktop For my two cents, if you're an undergrad taking ArcGIS classes, you can likely get away with somewhat less than a graduate student/GIS professional analyzing real data, since the classes are likely more about learning ArcGIS than crunching heavy data. It also depends how frequently you're going to be using ArcGIS. If infrequently, you can probably live with some lag, but if you're using it all day everyday, a few seconds/minutes starts to add up. I've got 12GB RAM and use ArcGIS fulltime, and I still complain about it being slow. edit: you should also check with your university program for recommendations. For example, I bought a fairly nice computer in preparation for my schooling, only to find out that my program used ArcGIS in a virtual environment (i.e. hooking into their computers virtually), so all I really needed was a fast internet connection because I was using their CPU/RAM.
... View more
10-04-2016
02:21 PM
|
1
|
0
|
2757
|
|
POST
|
think I need to add this into Python or is there a date handler of some sort to do that conversion? Yes, the normal way to deal with date/time in Python is via datetime. e.g. Expression: getdate( !Hour! , !Minute! ) Codeblock: import datetime
def getdate(hour, minute):
return datetime.datetime.strptime(str(hour).zfill(2) + ' ' + str(minute).zfill(2), '%H %M') Result:
... View more
10-04-2016
01:23 PM
|
1
|
10
|
5474
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|