Erase polygon from line to get line?
How can I erase a polygon from a line to get the erased line? Conceptual image below. Erase Tool does not work when mixing polygons and lines.
View ArticleArcpy – add layer tif
I’m trying to write a python script that will add a tif to the table of contents of my map. (Eventually I want to convert to tool that allows the user to type in the filename and then has the tool...
View ArticleClip layout view to output graphics extent using python
I need to implement, within this very simple piece of code, the option that replicate the “Clip to output graphics extent” available from the ArcGIS 10.0 Export Map UI standard command. Is it possible?...
View ArticleUnknown Error? – A Column was specified that does not exist
shps = [(shp1,"field1"), (shp2,"field2")] for item in shps: shp = item[0] field = item[1] for row in arcpy.SearchCursor(shp, fields='"{0}"'.format(field)): if row == MyInVariable: sql = '"{0}" =...
View ArticleHow to iterate through all geometries using a search cursor?
I would like to use a python add-in which uses a button click to iterate through each selected polygon one by one. The following code manages to zoom only to the first polygon. How can I adapt it to...
View ArticlePython: how to set a different output folder
I want to transform some vectors to rasters in my folder but I have difficulties setting the output folder. The following code only allows me to output to the original database. I hope to output all...
View ArticleWriting Python script to populate fields of layer with underlying info from...
I have layers of points and lines that have to be updated regularly. It needs to have the intersecting attributes from another layer stored in its fields/attribute table. IE. towns, school districts...
View ArticleHow to use list broken Data sources for layers saved in Windows not within an...
I have seen a few question related to listing broken data sources of layers within an MXD MXD list broken links See Link . I am interested in layers that are not within an MXD. That are sitting within...
View ArticleCan't get the where clause in Select layer by attribute working!
I am trying to develop a script that searches for a particular ID in a user selected field. To this end I have used the select layer by attributes tool to search for a derived number in a field...
View ArticleIs it possible to save a dxf in memory
Following on from my question here, when I run the ExportToCAD tool arcpy.ExportCAD_conversion(listOfLayers, formatRelease, location + fileFormat, "Ignore_Filenames_in_Tables",...
View ArticlePython says my shapefile does not exist. Why?
I’m working on a script that prints the names of hospitals that are within a certain zip-code. When I run my code, though, python keeps giving me an Error message that says that my Hospitals shapefile...
View ArticleMakeFeatureLayer throwing error 00840: The value is not a feature layer
I’m working through tutorials from the book “GIS Tutorial for Python Scripting,” by David W. Allen, and I have this code pretty much exactly the way the book wants it (I altered one variable name from...
View ArticleArcpy.Delete_management() not deleting folder?
I’ve written a script in Python that takes in two ascii files that represent surfaces, then convert them to Rasters, and finally Negate their values (i.e. multiply all cells by -1). In the script, I...
View ArticleXML Document points to the wrong location after using arcpy.BatchProject()
I’m trying to reproject a number of shapefiles representing contours from NAD_83_Albers to NAD_83_UTM_Zone_9N using arcpy.BatchProject(), but I have to use python/regex to preserve a particular file...
View ArticleUsing boolean parameters in Python Script Tool of ArcPy?
I’m using ArcGIS for Desktop 10.3.0.4322 I have a script tool which requires a parameter (folder path to a gdB, via GetParameterAsText) so that a later process can be saved there. The thing I want to...
View ArticleRaster math with iterator (arcpy)
I know what I am trying to do here is wrong. But I was hoping for something similar that would do the job. Basically, I need a placeholder for values and raster calculations until I sum them together...
View Articlearcpy, ExportToSVG using paths
I want to export part of the map into (very big) SVG file. First I tried to do this using REST API: https://*server*/ArcGIS/rest/services/General/Etages/MapServer/export. This worked, the SVG file...
View ArticleupdateParameter() python toolbox
I can’t update parameters in my Python Toolbox and I don’t understand why. Someone can help me with this example code? class Tool(object): def __init__(self): self.label = "Tool" self.description = ""...
View ArticleReading Arcsde Data of a specific version in python
how can i read a version within python. for example lets say I set up a workspace which points to a .SDE file connection. Now how can I read the features from a version within python? I have looked...
View ArticleIdentify polygons greater than n-th percentile and perform further analyses...
My goal is to identify tracts that are above the 99 percentile of a variable (xvar), to dissolve contiguous tracts by summing a variable (yvar), and to get the coordinates of the centroids (longitude...
View Article