Tag Info

Hot answers tagged

7

If you have the XY of the point, then you could create a PointGeometry. current_sr = arcpy.SpatialReference(102726) #Enter the current WKID for the point new_sr = arcpy.SpatialReference(4326) #This is the WKID for WGS84 point = arcpy.PointGeometry(arcpy.Point(7334719, 670307), current_sr) new_point = point.projectAs(new_sr) >>> ...


5

What you are doing works just fine. This is pretty much the same code but as a more elegant solution: flds = [f.name for f in arcpy.ListFields(lyr)]


4

The easiest way to do this is to use Python (can be run in Python window in ArcMap if you are not familiar with any IDE or Python prompt): import random print random.sample(range(800000), 240) This will give you a list of unique value (with no repeating), such as [1,2,5,12]. Now you can use the Select By Attributes in ArcMap and select the features which ...


3

You do not need the [0] brackets here on this statement: if photolink[0][:4] == "http": That would return "h" only and not "http" TRY if photolink[:4] == "http": The new arcpy.da.UpdateCursor in v10.1 and greater uses bracket indexes to relate to defined field(s) and also is faster since it does not iterate over each fc field. with ...


3

The error in your "RastertoPolygon" script is due to a space in the file name of one or more of your input rasters. To confirm this answer, I ran your script on a folder of raster files and it worked perfectly. I added a space to the file name of one of the rasters and it failed with the message "ExecuteError: ERROR 010328: Syntax error at or near symbol ...


2

Hmm that is strange. Does this return True? >>> import arcpy >>> 'GetNAClassNames' in dir(arcpy.na) True I don't know how it could be missing, perhaps something could have gone wrong during your install?


2

If I understand the question, you are trying to have the same layout but have the map pan to each grid cell for printing to pdf. What version of ArcGIS are you using? At 10.x you can use data driven pages for this task. http://resources.arcgis.com/en/help/main/10.1/index.html#//00s90000003n000000 What is the purpose of clipping everything? As a faster ...


2

To solve this bad behaviour of arcgis folder parameter processing, you need to string escaped the string that comes from the tool parameter. For this, simply add this line: dest_root = parameters[0].value #ouputs C:\Users\678910\Documents dest_root = unicode(dest_root).encode('unicode-escape') #outputs C:\\Users\\678910\\Documents And one problem with ...


2

Chad Cooper is right. change Text Field Length in Field Mapping. Make sure your length doesn't exceed your ouput workspace (FileGeodatabase, SDE, DBF) text field length limitation


2

Looks like there are 4 scenarios: Null values, empty values, http link values, and all other values, which you will turn into file paths. Whenever you use elif, you should really finish with an else, to catch all the remaining possibilities. This is what I would recommend for you: You can combine the first two tests, use rstrip in case a value is a single ...


1

As a test I suggest trying to change: outname = str(fc) + parish + ".xls" to outname = 'C:\\Parishes\\' + str(fc) + parish + ".xls" I suspect that trying to write a *.xls to a *.gdb (even though that is a folder) is what may be upsetting the tool.


1

try parameter = arcpy.GetParameter(1) inputLayers = parameter.values() This should give you the different layers as a list Afterwards you can access the individual layers by index or in a loop layer = inputLayers[0] or for layer in inputLayers: (do something with your layer)


1

Here is my solution... open in arcmap the suspect layer. zoom to the entire dataset. make it the only selectable layer (if there is more than one) start editing make a selection box around all of the features switch the selection you now have all the <NULL> geometry rows in the sde table. delete


1

A few things here, not all of them might be contributing to the problem, but all of them strike me as a possible issue. arcpy.da.SearchCursor gets opened, but only one record is ever accessed (there is no for loop on cursor, or multiple .next() calls.) with arcpy.da.SearchCursor(aTable, return_flds, where_clause=where_str, sql_clause=sql_clause) as cursor: ...


1

The caching tools that exist in the ArcToolbox on Desktop simply make calls to the Caching tools that have been already published on the Server. If your workflow involves updating a cache through these tools, simply call the tools on Desktop, or call the already published tools on the Server. Publishing these tools as their own GP Service introduces an ...


1

First ensure that the input and target raster contain the same number of bands. pixel_type (1_BIT) You must set the pixel type to match your existing input raster datasets. If you do not set the pixel type, the 8-bit default will be used and your output may be incorrect. I suggest to run this tool from GUI (ArcMAP) and after a successful run, extract ...


1

You need to read the help file of the Mosaic to new raster tool. If you look at the Syntax section it lists the parameters of the tool and what they are. You need to be following the same order. Looking at your code you have a mysterious 1 after output name and before coordinate system. This is not the order of parameters as dictated in the syntax section. ...



Only top voted, non community-wiki answers of a minimum length are eligible