Tag Info

Hot answers tagged

10

If I got you right, the answer is yes, QGIS supports dynamic layer names. You would need to write a Python macro to be ran every time the project is opened. This would be the workflow: Go to on QGIS->Project->Project Properties and replace openProject() with the following Python code: def openProject(): import re, qgis iface = ...


3

There is a plugin named Layers menu from project that lets you import layers from other project files incuding the styling. The only pitfall: Attention : the project must be configured to record absolute paths which is not the default for QGIS. But you can change it in the project properties.


2

You can do that from the QGIS Python console. Follow this workflow: Open the QGIS Python console Adjust the following line to match the path of your text file and copy the whole line to the QGIS Python console: textFilePath = '/tmp/non_grouped_layers.txt' As you can see, in the example above, I want to create a text file named 'non_grouped_layers.txt' ...


2

If you work with ArcGIS 10.1 SP1 or above, you can use the arcpy.da.Walk() function: import arcpy, os workspace = r"C:\directory" mxd = arcpy.mapping.MapDocument(r"C:\Map.mxd") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] walk = arcpy.da.Walk(workspace, datatype="Layer") for dirpath, dirnames, filenames in walk: for filename in filenames: ...


1

An alternative way of achieving this is to convert each layer into a raster where the polygon is given a value of 1 the background 0. You then add all your rasters using the raster calculator. The resulting raster is 1 or more for where the channel has been and zero for where it has never been. You can then easily extract and convert the zero pixels back ...


1

1) Create a new Feature Class (FC) in a File Geodatabase (FGDB). Making sure the new FC has the field and field types you need to capture the attribute data from the various 14 layers. Hopefully they are all the same. 2) Import the 14 layers into the newly created FC (R-Click FC, Load --> Load data...). 3) Start an edit session on the new FC. 4) Use the ...


1

For your goal percent of roof area of their respective floor area (only the roof areas that sit in the floor areas) I suggest the following steps: add a column with the floor area to the floor layer if it doesn't exist intersect the roof layer with the floor layer add a column with the intersection area to the intersection result layer compute the ...


1

As Jakob pointed out, layer.simplifyMethod().setSimplifyHints(...) doesn't seem to allow changing the simplification method. In order to change the simplification method for a layer using Python, you can instead create a new QgsVectorSimplifyMethod() object, set the simplification method for that object to NoSimplification, and assign the object to the ...


1

By using the new Layer tree (aka legend or ToC) added by Martin Dobias since QGIS v.2.4, you can load a layer to the top of the ToC following these steps: Get a reference of the layer tree root = QgsProject.instance().layerTreeRoot() Create the layer object from PyQt4.QtCore import QFileInfo fileName = "/path/to/raster/file.tif" fileInfo = ...



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