|
POST
|
Is there any way to guard against Nulls occuring when I use the Polygon to Raster Conversion Tool? Before you convert to raster, set the extent so no areas in the extent (a square) are entirely covered by your input polygons. Is there any way to replace Null values in floating point rasters? Con and IsNull are local operators, they cannot fill in NoData cells, unless you have a single value you want to use (like zero), which I don't think is what you're after here. If you have single cells you want to fill in with a 3x3 neighborhood mean, here's an approach that would work in the Raster Calculator.
Con(IsNull("inraster"), FocalStatistics("inraster",NbrRectangle(3,3,"CELL"),"MEAN"))
... View more
06-30-2013
09:44 PM
|
0
|
0
|
787
|
|
POST
|
I am trying to calculate the percentage of each vegetation type in each of my allotments. If you convert the shapefiles to raster, the Tabulate Area tool may do what you want. Another option is the NAWQA Area-Characterization Toolbox (NACT). In that toolbox I've developed some flexible tools to calculate weight tables and percentages, even if your tabulation areas overlap.
... View more
06-30-2013
09:32 PM
|
0
|
0
|
542
|
|
POST
|
Ideally,the best solution would be to somehow "get into" the zonal statistcs tool through python and change its settings, but I guess that can't be done. Israel, Tool syntax and parameter interfaces are the same in the dialog interface or from ModelBuilder. This is actually a huge strengh of 10.0 over 9.x raster tools. However, you may want to look into this. Using Python map algebra you can set values to NoData before the tool sees them (no extra raster creation required). Here's an example:
valras = Raster("value_grid.img")
zonras = Raster("zones.img")
outZSaT = ZonalStatisticsAsTable(zonras, "VALUE",
SetNull(valras == 98 or valras == 99, valras)
"stats_tbl", "NODATA", "MEAN")
... View more
06-30-2013
09:27 PM
|
0
|
0
|
4165
|
|
POST
|
# Build the field name
fieldName1 = "C"+numCode+"MS"
fieldName2 = "C"+numCode+"MW"
# delete the field CXXXX
gp.deletefield (fc, fieldName1)
gp.deletefield (fc, fieldName2)
Hi Elaine, The DeleteField tool can take a list of field names either as a ";"-delimited string or a Python list:
gp.DeleteField_management(fc, [fieldName1, fieldName2])
gp.DeleteField_management(fc, "{0};{1}".format(fieldName1, fieldName2))
By the way, I'd get in the habit of capitalizing tool names so you don't have to break the habit in 10.x when you get there.
... View more
06-28-2013
08:20 PM
|
0
|
0
|
1924
|
|
POST
|
Are you working with vector data? Dan, MCD12Q1 is a 500m global raster land cover dataset. (Kind of an awesome dataset IMHO!) Land Cover Type Yearly L3 Global 500 m SIN Grid
... View more
06-28-2013
08:12 PM
|
0
|
0
|
2185
|
|
POST
|
. In raster calculator it would be nice to be able to chose the "Lookup" function (and other functions) so that "case" is not an issue, as well as being able to select the "item" to use in the lookup. You may want to try just entering map algebra in the python window in ArcMap instead of Raster Calculator. This supports fixing capitalization etc. For example, try this in the ArcMap Python window with some raster layers in your map
>>> from arcpy.sa import *
>>> ras = Con
You'll see popups that guide you through entering the map algebra. Desktop 10.1 Help: Comparing Map Algebra between ArcGIS 9.x and 10
... View more
06-26-2013
08:09 AM
|
0
|
0
|
2925
|
|
POST
|
What would the syntax of this code look like if i were to make it a python script to import as a script tool with input and output parameters? The normal way to provide information to an arcpy script tool is to use GetParameterAsText(), setting up the input parameter as a Raster Layer, and the output as a Raster Dataset. Raster() is used to convert the input string to a raster data arcpy map algebra can work with. import arcpy from arcpy.sa import * inRaster = arcpy.GetParameterAsText(0) # input raster layer name or raster dataset path outRaster = arcpy.GetParameterAsText(1) # output: raster dataset ras = Raster(inRaster) range = ras.maximum - ras.minimum mappedras = (ras - ras.minimum) / range mappedras.save(outRaster) Beyond that, you're kind of out of the scope of this thread.
... View more
06-25-2013
11:31 AM
|
0
|
0
|
2080
|
|
POST
|
Have you made any progress on this issue. I viewed the NIM and it now states the workaround to use arcgisscripting. Esri tech support may be able to help you modify your script to do what you need to do using arcgisscripting instead of arcpy. I recommend contacting tech support, and be sure and reference NIM089224. [ATTACH=CONFIG]25475[/ATTACH]
... View more
06-25-2013
09:58 AM
|
0
|
0
|
6672
|
|
POST
|
"Lookup" usually fails in raster calculator I hope this question is not unwarranted, but are you always capitalizing the name of the "Lookup" tool? Tool names are case-sensitive in ArcGIS 10's Raster Calculator and arcpy. If you create a raster with the Create Raster Dataset tool, you can use Mosaic in arcpy map algebra with Lookup like this:
Mosaic([Lookup("grid1","FIELD1"), Lookup("grid2","FIELD2")], "mergeraster")
... View more
06-25-2013
09:03 AM
|
0
|
0
|
2925
|
|
POST
|
I am finding a way to detect land cover change with ArcGIS 10.1. [...] I already have the maps of land cover (MODIS MCD12Q1) from 2001 to 2011 of the area of interest If you have Spatial Analyst, the Combine tool will overlay two or more rasters. The output raster's value table includes the values of each unique cell value combination that occurred.
... View more
06-24-2013
09:31 AM
|
0
|
0
|
2185
|
|
POST
|
I tried using the feature to raster tool but i couldn't seem to understand the output. Did you specify a polygon table field to use for the raster value? if not it just uses the object ID. If the field value was just population you would need to normalize it the data by area (pop / area) and grid on that field (density) instead of just population count. The cell values will then be more appropriate for this kind of analysis.
... View more
06-24-2013
09:18 AM
|
0
|
0
|
1612
|
|
POST
|
My maps are just regular polygon maps and when i try to use the weighted overaly analysis tool it wants everything in raster not polygon. Can anyone help me with this process? You can easily convert the polygons to rasters using the Feature To Raster or Polygon To Raster tools. For best results, set the extent and cell size in the geoprocessing environment before you run the conversions so the four rasters will line up. If you want to do the analysis on polygons, the tool you are looking for is Union, but it doesn't have the nice interface assigning weights - you'd have to do that yourself. (Union requires an ArcGIS Advanced ["ArcInfo"] license.)
... View more
06-24-2013
08:37 AM
|
0
|
0
|
1612
|
|
POST
|
So, you created 10 different rasters, right? How did you get your final raster? That's right (but my suggestion was 35, not 10); say the rasters are: s1,s2, ... s35, each generated with zonalstatistics with the appropriate kernel file for that aspect code (1 to 35). Then with Raster Calculator and the Con tool, use the aspect code (here in raster "asp", integers from 1 to 35) to pick which aspect results to use:
Con("asp" == 1, "s1", Con("asp" == 2, "s2", Con("asp" == 3, "s3" ... ))))))))
Another (quite nifty) approach is to use the Pick tool, again assuming the asp codes are 1 to 35:
Pick("asp", "s1", "s2", "s3", ..., "s35")
... View more
06-24-2013
08:19 AM
|
0
|
0
|
1300
|
|
POST
|
I need a elliptical search window for focal statistics (Max), where the major axis is oriented due to an angle from a table (in my case from aspect values so that the ellipse is oriented downslope). We have tackled a similar problem with oriented well buffers for water-quality data analysis. Our solution was to generate a collection of kernel files (say, 36 of them, one for each 10 degrees of azimuth, ker0.txt to ker35.txt), calculate azimuth codes (say - 0 to 35). Then you could set up a model that iterates on your azimuth code field values to run zonal statistics, using the Calculate Value tool to generate the kernel file name from the azimuth code on each iteration.
... View more
06-22-2013
07:53 AM
|
0
|
0
|
1300
|
|
POST
|
I'm writing a python script in ArcGIS 10.1 in which I want to reclassify a raster as follows: First, classify into three classes using the standard deviation method. Second, reclassify the raster's values as like this: 1st class = 1 2nd class = 2 3rd class = 3 There are two problems here, or at least I think there are two problems. The first is that there doesn't appear to be a way in ArcPy to specify the number of classes or the classification method. I tried saving a reference .lyr where a 3 class standard deviation symbology is set and then using arcpy.mapping.UpdateLayer but this takes the exact class values and applies them rather than taking just the classification method and number of classes. The second problem is how to reclassify the cells in each class to values of 1,2,3 respectively. You can do this with Python map algebra (if you have Spatial Analyst available): from arcpy.sa import *
ras = Raster("valueraster")
classes = 3
stdevs = 1
base = 1 # output raster is 1,2,3,...
newmin = ras.mean - (stdevs * ras.standardDeviation)
newmax = ras.mean + (stdevs * ras.standardDeviation)
# set slicing min and max
temp = Con(ras < newmin, newmin, Con(ras > newmax, newmax, ras))
newras = Slice(temp,"EQUAL_INTERVAL, classes, base)
If you need the break values, you can get them using ZonalStatisticsAsTable using newras as your zone raster and "valueraster" for the values. This method is probably more accurate than using arcpy.mapping if your data are highly skewed, because the layer statistics may be developed from a smaller sample of the data than your actual raster statistics.
... View more
06-21-2013
09:23 AM
|
0
|
0
|
2381
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|