I created a simple model that selects iteratively elements from a point dataset and calculates a cost distance raster for each of these points.  It works fine when I run it for just one dataset, but when I try to batch it get the following error.  ERROR 000865: Input raster or feature source data: I_atlanta_OBJECTID does not exist. ERROR 000581: Invalid parameters. Failed to execute (Cost Distance).  Please any help will be greatly appreciate.  Here a link to a snapshot of the model
72364
Am I correct that if my model has a model-only tool (Calculate Value), and then I run the model as a batched process, it will not run the Calculate Value expression?   I wrote a model to upload, define, project (and clip) XY data from excel files. I had thought to use iterate tables, but it wasn't working. (I assume due to having to choose which worksheet within xlxs). So I thought to do a batch, but this seems to leave that annoying $ that arc appends to table names (and is an invalid character in most tools...)  My guess is that the Calculate value that removes my $ is not being run in the batch. Ideas? Confirmations?
97331
I am trying to burn a shapefile to a raster using GDAL's RasterizeLayer. I pre-create an area of interest raster from a different shapefile, given a specific pixel size. This AOI then serves as a base for all following rasterizations (same number of collumns and rows, same projection and geotransform).  The issue occurs, however, when I go to burn the shapes to their own raster, based on the same pixel size and projections. The link below (don't have enough rep to post the image), shows the original shapefile in tan, and the dark pink where RasterizeLayer has burned data. The light pink is nodata values for the dark pink raster data. The grey is the AOI based on which the shapefile burn was completed.  Given the extents of the shapefile polygons, I would expect to see burn values in the bottom two corners, as well as the two pixels underneath the data that does show. Obviously, however, this is not the case.    As follows is the code that I used to generate these. All of the shapes were created using QGIS, and were all created in the same projection.  (It should be noted that the gridding in the picture shown was just to give an idea of the pixel size I was using.)  from osgeo import ogr from osgeo import gdal  aoi_uri = 'AOI_Raster.tif' aoi_raster = gdal.Open(aoi_uri)  def new_raster_from_base(base, outputURI, format, nodata, datatype):      cols = base.RasterXSize     rows = base.RasterYSize     projection = base.GetProjection()     geotransform = base.GetGeoTransform()     bands = base.RasterCount      driver = gdal.GetDriverByName(format)      new_raster = driver.Create(str(outputURI), cols, rows, bands, datatype)     new_raster.SetProjection(projection)     new_raster.SetGeoTransform(geotransform)      for i in range(bands):         new_raster.GetRasterBand(i + 1).SetNoDataValue(nodata)         new_raster.GetRasterBand(i + 1).Fill(nodata)      return new_raster  shape_uri = 'activity_3.shp' shape_datasource = ogr.Open(shape_uri) shape_layer = shape_datasource.GetLayer()  raster_out = 'new_raster.tif'  raster_dataset = new_raster_from_base(aoi_raster, raster_out, 'GTiff',                                 -1, gdal.GDT_Int32) band = raster_dataset.GetRasterBand(1) nodata = band.GetNoDataValue()  band.Fill(nodata)  gdal.RasterizeLayer(raster_dataset, [1], shape_layer, burn_values=[1])   Is this a bug in GDAL, or is RasterizeLayer burning data based on something other than just the presence or lack of a polygon within a specified pixel area?  The files that I was using can be found .
43815
So I found this python script on another post here and was trying to adjust it for my needs.  I'm a very novice python user so I'm struggling with how to modify the script.  I have a Feature Class stored in a feature Dataset that I want to search a field for duplicate values and populate a new field with Y for duplicate or N for none.  The below script is what I found that looks like it will work once I find a way to drill down into my file geodatabase.          from arcpy import *          inShapefile = pointsShapefile          checkField = "xyCombine"         updateField = "dplicate"         #List of values found once         occursOnce = []        #list of values found twice         occursTwice = []       cursor = da.SearchCursor (inShapefile, [checkField])           for row in cursor:           #Check value is not null        if row[0]:     #If not already found to occur twice, proceed     if not row[0] in occursTwice:         #If hasn't occured once yet         if not row[0] in occursOnce:             #Add to occurs once list             occursOnce.append (row[0])         #If value has already been found once         else:             #Add to occurs twice list (duplicates)             occursTwice.append (row[0])     del cursor       cursor = da.UpdateCursor (inShapefile, [checkField, updateField])      for row in cursor:       #Check value is not null         if row[0]:            #check if value in occursTwice list (i.e. is duplicate)     if row[0] in occursTwice:         row[1] = "Y"     else:         row[1] = "N"     cursor.updateRow(row)    del cursor
78606
I'm just starting to get into Python scripting for work.  I'm currently creating a script to automate a process.  Basically, it asks the user the client name, gets a projection if available, creates directory on C: drive for client, creates file geodatabase specific to client, creates required dataset, and creates feature classes specific to clients data. Eventually, it will also add the required fields to each feature class and probably some other things.  I started this not really knowing the proper etiquette of Python scripting for ArcMap. But what I've created so far will only run outside ArcMap I believe.   Is this acceptable?   Instead of getting user input through arcpy.getparamaterastext(), which I just found out about, I'm using raw_input().   Is this okay?   It does work, I'm just not sure if this is a proper way to do scripting.  Here's the code I have so far.  import sys import arcpy import os  #Records name of the client client = raw_input("Enter the name of the client: (letters and underscores only) \n")  #Records filepath of client to be created clientpath = "C:/" + client  #Inquires if projection file exists projection = raw_input("Is there a .prj or .shp available with correct projection? Y or N \n")  #Records the projection location if available if projection.upper() == "Y":     spatialr = raw_input("Drag the .prj or .shp here to record the filepath \n")     nspatialr = spatialr.replace('"', "") elif projection.upper() == "N":     alert = raw_input("You must add the spatial reference manually, hit enter to continue. \n") elif projection.upper() != "N" or "Y":     exit = raw_input("That is not a valid response. Try again. \n")     sys.exit()  #Checks if client folder exists; if not, creates one if not os.path.exists(clientpath):     os.makedirs(clientpath)  #Variable for file geodatabase location FGBpath = clientpath + "/" + client + ".gdb"  #Checks if client file geodatabase exists; if not, creates one if not arcpy.Exists(FGBpath):     arcpy.CreateFileGDB_management(clientpath, client)  #Variable for dataset location FDatasetpath = clientpath + "/" + client + ".gdb" + "/Network"  #Checks if dataset exists; if not, creates one if not arcpy.Exists(FDatasetpath):     if projection.upper() == "Y":         arcpy.CreateFeatureDataset_management(FGBpath, "Network", nspatialr)     elif projection.upper() == "N":         arcpy.CreateFeatureDataset_management(FGBpath, "Network")  #Variable for cable feature class location FCcablepath = clientpath + "/" + client + ".gdb" + "/Network" + "/cable"  #Checks if cable feature class exists; if not, creates one if not arcpy.Exists(FCcablepath):     if projection.upper() == "Y":         arcpy.CreateFeatureclass_management (FDatasetpath, "cable", "POLYLINE", "", "", "", nspatialr)     elif projection.upper() == "N":         arcpy.CreateFeatureclass_management (FDatasetpath, "cable", "POLYLINE")  #Variable for splice point feature class location FCsplicepath = clientpath + "/" + client + ".gdb" + "/Network" + "/splice_point"  #Checks if splice point feature class exists; if not, creates one if not arcpy.Exists(FCsplicepath):     if projection == 'Y' or projection == 'y':         arcpy.CreateFeatureclass_management (FDatasetpath, "splice_point", "POINT", "", "", "", nspatialr)     elif projection == 'N' or projection == 'n':         arcpy.CreateFeatureclass_management (FDatasetpath, "splice_point", "POINT")  exit = raw_input("\n\n File geodatabase, dataset, and the cable \n and splice point feature classes successfully created. \n\n Hit enter to exit.")   I still have some work to do, like adding the needed fields.
86987
I am trying to make a new raster based on three input rasters which have the same cell size and the grids align perfectly.  I now want to construct a new raster, which for each cell, has three attributes, being the cell the values of the different input rasters. I've read about using 'combine', but this provides with an attribute table with a count of all cells with the same combination of values in the different input rasters (I hope this is clear). What I need is an attribute table in which all cells are individually represented.   Does anyone have any advice on this?
43966
When I cut one raster with clip raster by mask layer I get the expected result.  But when applying batch processing with the same vector file, and the same rasters, the rasters aren't clipped and the values are changed to 0 and NaN?  The rasters are landsat 5 images, and the vector has the same datum.  Edit: I've figured out this is the gdal command used when processing individually:  gdalwarp -ot Float32 -q -of GTiff -cutline "some_shape.shp" -co COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=6 -wo OPTIMIZE_SIZE=TRUE "original_raster.tif" "clipped_raster.tif"  And this one is used in batch processing:  gdalwarp -ot Byte -q -of GTiff -cutline "some_shape.shp" -co COMPRESS=NONE -wo OPTIMIZE_SIZE=TRUE "original_raster.TIF" "clipped_raster.tif"  Why the differences?
106055
I am trying to make a script which selects every .png file in a folder beginning with the letters "LG". I then want the scipt create a shapefile, replacing the "LG" with "SH", and then i want the script to buffer that shapefile and rename the buffer with the first 2 letters being "SB".  I keep getting an error 99999 error message at line 37! ( gp.RasterToPolygon_conversion(INPUT_RASTER, Output_polygon_features, "SIMPLIFY", "VALUE") )  I have posted this on stackoverflow.com but probably here is a better place as scripting for arcmap is probably quite specialised!  Can anyone offer me any advice to why this script doesnt work? I am running ArcMap 9.3.1. and (attempting) to run the script from pyscripter!  # --------------------------------------------------------------------------- # RASTER2POLYGON.py # Created on: Wed Dec 01 2010 12:20:48 PM #   (generated by ArcGIS/ModelBuilder) # Usage: RASTER2POLYGON &lt;INPUT_RASTER&gt; &lt;Output_polygon_features&gt; &lt;Raster_Buffer_shp&gt; # ---------------------------------------------------------------------------  # Import system modules import sys, string, os, arcgisscripting  # Create the Geoprocessor object gp = arcgisscripting.create()  # Load required toolboxes... gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx") gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")  # Script arguments...  folder = "D:\\J04-0083\\IMAGEFILES" for root, dirs, filenames in os.walk(folder): # returms root, dirs, and files     for filename in filenames:         filename_split = os.path.splitext(filename) # filename and extensionname (extension in [1])         filename_zero = filename_split[0]     try:         first_2_letters = filename_zero[0] + filename_zero[1]     except:         first_2_letters = "XX"      if first_2_letters == "LG":         Output_polygon_features = "D:\\J04-0083\\ShapeFiles.gdb\\" + "SH_" + filename + ".shp"          # Process: Raster to Polygon...          INPUT_RASTER = os.path.join(root + "\\" + filename_zero + ".png")         gp.RasterToPolygon_conversion(INPUT_RASTER, Output_polygon_features, "SIMPLIFY", "VALUE")           Distance__value_or_field_ = "5 Meters"         Raster_Buffer_shp = "SB_" + filename + ".shp"          # Process: Buffer...         gp.Buffer_analysis(Output_polygon_features, Raster_Buffer_shp, Distance__value_or_field_, "FULL", "ROUND", "NONE", "")
100866
Each time I try to convert (in QGIS 2.2) an elevation model from .tif to .bil format a get this error:     ERROR 1: Attempt to create ESRI .hdr labelled dataset with an illegal    data type (Float64).   The same error occurs when I use the clipper with .bil as output file format.  What does the error message mean?
60990
I am attempting to create a plane and set the color; the following code throws an error at this line:    bpy.data.materials['RSgreen'].diffuse_color=(0,0,0)   the error is:  ValueError: bpy_struct: item.attr = val: sequences of dimension 0 should contain 4 items, not 3  which makes no sense to me; diffuse_color calls for 3 parameters in the .  bpy.ops.mesh.primitive_plane_add(size=4,enter_editmode=False,location=(-2,-2,0.01)) bpy.context.active_object.name='Plane2' bpy.ops.material.new() bpy.data.materials[1].name='RSgreen' bpy.data.materials['RSgreen'].diffuse_color=(0,0,0) bpy.context.object.data.materials.append(bpy.data.materials['RSgreen'])
11908
I'm trying to map the maximal amount of days without rain using the TRMM dataset in Google Earth Engine. I'm doing this by iterating over the collection and if no rain has fallen, one gets added to the cell (code below). When rain has fallen the value gets multiplied by 0 so the "counter" is reset. Then I would like to store each result of each iteration in a Image collection and then select the maximum value to get the longest consecutive dry period.  But that is the theory. When I put this in a script I get an error while adding the image of one iteration to a list.   Does anyone know why this is and how this can be solved?  Code:  var list = []; function drylength(current, previous){   var mask = current.remap([0], [1], 0,"precipitation").rename('precipitation');   var sum = mask.add(previous).multiply(mask);    list.push(sum);   return sum; }  var dataset = TRMM .filterDate("2015-01-01","2015-02-01") .sort('system:time_start:');  var totalPrecipitation = dataset.iterate(drylength, dataset.max() .remap([0], [0], 0, "precipitation") .rename('precipitation'));  print(list); print(totalPrecipitation); Map.addLayer(ee.Image(totalPrecipitation), imageVisParam);   Furthermore it appears only 3 items are stored in the list which makes me assume the iteration is more complex than a literal iteration where all images are calculated one by one?   Here is an image of the error:    Errors written if image is not visible or for search engines:  Failed to decode JSON. Error: Field 'value' of object '{"type":"ArgumentRef","value":null}' is missing or null. Object: {"type":"ArgumentRef","value":null}.   and:  Unknown variable references: [_MAPPING_VAR_0_0, _MAPPING_VAR_0_1].
121725
I could read many rasters as one list of ratsers but when I want to convert them to data frames I get an error.   Is there any way to convert them?  library(raster) Pro &lt;- function(s) {   df &lt;- stack(s) }  files &lt;- dir("path", recursive=TRUE, full.names=TRUE, pattern=".tif$")  agg &lt;- sapply(files, Pro)  df &lt;- as.data.frame(agg)
98527
Can anyone please let me know how the data-driven testing is done using the Postman?  I read some post in the online, it seems to be by using collection we need to run the collections at the time we can able to upload the CSV file and JSON for Data driver.  When I tried to upload the CSV the iteration count is not showing automatically  Can anyone show some simple example to perform this task? It will be helpful for automation testing for web services
89323
I have prepared a tool for Masking the specific portion of the raster dataset using the feature dataset. It works fine in ArcMap but shows the following error while running it on the server.  I have used shapefile for the feature dataset and Tiff file for the raster dataset.
43224
I have a folder and it contains two feature classes, e.g., a.shp and b.shp. The script tool created has two parameters. The first one is the model location, and the second one needs a feature class (a.shp), as shown in the below picture.  What I really want is every time when I set up the model location for the first input, the second input will automatically find the a.shp as the input rather than the user needs to choose a.shp from that folder. I noticed that the dependency is probably what I really need, but there is no code example. Any suggestions?   I am using ArcGIS 10.3.1 Advanced License.
53371
We are running an ArcGIS 10.0 geoprocessing script written in Python that (as part of many steps above &amp; below) runs the .    Both the input and output datasets (shapefiles &amp; personal geodatabase, respectively) are on a network drive, in the same projection, and we are not using a search distance (which by default = infinity, I believe).  When we run the near command, sometime it successfully runs to completion and sometimes (usually) it only partially works.  When it partially works (but runs to completion), the results typically have anywhere from 1/4 to 1/2 of the features with a NEAR_DIST value = -1 (and it is always the top portion of the records, as sorted by the OID).  In these cases, it also takes forever to process the top records, sometimes going from full success runs in 20 seconds to partial success runs in 1.5 hours.  Has anyone else experienced this kind of issue?  Any suggestions on WHY the issue is occurring or HOW to fix the issue?
1526
I am attempting to use this code in a tool that I am working on:  mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] XMIN = df.extent.XMin YMIN = df.extent.YMin XMAX = df.extent.XMax YMAX = df.extent.YMax   I then go on to do other calculations with the extent. The code works perfectly in the Python window, but because Toolbox tools are run in separate processes I am unable to use "CURRENT".  I think I could probably add a derived input variable and pass the coordinates through the validation script, but that doesn't work for what I am doing. I need to be able to do this later on in the script and add an additional temporary feature to the current map:  points = arcpy.CreateFeatureclass_management("in_memory", "NewFeature", "POINT") arcpy.AddField_management(points, "NewField", "TEXT", "", "", 20)   I know all of my code works right, because I can paste the entire .py into the  Python window and then call Main() and run through it, but I need to share it with others in an easier way.   I would prefer the solution be compatible with 10.0 and 10.1 if at all possible, because some of the people I work with do not have 10.1 yet. I will accept a 10.1 only solution if I have to though.  What options do I have to do this?    I still can not get this to work, they have not gotten me Python Add-In Wizard yet so I am unable to test that approach. I have again tried the "Run in process" box checked and unchecked. Neither are working.   Checked gives me this: RuntimeError: CreateObject cannot open map document  Handled that exception: Object: CreateObject cannot open map document  From my testing looks like it is having the same error running in process or not.    I will still be attempting to do this within the Add-In Wizard, when they finally give me it.  The winning answer is I wasn't running it in the foreground.
32273
I'm 90% sure this basic question has been asked before but looking through the other posts I simply do not see a useful answer.  I need to calculate polygonal(vector) catchment areas from a raster based on minimum driving distance/cost from a set of points. I've already got the raster, and for that matter, the nodes(intersections with cost attribute) used to interpolate it. What I need now are polygons for each point describing the area nearer it than any other point. This is basically like a voronoi diagram but based on network distance rather than euclidean space.   How exactly can I do this using only open-source tools? I'm comfortable with the command line if I just know what I'm looking for. I feel like GDAL is going to be the answer, but if so, what exactly is the command I'm looking for?  Thanks!