Hot answers tagged

11

Decrease the height of the the legend box to zero: In the example below you can see that I got a line legend even if my data is polygon. Right-click on your legend, click on properties Go to the Legend tab and change the height into either 1 or 0. That will reduce all polygon layer patches in the legend to lines. You can also set this property per-layer, ...


11

I used to work in that exact same environment (the exact same one!). I have not done any benchmark testing but my sense of this is that number of layers in the project doesn't have much effect by itself. In my experience the labeling and number of features is a much bigger issue than the number of layers (especially if many are turned off). I used to have ...


9

The workaround I usually use for any situation in which I want to customize the legend entry for a layer is to create a dummy layer which is only used in the legend, and not displayed on the map. So in your case, create a new line layer using a line shapefile with no features in it, symbolize it however you want, and add that to your legend. The new layer ...


8

A translation is an affine transformation. Next code includes this kind of transformation and it works well at the Python Console of QGIS for creating a memory layer with the displaced layer (building1). registry = QgsMapLayerRegistry.instance() n = registry.count() layers = registry.mapLayers().values() layers_names = [ layers[i].name() for i in range(...


8

I would first check out Best Practices Using Citrix XenApp and ArcGIS, a guide put together by ESRI. For a previous client, I went through quite a bit of performance troubleshooting with ESRI and our Citrix environment. Below are the highlights from those conversations: I'm assuming you are going to be making edits in a tight area (zoomed in pretty close)....


7

You need to understand that there is no such thing as a QGIS Shapefile, A Shapefile is a shapefile regardless of what software was used to create it. According to ArcGIS Online Help: A shapefile is an Esri vector data storage format for storing the location, shape, and attributes of geographic features. It is stored as a set of related files and ...


6

You need to change your view in the Table of Contents. You are currently looking at the "List by Source View" This view does not let you re-order layers. In order to do that, you need to change to the "List by Drawing Order" view. You can tell you are in the drawing order view because the layer source path disappears from the Table of Contents listing.


5

In ol3 version 3.10.0 things have changed. So is more clear than older versions but still more complicated than ol2. So for TILE (ol.layer.Tile) layers your code snip should look like: //declare the layer var osmLayer = new ol.layer.Tile({ source: new ol.source.OSM() }); //asign the listeners on the source of tile layer osmLayer.getSource().on('...


5

Metadata is one of those things that is generally seen as "well, I know I probably should, but, is it really worth the time...?". And the answer is, for most of us, at least the basic parts of it probably should be. There is a LOT of information that can be put into metadata, depending on what standard you're using. However, a lot of that may not be all ...


5

With the next release QGIS 2.14 this will be fixed. If you have python knowledge, it should be straightforward to port the code linked to above to a small python snippet that copies joins and virtual fields from one layer to another. Please note that this is not a bug tracker and instead you should raise the awareness on the issue page you linked to, on ...


5

If you read the syntax section of the select by location tool you will see that it takes Feature Layers as inputs. A string which is a path to a shapefile is not a Feature Layer object. If you think about it how can you represent a selection of polygons with nothing more that a full path string to some file? A Feature Layer has this ability, it is called a ...


5

You simply have to save your style file(.qml/.sld). and everytime you import a new shape file, just load that style file.


4

You could just use a different version of google-maps-api, for example http://maps.google.com/maps/api/js?v=3.5&sensor=false Example: http://jsfiddle.net/expedio/sodserrw/ The same example with your Google-API address (https://maps.googleapis.com/maps/api/js ) is also not working: http://jsfiddle.net/expedio/zx4k29k5/ EDIT1: In the meantime this ...


4

The reason why this code is failing is down to you missing () off the save method on your MXD, so you were not saving your changes. This code worked for me import arcpy print "This script turns off the following layers:" mxd = arcpy.mapping.MapDocument(r"C:\Scratch\newcode.mxd") for lyr in arcpy.mapping.ListLayers(mxd): print lyr.name lyr.visible = ...


4

The best way to save all of the settings of a layer (or multiple layers) in a map document, is to create a layer package. Select all of the layers you would like to save in the package Right-click one of the selected layers and click Create Layer Package Follow the Layer Package wizard, making sure to fill in all of the entries (such as summary and tags). ...


4

TL;DR To get all features of a layer by the layer name you do not need to activate it. Just use layer = QgsMapLayerRegistry.instance().mapLayersByName( name )[0] poles = layer.getFeatures() Active Layer First of all, you do not need to care about the active layer. The active layer is the layer which is currently selected in the layer tree and ...


4

Right click add the labeling toolset Click on 'label manager' the icon next to the Labeling drop down menu... When the label manager appears choose the layer you want to work on on the left panel, then the label field from the drop down menu on the right. Then at the bottom use the 'SQL Query' option to query the records you want to label.


4

One way to do this: Create a function, that will set your layer on top (I guess there are a few solutions, you can use canvas.setLayerSet([top_layer, bottom_layer1, ...]) or something). Choose a signal from the list: http://qgis.org/api/classQgsMapCanvas.html It can be layersChanged() or something that occurs after you add a new layer or change hierarchy. ...


4

The reason you get the NaN-values is the following. If you look at the extent properties, described on the following page http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/extent.htm, you see the object has four more properties. These properties aren't set by default, so you'll get the NaN 'error'. If you only want to display the XMin, YMin, ...


4

I have some experience troubleshooting performance in GIS systems, including on citrix. Your problem can be anywhere and likely a combination of factors. Talk to your Esri rep for pointers. I recommend you read this:http://www.wiki.gis.com/wiki/index.php/Software_Performance#Use_MXDPerfStat_to_measure_display_complexity Labeling, using Feature cache and ...


4

To answer your specific question "How to iterate through layers of an MXD?" mxd = arcpy.mapping.MapDocument("CURRENT") # Uses your currently open MXD df = arcpy.mapping.ListDataFrames(mxd, '')[0] # Chooses the first dataframe for lyr in arcpy.mapping.ListLayers(mxd, '', df): # Loop through layers # Any tools you want to run on each layer go here ...


4

The short answer is no, not without accessing arcobjects. You would need to install comtypes module to access the interface that would return that information.


4

You can use the following code in the Python Console which iterates through each loaded layer (regardless if they're selected or not) and deletes the field with the name you specify. Just replace field_name with...a field name: for layer in QgsMapLayerRegistry.instance().mapLayers().values(): with edit(layer): fields = layer.pendingFields() ...


4

Your variable lyr is a layer object and not a string or list of strings. Consequently, to avoid that error you need to replace: if 'roads' not in lyr: with if 'roads' not in lyr.name:


4

I figured it out! It was something very small. Basically, the layers you would like to see displayed on the canvas is provided through canvas.setLayerSet(list_of_layers). # total list of layers actually displayed on map canvas canvas_layers = [] # load vector layers for files in os.listdir(source_dir): # load only the shapefiles if files.endswith("...


4

If you don't see feature templates for a particular layer, you can add them via the Create Features window: Create Features window > Organize Templates > New Template > In the Create New Templates wizard, check the desired layers. What also works (and that I use to do because it's straightforward), is: starting the Edit session by right-clicking the ...


3

This is related to the introduction of the OGR connection pool. [1] Before QGIS 2.10, a file was reopened on every single access (e.g. repaint). Since QGIS 2.10 the file handle is kept open and this means if a file is replaced the handle still points to the old file on Unix based systems. QGIS 2.10: workaround Unfortunately there is no API to nicely ...


3

You can technically point right to the image file using add layer method, see code below: mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] addLayer = arcpy.mapping.Layer(r"C:\Temp\image.tif") arcpy.mapping.AddLayer(df, addLayer, "BOTTOM") If you want to load the image with a certain saved color scheme you can ...


3

OpenLayers 3.9 introduced the z-index attribute to map layers, which lets you specify the drawing order of layers. Before 3.9, the layers are drawn in the order they are added to the map, as you have noticed. This kind of issue is however more properly solved by using the setVisibile method on the layer, since all you want to do is controlling it's ...


3

The move plugin works in a similar way. calculate the centroids using Vector -> Geometry Tools -> Polygon Centroids for both layers, turn the layer to be moved into edit mode select the feature to be moved activate the plugin with its icon draw a line from the first centroid to the second With right-click, move the object Save the layer turn off the ...



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