|
POST
|
Here's how you can do it with arcpy geometries (10.1+): >>> fc = "grid" # input feature layer
... sr = arcpy.Describe(fc).spatialReference # spatial ref
... points = []
... lines = []
... polys = []
... fields = ["SHAPE@","var1","var2","var3","var4","var5","var6","var7","var8"] # geometry plus 8 variables
... maxDist = 5 # value multiplier
... with arcpy.da.SearchCursor(fc,fields,spatial_reference=sr) as cursor: # loop through features
... for row in cursor:
... centre = row[0].centroid # centre point
... newPolyPoints = []
... for i in range(1,9): # loop through variables
... x = centre.X + math.cos(math.radians(i*45))*row*maxDist # x offset
... y = centre.Y + math.sin(math.radians(i*45))*row*maxDist # y offset
... newPoint = arcpy.PointGeometry(arcpy.Point(x,y),sr) # create point geometry
... points.append(newPoint)
... newLine = arcpy.Polyline(arcpy.Array([centre,newPoint.centroid]),sr) # make ray lines
... lines.append(newLine)
... newPolyPoints.append(newPoint.centroid)
... newPoly = arcpy.Polygon(arcpy.Array(newPolyPoints),sr) # make snowflake polygon
... polys.append(newPoly)
... arcpy.CopyFeatures_management(points,r'in_memory\points') # write points
... arcpy.CopyFeatures_management(lines,r'in_memory\lines') # write lines
... arcpy.CopyFeatures_management(polys,r'in_memory\polys') # write polygons
... View more
10-29-2015
11:00 AM
|
1
|
2
|
2559
|
|
POST
|
As Dan says, Near is the default answer for Advanced licensing, and the lesser-considered Spatial Join (using CLOSEST relationship and specifying a distance field) will yield the distance from point to closest line for all license levels.
... View more
10-28-2015
08:56 PM
|
0
|
1
|
1348
|
|
POST
|
I'm sure I'm missing the point, but why not just change your data frame coordinate system to something like Plate Carree and export, as usual?
... View more
10-28-2015
02:17 PM
|
1
|
0
|
1610
|
|
POST
|
Can you provide a comparative screenshot? Is it just a display thing - have you applied the same kind and amount of stretching to each raster?
... View more
10-28-2015
01:50 PM
|
0
|
0
|
2504
|
|
POST
|
You probably noticed that 1956736 ~ 100 x 19568. Is your cell size the same between the two rasters, or perhaps 10x larger (10*10=100)? To directly answer your question the COUNT column is the count of cells for each value. For slightly more information, see here.
... View more
10-28-2015
01:25 PM
|
1
|
1
|
10489
|
|
POST
|
As Rebecca Strauch, GISP says, have you consulted the help page for the tool giving the error? At the bottom, there are examples, including the third one that shows how to construct valid "out_event_properties" for input point features: props = "rkey POINT mp" # Example of valid out_event_properties parameter
... View more
10-28-2015
12:57 PM
|
2
|
0
|
1643
|
|
POST
|
Building on Duncan Hornby's suggestion, I think the idea is to build a geoprocessing tool and then open it in response to an add-in button click event. See here for opening tool dialogs through the pythonaddins module's GPToolDialog() function.
... View more
10-28-2015
10:52 AM
|
1
|
0
|
2093
|
|
POST
|
I can't test anything because this tool requires Advanced licensing, but two things jump out: 1.) Have you upgraded since the script last worked? 2.) The help says that the input features can have a selection, but says nothing about the near features having a selection. When you export your layer to the feature class, it has no selection. Have you tried running your script on a feature layer with no selection? (I don't know why this would be the case, but it seems to fit your situation)
... View more
10-28-2015
10:41 AM
|
1
|
1
|
1668
|
|
POST
|
Are your layer and data frame in the same projected coordinate system?
... View more
10-27-2015
04:33 PM
|
1
|
4
|
3345
|
|
POST
|
The image is in a jpeg form and it is saved in the same geodatabase file which has all of the other associated project files, shapefiles, etc. There is something fishy going on here, mostly to do with terminology. You cannot have a jpeg inside a geodatabase. Once you import a jpeg into a gdb it is converted to a geodatabase raster. You cannot simply drag and drop a jpeg into a gdb folder. So, my main is: do you have a jpeg in a folder, a geodatabase raster in a geodatabase, or an incorrectly imported jpeg sitting in a geodatabase?
... View more
10-27-2015
01:32 PM
|
0
|
0
|
6065
|
|
POST
|
Is there a selection in your ArcMap session? It looks like you once made a selection and then commented it out. If there is no prior selection, you are running up against a couple of quirks of GetCount and SelectLayerByLocation. 1.) GetCount returns the count of all features if there is no selection. Your variable "prematchcount" returns a count of all features because there is no selection. Later, "postmatchcount" returns a count of all features, because all features are selected. 2.) When you use "SWITCH_SELECTION", the second and third parameters are ignored, so there is no spatial component to the tool whatsoever at that point.
... View more
10-27-2015
10:07 AM
|
1
|
1
|
2326
|
|
POST
|
It sounds like you are describing Batch Processing, which provides you with a grid of the tool parameters with each row being a tool run (right-click the tool in the toolbox and choose "Batch"). You can drag and drop layers and fill down the columns to speed things up. When you click OK, it will run the tool once for each row.
... View more
10-27-2015
09:29 AM
|
1
|
0
|
2035
|
|
POST
|
I think Dan Patterson had it 95% right the first time (the chg and pos arrays are great), and then bypassed the problem and took it to the moon. Really, you just need to append the first array (12 items) to itself (24 items) to capture the wraparound. >>> import numpy as np
... year1 = np.array([1,0,0,1,1,1,1,0,1,1,1,1],dtype=bool) # year data
... print year1
... doubleYear1 = np.append(year1,year1) # append year data to itself
... print doubleYear1
... chg = (doubleYear1[:-1] ^ doubleYear1[1:]) # change array. Ingenious, really.
... print chg
... pos = np.arange(len(chg))[chg] # indices of change
... print pos
... diff = np.diff(pos) # difference between n+1 and n
... print diff
... max_seq = np.max(diff) # max
... print max_seq
... if max_seq > 12:
... max_seq = 12
[ True False False True True True True False True True True True]
[ True False False True True True True False True True True True
True False False True True True True False True True True True]
[ True False True False False False True True False False False False
True False True False False False True True False False False]
[ 0 2 6 7 12 14 18 19]
[2 4 1 5 2 4 1]
5
... View more
10-26-2015
11:45 PM
|
0
|
1
|
2176
|
|
POST
|
If you search for "split layer by attribute", you'll find a few options, like here and here. I thought there was a similar tool out-of-the-box in ArcGIS, but I can't seem to find it.
... View more
10-26-2015
02:11 PM
|
1
|
0
|
2035
|
|
POST
|
The search term is "point clustering". There's an example for AGOL here.
... View more
10-26-2015
01:58 PM
|
0
|
0
|
1316
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-25-2015 01:51 PM | |
| 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 |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|