Tag Info

New answers tagged

1

I think i found it. If i use >>>execfile instead of >>>import (name of script) it works as many times as i want without closing QGIS


0

You are almost there. You need this: cat = QgsRendererCategoryV2(1, symbol, "1") renderer.addCategory(cat) A full example renderer = QgsCategorizedSymbolRendererV2("id") active_layer.setRendererV2(renderer) symbol = QgsSymbolV2.defaultSymbol(active_layer.geometryType()) symbol.setColor(QColor(Qt.red)) cat = QgsRendererCategoryV2(1, symbol, "1") ...


0

This situation is always confusing. There are two types of 'Layers' in arcpy. The feature layer, which you are creating, isn't the type you can add to a map. The other is the layer generated from the mapping module. This is the one you want. Instead of MakeFeatureLayer, try this: NewLayer = arcpy.mapping.Layer(r"W:\Source.lyr") Then you can perform ...


1

The issue strangely enough is caused by a dependency on Internet Explorer DLL dependencies of all strange things. It is triggered by opening the Item Description window - Try opening any tool, then opening the Item Description window for a tool, and then try re-opening that tool - the script error will occur. A quick fix for this is to go into the Internet ...


1

Have you tried adding the "(A)" before passing the output parameter to the algorithm? You would need to add 3 lines to the for loop in the run() method: for fname in glob.glob("*.shp"): pieces = list(os.path.splitext(fname)) pieces.insert(1,"(A)") nameWithA = "".join(pieces) outputs_1=general.runalg("qgis:clip", outputs_0['SAVENAME'], fname, ...


1

Yes, there are two possible approaches to use. One is to use the OD Cost Matrix tool and simply split up the resulting table. You'd select all records with the same origin point and export them to a new table. There is at least one Split by Attributes custom tool for ArcGIS out there (referenced here but the 10.x link there is currently broken) that can do ...


0

To try and help with this I have run some tests but they are providing an unexpected result so I think you should report this to your local Esri support. First I wrote a simple script which should open an MXD, make its thumbnail and save the MXD with that thumbnail. On any subsequent runs the script should overwrite the existing thumbnail with a new one. ...


0

Double check the filepath. In this case, there might be a small mistake in the filepath that causes the script to stop working.


0

You should use a scanline and the unpack struct function with Python/GDAL. The scanline/struct method depends on fmttypes and their values can be supplied in a dictionary. For testing my answer I prepared a little raster of 29 rows x 29 columns and selected a region of 9 x 9 pixels in the arbitrary position (xoff,yoff) = (5,7). I registered manually the ...


3

There is an Esri blog post that describes the technique for doing this in detail called If you are stuck at "if" – Part 1: Part 1 – Gives examples of quick and dirty ways of using the Calculate Value tool to create branches using if statements in a model. In your case you want to check for the existence of a feature class rather than a product ...


3

I have written a short snippet code with simple syntax, so it will be easy to understand for a beginner. The flow is that you need to get the unique values in the Strings field and then find out whether there are more than one value in the Integers field for this String. If yes - then keep, if no (i.e., the only value was -1) - then delete the row. ...



Top 50 recent answers are included