Tag Info

New answers tagged

1

I would use below code-- import arcpy,os,sys pattern = 'fish_46.shp' folder = 'C:\Users\USER_NAME\Desktop\delete'## root folder field = 'Id' ## your field where calculation to be applied files_process = [] for root,dirs,files in os.walk('C:\Users\USER_NAME\Desktop\delete'): for filenames in files: if filenames == pattern: ...


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' ...


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 = ...


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 = ...


0

a) Are you talking about the "hover infowindows"? If so, seems like a problem related with the CSS styles. b) Seems like there is a bug with layer visibility in CartoDB.js library: https://github.com/CartoDB/cartodb.js/issues/282. Cheers!


0

A bit weird, but did you try to catch the secondary click event using Leaflet (assuming you're not using Google Maps), and then open a popup or raise a featureClick event in your layer? Almost pseudo-code here, but... map.on('contextmenu',function(){ // Do something to get Lat, Lng of the point var lat = ...; var lng = ...; var sql = ...


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

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: ...


0

This is possible with python. if this is part of your workflow in python you should do some python coding. If your ultimate goal is to add the layers to the map (mxd) you can achieve this goal by: 1- go to the root folder of your layer files in the explorer 2- search for this term: *.lyr 3- use cntrl+A to select all lyr files. 4- drag them to the map of ...


0

I gave it a try and it works quite well. Have a look at http://jsfiddle.net/75L79616/2/ . Add an event listener for changebaselayer: map = new OpenLayers.Map('map', { projection: new OpenLayers.Projection("EPSG:3857"), strong texteventListeners: { "changebaselayer": mapBaseLayerChanged } }); add an ...


0

The way that I would do this is to use the SearchCursor to create a Python dictionary from your look up table before starting to iterate through the layers. That way, as you iterate each layer you just have to look up the relevant text in the dictionary using its key. I suspect that doing that your code will be shorter and easier to read. You should be ...


0

I would extend the GraphicsLayer this way GraphicsLayer.prototype.addGraphics = function(arrayOfGraphics){ var that = this; arrayUtil.forEach(arrayOfGraphics, function(graphic){ that.add(graphic); }); }


0

You have the union tag in your question all that is missing is adding an attribute for the colour you want to each layer before doing the union. The results will have a lot of spurious slivers. You say you have polygons but also that you are using raster calculator - a raster approach might be better but again you need to get your values sorted in the data ...


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

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 ...



Top 50 recent answers are included