Quantcast
Channel: Question and Answer » arcpy
Browsing all 767 articles
Browse latest View live

Arcpy getCount_Management doesn't match row count with Cursor

I have some troubles to understand the behaviour of my code below. Obviously, GetCount_Management doesn’t match the rows in my layer selection. This code is part of a long for loop. I have hidden the...

View Article


Image may be NSFW.
Clik here to view.

How to calculate Statistics of an attribute field to use it in another...

I want the statistics of an attribute field to use in another calculation, i can view the statistics using the field properties menu I want these to normalised the data of field ‘Ia’ using the...

View Article


How to send long JSON objects (polygon geometry, table rows) in POST request...

I am seeking to understand my options for sending long JSON objects in a request to a Geoprocessing Service. In particular, I am looking for some example code to illustrate how to include two long JSON...

View Article

Selection Based on Range of Values from another table

I’ll try to explain this is as simply as possible. I’ve figured out how to create this table in SQL, no problem. But I’d like to have this done in python as part of a larger model. I have a feature...

View Article

Setting input parameter to be float for Python script tool?

I made a Python (2.7.8) script, where one of the parameters is height (float) and I wan to make tool in ArcGIS 10.3 now. However in data type list there is only double. If I input integer value into...

View Article


Code error – remove layer using python

Continuously to How to remove layers that are not in visible df extent i try to remove layers that don’t appear in the data frame with this code: import arcpy,os from arcpy import env env.workspace =...

View Article

Get the first and second row with searchcursor

I have a shapefile with only 4 rows in it. I already could filter it so I have only 2 left. I need these sorted by the ‘length’ field, then take the first and second row to save in to individual files....

View Article

Converting tuple into records in blank feature class using ArcPy?

Here is the code block that I am using with ArcGIS 10.2 for Desktop, it all works great except for the bottom part. I am not sure how to turn the tuple into records on a blank feature class. The tuple...

View Article


Inputs for building composite address locator from address locators created...

I’m building a script tool that creates up to 3 address locators and then uses the output address locators as inputs to the final output composite address locator. The tool executed perfectly prior to...

View Article


Is it possible to create TIN layer and add to Data frame?

I have list of TIN. I basically want to add TIN using arcpy.mapping so that when I open .mxd, TIN is added. tin_list = arcpy.ListDatasets('', 'Tin') for tin in tin_list:...

View Article

Writing only final raster with intermediate bands going to disk using ArcPy?

I have a raster with 4 bands. I would like to create a new raster (its individual bands called new_band) from this raster (its individual bands called old_band) in with : new_band1 = old_band1 * 2...

View Article

Making lookup table for performing Lookup(inRaster, lookupField)?

I want to replace the Digital number (DN) values in a raster file with some other values which are present in a text file;in the text file, I have a table which it’s first column are all possible DN...

View Article

Image may be NSFW.
Clik here to view.

Remove layers in sub folders using python- path orientation

Expanding on my previous question Remove layers using python- path orientation, i try to remove layers from mxd’s (in ArcMap 10.3, Python 2.7.8), that don’t appear in the layout view. The layers...

View Article


Image may be NSFW.
Clik here to view.

Trying to print classLables in symbology type UNIQUE VALUES

I have a classified image of 10 classes stacked together. Once I put them into ArcMap they don’t appear as 10 individual classes, they look like one big class. When I click on unique values the...

View Article

Accessing selected features in the sublayer output from tracing geometric...

I have a geometric network setup with stream lines and water users. I am trying to use arcpy to automate tracing downstream of each node/junction in my geometric network to get userIDs for all...

View Article


Listing geodatabases in local SQL Express Workgroup ArcSDE using...

This question already has an answer here: Using ArcPy to get all database names within server? 1 answer

View Article

Creating new layer from selection in ArcPy? [closed]

arcpy.SelectLayerByAttribute_management() helps in selection but I am unable to create a new layer from the selection arcpy.MakeFeatureLayer_management() for generating new layer file but it gives an...

View Article


Find Max Value and next highest two in Column using ArcPy?

I have a piece of code where I am able to find the max value. How can i edit this code to find the second largest, and then the third? I found this code here...

View Article

arcpy.AddIndex_management error for in_memory variable

I am trying to optimize a script that uses addJoin_management. To do this efficiently, I am attempting to add an attribute index on the join table. I am getting a generic error when i do this though....

View Article

Determine the number of fields of a certain field type there are in an input...

So I am wondering how to get the number of field types “String” by creating a custom function? Can anybody point me in the right direction? I have a shapefile named streets and there are 73 field...

View Article
Browsing all 767 articles
Browse latest View live