|
POST
|
Here is an example of getting the % of nulls in a raster.
# calculate % no data cells in a raster.
import sys, os, arcpy
from arcpy import env
from arcpy.sa import *
if arcpy.CheckExtension("Spatial"):
arcpy.CheckOutExtension("Spatial")
else:
print "No SA licence"
exit
HomeDir = "c:/Data/Swala/BurkinaFaso/IPSurvey/"
fgdb = "IPRasterData.gdb"
InData = os.path.join(HomeDir, fgdb)
env.workspace = InData
env.overwriteOutput = True
ListRast = arcpy.ListRasters()
# ListTable = arcpy.ListTables()
for r in ListRast:
print "Processing", r
Ras = arcpy.Raster(r)
NullRas = IsNull(Ras)
NCol = NullRas.width
NRow = NullRas.height
NCell = NCol * NRow
Mean = NullRas.mean
NNull = Mean * NCell
print "{} % Null {}".format(r, NNull / NCell * 100)
... View more
09-26-2014
12:52 AM
|
1
|
11
|
3779
|
|
POST
|
In ArcMap you insert a new data frame. Several frames if you like. These can then have different locations on your layout.
... View more
09-25-2014
05:20 AM
|
0
|
0
|
775
|
|
POST
|
Not sure how you have arrived at the picture you have presented. But if you are converting various polygon datasets to a raster representation for some sort of SA based overlay analysis or something, why not use the Polygon to Raster tool : http://resources.arcgis.com/en/help/main/10.2/index.html#//001200000030000000 Use the environment settings, extent and cell size to get the grid you want. Good luck,
... View more
09-23-2014
12:16 AM
|
1
|
0
|
2104
|
|
DOC
|
For formatting leading zeros I still prefer >>> n = 3 >>> str(n).zfill(3) '003' >>>
... View more
09-19-2014
08:06 AM
|
3
|
0
|
16927
|
|
POST
|
You know, the script runs, check various inputs and so forth. If a requirement is not met, eg the feature is not the correct type or something, then bail out and print a meaningful message. Currently I use sys.exit(), but this is not ideal and throws an error in python. So, how do the experts do it? Thanks in advance, Neil
... View more
09-19-2014
12:13 AM
|
0
|
4
|
1574
|
|
POST
|
I am using v10.2 and regularly create polylineZM's from coordinates in python. So no bugs. Be aware that when you create the geometry you should specify the SR of that geometry. But that is unlikely to be the issue here.
... View more
09-17-2014
01:58 AM
|
0
|
0
|
5736
|
|
POST
|
Just have to use a row counter, so that on the first low, set Last_id = This_Id, something like...
import arcpy
tbl = r"U:\Projects\Change.gdb\qryTable"
flds = ['OBJECTID', 'PLIDS', 'CYEAR', 'CNUMBER']
orderby = 'ORDER BY PLIDS, CYEAR'
objdel = []
last_id = None
RowCnt = 0
with arcpy.da.SearchCursor(tbl, flds, "", "","", sql_clause=(None, orderby)) as sc:
for row in sc:
RowCnt +=1
this_id = row[3]
if RowCnt == 1:
last_id = this_id
else:
if this_id == last_id:
this_object_id = row[0]
objdel.append(this_object_id)
last_id = this_id
print objdel
del row, sc
for l in objdel:
expression = "OBJECTID = %s"%(l)
uc = arcpy.da.UpdateCursor(tbl, "*", where_clause=expression)
for u in uc:
uc.deleteRow()
del l
Phew, still can't get this python highlighting right.... So the indentations are all messed up. And when I try to edit it, I see a bunch of overlapping lines. Sorry.
... View more
09-17-2014
01:44 AM
|
0
|
1
|
2196
|
|
POST
|
Well, I'm with Dan the man... Have you looked at your output of the intersect? Do both inputs have a common coord sys. Are the smaller polygons well formed, properly closed and so forth. Are there any errant polys that are hard to notice. Check the number of records both sides. Good luck.
... View more
09-17-2014
01:30 AM
|
0
|
0
|
2307
|
|
POST
|
Or even ... >>> n = 3 >>> str(n).zfill(3) '003' >>> Cheers, Neil
... View more
09-10-2014
11:25 PM
|
1
|
0
|
3468
|
|
POST
|
Richard, reading fc records of geometry and attributes into a dictionary for further processing works a treat (at the mo on v10.2). Used it often recently to do geometry comparisons (intersect etc). Cheers, Neil
... View more
09-02-2014
12:04 AM
|
0
|
0
|
1773
|
|
POST
|
Use a Euclidian distance function on a line feature. Then you can rescale this to go from 0 to 1. Good luck, Neil
... View more
08-22-2014
12:22 AM
|
0
|
1
|
1244
|
|
POST
|
Thanks Xander, that does look like the correct tool. Now if I knew how to flag your post as correct I would do it.... Cheers, N
... View more
08-21-2014
08:24 AM
|
0
|
1
|
1486
|
|
POST
|
Been processing some lidar / las data. Built the las dataset no probs. Then I wanted to do some qc / qa. Pulse counts etc from this tool are pretty self explanatory. But then I looked at building a raster using the "PREDOMINANT_LAST_RETURN" option. The help says this makes a raster from the "Most frequent last return value". I took this to mean that I could basically output a quickish raster dem image, but it doesn't do that. What I get is a raster consisting of a range of values from 1 to 5, with most being 1. ie not the value of the return but which was the last return. Am I mis-interpreting what this tool can output? Using ArcGIS v10.2. Cheers, Neil
... View more
08-21-2014
02:23 AM
|
0
|
3
|
4638
|
|
POST
|
When you first add the vector features into the scene, it will appear underneath (unless they're Z enabled). In the base heights tab, you have to tick on the float on surface and chose your dem raster. Sometimes because of rendering you add a slight offset to the vectors to make them appear slightly above the dem to make them fully visible. Good luck, Neil
... View more
08-21-2014
02:14 AM
|
0
|
0
|
958
|
|
POST
|
A little bit more detail here please. Perhaps an example of your data and what you want to achieve. I have just checked but tools like the "Pivot table" tool is at an advanced level. Might need to do something with python, or export the data to excel to get to where you need to be. Neil
... View more
08-20-2014
05:55 AM
|
0
|
1
|
2103
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-08-2015 11:28 PM | |
| 1 | 12-20-2013 08:59 PM | |
| 1 | 05-14-2014 10:38 PM | |
| 1 | 12-16-2013 09:05 PM | |
| 1 | 05-31-2019 02:50 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|