|
POST
|
Have you tried setting the output extent environment to the largest raster (provided it covers the entire area), or a feature class that covers the entire area of interest?
... View more
10-26-2016
10:06 AM
|
1
|
0
|
1394
|
|
POST
|
Here's my attempt. It's not necessarily the optimal. You could rotate the grid axes and compare to see which holds the most rectangles. There is also the distinct possibility that neither orientations optimally fill the original rectangle (i.e. there is often a remainder that could fit more small rectangles rotated by 90 degrees). recs = 'recs' # rectangle feature layer
mbr = arcpy.MinimumBoundingGeometry_management(recs,r'in_memory\mbr',mbg_fields_option='MBG_FIELDS') # get MBRs
grids = [] # merge list to be populated
out_grid = r'in_memory\out_grid' # final output
sr = arcpy.Describe(recs).spatialReference # CRS
grid_h = 20 # cell height, aligned to long axis of rectangle
grid_w = 10 # cell width, aligned to short axis of rectangle
with arcpy.da.SearchCursor(mbr,['SHAPE@','OID@','MBG_Width','MBG_Length','MBG_Orientation'], spatial_reference=sr) as cursor:
for row in cursor: # loop through MBRs
grid = r'in_memory\grid_' + str(row[1]) # temp grid
dy = math.cos(math.radians(row[4])) * row[3] # y diff along long side
dx = math.sin(math.radians(row[4])) * row[3] # x diff along long side
y_axis = str(row[0].firstPoint.X + dx) + ' ' + str(row[0].firstPoint.Y + dy) # rotation point
origin = str(row[0].firstPoint.X) + ' ' + str(row[0].firstPoint.Y) # starting point
arcpy.env.outputCoordinateSystem = sr # set CRS for fishnet
arcpy.CreateFishnet_management(grid,origin,y_axis,grid_w,grid_h,int(row[3]/grid_h),int(row[3]/grid_w),labels='NO_LABELS',geometry_type='POLYGON') # make fishnet
temp_lyr = 'sel_' + str(row[1]) # temp layer
arcpy.MakeFeatureLayer_management(grid,temp_lyr) # make feature layer
arcpy.SelectLayerByLocation_management(temp_lyr,"WITHIN_CLEMENTINI",row[0],selection_type='NEW_SELECTION') # select grid cells inside MBR
arcpy.SelectLayerByAttribute_management(temp_lyr,"SWITCH_SELECTION") # switch selection
arcpy.DeleteFeatures_management(temp_lyr) # delete cells outside MBR
grids.append(grid) # add to merge list
arcpy.Merge_management(grids,out_grid) # merge
... View more
10-25-2016
02:00 PM
|
0
|
0
|
766
|
|
POST
|
Add two new fields to your polygon file and calculate the centroid coordinates, using calculate geometry. You can control what CRS the coordinates use.
... View more
10-21-2016
10:13 AM
|
0
|
0
|
2290
|
|
POST
|
Can you provide a simple image of what you have and what you want?
... View more
10-20-2016
04:24 PM
|
0
|
4
|
2263
|
|
POST
|
Python parser, and I don't recall if I selected from the list or not, but it's correct. The label expression box doesn't use the normal !Field! notation, just to keep you on your toes.
... View more
10-20-2016
04:20 PM
|
1
|
4
|
7777
|
|
POST
|
Hmmm... this works for me (field type is Long): def FindLabel ( [CLIENTNUM] ):
return "{:,}".format(float([CLIENTNUM]))
... View more
10-20-2016
04:01 PM
|
1
|
7
|
7777
|
|
POST
|
There are several ways to figure this out - here's another: 1.) Make sure your country file has a field with country name or ID 2.) Spatial Join the countries to the states, based on HAVE_THEIR_CENTER_IN, although the relationship may depend on your data. 3.) Summary Statistics to COUNT the result from #2, case_field = country name or ID.
... View more
10-20-2016
02:33 PM
|
1
|
1
|
1373
|
|
POST
|
You can make this through the polygon's simple fill symbol outline property, using a regular line and a hash line symbol.
... View more
10-20-2016
10:35 AM
|
2
|
1
|
1148
|
|
POST
|
There is a working example in this thread. The main trick is to use datetime.datetime.strptime(), but it sounds like you've already correctly made a datetime object. Can you post the relevant code?
... View more
10-19-2016
02:21 PM
|
3
|
1
|
3406
|
|
POST
|
What is the datasource for the feature layer (FGDB feature class, PGDB feature class, shapefile, other) and what is the datatype of the field YR?
... View more
10-19-2016
09:36 AM
|
1
|
4
|
3383
|
|
POST
|
The Spatial Join geoprocessing tool has many more options than the menu spatial join tool, one of which is HAVE_THEIR_CENTER_IN.
... View more
10-19-2016
09:25 AM
|
1
|
1
|
3927
|
|
POST
|
You can do it through code, like Ted mentions (return "" if you don't want a label), or set an SQL query to filter the features you want labelled.
... View more
10-19-2016
09:18 AM
|
1
|
0
|
1948
|
|
POST
|
Try 'Yr IS NULL'. Otherwise, verify your expression in the tool GUI, and consult: Building a query expression—Help | ArcGIS for Desktop edit: it's also good practice to use AddFieldDelimiters to ensure correct field delimiters (brackets, quotes, or none). edit 2: once you get something to work through the GUI, you can right-click in the results window and copy as Python snippet to see the syntax. It looks like ArcGIS will accept this syntax: where_clause=""""YR" IS NULL""" (four double-quotes at the beginning, three at the end)
... View more
10-18-2016
04:09 PM
|
1
|
0
|
3383
|
|
POST
|
I'm not aware of something like a "flip" geoprocessing tool, but you can do this using arcpy geometry objects and an Update Cursor. Reading geometries—Help | ArcGIS for Desktop Writing geometries—Help | ArcGIS for Desktop
... View more
10-17-2016
10:19 AM
|
1
|
0
|
4493
|
|
POST
|
Do you have a polygon feature class for counties? If so, convert your spreadsheet to a shapefile (or other feature class), and Spatial Join those points to the counties. If not, I believe you're looking at a geocoding problem, about which others on here can lend more expertise than I can.
... View more
10-12-2016
04:41 PM
|
1
|
0
|
1037
|
| 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
|