17
votes
Accepted
arcpy.SelectLayerByAttribute not working with an integer saved in a variable
Error 000358means "The SQL expression is invalid", as described in Help - ArcGIS Desktop
Your query, "Id=k", means that "get Idand k (field) value of a feature, compare both, if both are equal, ...
11
votes
Accepted
Search if field exists in feature class
I would prefer a list comprehension instead of string operations (like accepted answer). In my opinion, this is more readable and pythonic. Furthermore, the list comprehension approach could be ...
8
votes
Accepted
Where can I get an archived copy of the ColorBrewer style file for ArcGIS 10?
Reach Resource Center has a archive copy of a Color Brewer ArcMap style file available for download.
8
votes
Accepted
Using tempfiles for intermediate dataset in ArcPy?
You cant have a file extension for rasters in the in_memory workspace so change slope = "in_memory/slope.tif" to slope = "in_memory/slope"
See:
001167: No extension is allowed for in-memory raster ...
6
votes
Converting ArcGIS layer style to Styled Layer Descriptor (SLD) file?
I have confirmed that arcmap2sld tool is working fine on ArcGIS Desktop 10.1+. The program can be downloaded from this link and the readme docs are here.
The program transforms an ArcMap project's ...
6
votes
Extracting coordinates of polygon vertices in ArcMap?
This is another option using Python with the da.SearchCursor:
import arcpy
fc=r'C:\TEST.gdb\polygons123'
with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
for row in cursor:
...
6
votes
Accepted
MXD files in ArcGIS
Almost. An mxd is a project file that contains (amongst others) layer definitions. You might say that an mxd is a collection of layer files, but besides that, it has for instance a pagelayout, a map, ...
6
votes
Accepted
Printing Shapefile spatial Reference Using ArcPy?
Your code should be like this
import arcpy
dataset = r"E:\GIS\Centers.shp"
desc = arcpy.Describe(dataset)
extent = desc.extent
spatialReference = desc.spatialReference.Name
name = desc.name
...
5
votes
Zoom to Feature hotkey in ArcMap Table View
Ctrl-Enter will take you to the next line and select it. Using Ctrl-N or Ctrl-Shift-= will zoom to the selected row. Not too bad.
More links on hotkeys:
Zoom to Feature hotkey in ArcMap Table View
“...
5
votes
Creating shapefile showing footprints of Rasters?
The Previous Answers worked for QGIS 2.x.
If you are reading this after 2020, you will find that the Answers don't work. What Works with QGIS 3.x is the plugin called IBAMA Processing.
Install this ...
5
votes
Creating shapefile showing footprints of Rasters?
Ensure images have defined nodata. If source images do not, fix with something like one of the below, where 0 or 255 is the supposed-to-be nodata value:
gdal_translate ... -a_nodata 0 ... outimage.vrt
...
5
votes
How to remove <VALUE> text from legend in layout view?
An easier way is to right click on your Legend and click on "Properties."
In the Legend's property menu click on the "Items" tab. You'll be able to see the contents that are within your Legend.
...
5
votes
Accepted
Interrupting label display with ArcGIS Desktop?
The Labeling Toolbar has a Pause Labeling button
The Pause Labeling button will stop labels from displaying until you're ready for them to draw.
Pause Labeling - Suspends drawing of labels
See ...
5
votes
Accepted
Insert variable to query builder of Arcpy
Assuming that your Source.shp has a field named Field, instead of:
"\"Field\" = " + Var + "
try:
"Field = '{0}'".format(Var)
A two variables example syntax is:
"TextField = '{0}' AND NumField = {...
5
votes
Accepted
Slope calculations appear to be 90 degrees off in ArcGIS 3D Analyst?
I think your error is a result of performing a slope calculation on a DEM that isn't in a projected Coordinate Reference System (CRS). The reason for performing a transformation/warping of your DEM is ...
5
votes
Using arcpy.SelectLayerByAttribute_management?
The third argument to the SelectLayerByAttributes function is an SQL expression in string format. If you are familiar with the Select By Attributes dialog window it is essentially what you would type ...
5
votes
Accepted
Python to read text file to add new field
You can create a dictionary from the textfile and use in the UpdateCursor:
Textfile:
A Monkey
B Fish
C Cat
D Dog
Feature class attribute table:
Code:
import arcpy
feature_class=r"C:\TEST.gdb\...
5
votes
Accepted
ArcGIS 10.0 Addin install error?
The documentation states:
Add-ins are not backward compatible. Add-ins targeting 10.1, for example, will not work with 10.0 but will work with 10.2.
Considering that ArcGIS 10.0 is old enough to ...
5
votes
Using ArcGIS Desktop concurrently in remote server?
You seem to have misunderstood the meaning of "concurrent" in the Esri licensing documentation.
Concurrent use is defined:
This is a license environment where core products and extensions on ...
5
votes
Accepted
Selecting max value in SQL query from Extract by Attributes?
This is the model that you are seeking:
You create the table view of the raster, sort that into an in-memory table, then use the Get field value which only every looks at the first row which is your ...
4
votes
Getting X Y coordinates and cell value of each pixel in raster using ArcPy
A simple solution using open source python packages:
import fiona
import rasterio
from pprint import pprint
def raster_point_coords(raster, points):
# initialize dict to hold data
pt_data = ...
4
votes
Submodel not executing within main model
I've run into this same problem. For some reason, ArcGIS isn't reading the submodel as valid. What you need to do is open up the submodel and set all the parameters so that they point to dummy files....
4
votes
Creating polygons as % of original area using ArcGIS Desktop?
I suggest that you use the Buffer by percentage plugin available for QGIS.
It's not a solution using ArcMap but it does exactly what you want in a very efficient way.
4
votes
Retaining all fishnet grid squares within boundary of polygon from another feature class?
By default, the Fishnet tool creates a polygon/polyline grid using the bounding box of your study area. Try one of the following workflows:
Option 1:
Create Fishnet
Clip fishnet with the study area ...
4
votes
Is the PostGIS st_intersection function viable for very large data-sets?
I really wouldn't use PostGIS for datasets in the millions if you have access to a columnar database. If you regularly query tables with millions of rows, it's more efficient to script a workflow ...
4
votes
Accepted
Points not displaying in feature class in file geodatabase
I do not know of a way to do so directly. If you only a few points, enter to editor, start editing, click "Create Features", select point, then right click on the map and select "Absolute XY". You can ...
4
votes
Saving last selected value in Python Script Tool?
Use Geoprocessing Results list - re-opening a previously run tool will include any parameters selected when that tool was run.
Geoprocessing Menu > Results
In Results tab open the previously run ...
4
votes
Accepted
ArcGIS ModelBuilder task
Import your shapefiles into a geodatabase, create a toolbox in this geodatabase.
Create a model, drag your feature class(a) into the model, go the Insert tab, choose iterators, and add in Field ...
4
votes
Accepted
CalculateField_management - Updating a field with value from another field?
As explained in 24046: Tool cannot use VB expressions for services, the problem could be related to using VB expressions in 64-bit ArcGIS products. As offered in the very same page, if you change ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
arcgis-10.0 × 3562arcgis-desktop × 1514
arcpy × 644
arcmap × 442
arcobjects × 412
python × 251
raster × 214
arcgis-server × 209
c# × 160
enterprise-geodatabase × 149
modelbuilder × 136
spatial-analyst × 129
arcgis-engine × 116
coordinate-system × 106
field-calculator × 96
geoprocessing × 96
shapefile × 86
esri-geodatabase × 86
polygon × 82
labeling × 68
symbology × 63
network-analyst × 61
editing × 60
add-in × 60
point × 54