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


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


9

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


8

Out of the box, field calculator does not support spatial joins across feature layers. But, if you have a look at NathanW's post on the function editor for qgis expressions you will be able to make out that we can script our own data interaction. The following script will allow you to express what you're after. It works by iterating through all features ...


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


6

If anyone get stuck with identifying layer type in OpenLayers 3, there is a more sophisticated, JavaScript method to achieve this. As layer objects are created with layer constructors, the native instanceof JavaScript function can be used to check for layer type. As the identification of a layer type usually gets into an if or switch clause, one could ...


6

GDAL suppports that so it should be possible for QGIS as well. However, I could not make it work with my QGIS 2.6.0. Perhaps there is just some missing step and somebody can point what it is. Test with GDAL and VSICURL gdalinfo /vsicurl/http://dl.maptools.org/dl/geotiff/samples/made_up/bogota.tif Driver: GTiff/GeoTIFF Files: ...


6

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


5

Split Layers by Attributes check out this python toolbox. Split Layer by Attributes, State Name, being the attribute you want.


5

Here's the ListLayers documentation ListLayers(map_document_or_layer, {wildcard}, {data_frame}) You can use a wildcard if you know the name of the layer. mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] road_layer = arcpy.mapping.ListLayers(mxd, "Road", df)[0] river_layer = arcpy.mapping.ListLayers(mxd, "River", ...


5

I don't think you can remove features from a selection layer once it's been created, but the workaround that I usually use is to create a new selection layer from your existing one: Select the features in your selection layer that you want to remove. Open the selection layer's attribute table and click Switch Selection, which will make all the features ...


5

Yes, very simple: Just use the Categorized Symbology. If you do not have any attributes, you can just use $id as your "Column". Result:


5

This is a great question, I had to do something similar recently but with a much smaller dataset, so I was able to use a simple intersection with some extra visual quality checking and it was fine. But here's an idea for this, though I don't have code, and it's kind of a hefty process. Definitely test with a sample from the full dataset first. You can ...


4

Nick Ochoski is right about the SearchCursor, but there is a cleaner way to use it WITHOUT a while and manually calling next: import arcpy fc = "c:/data/base.gdb/roads" field = "StreetName" cursor = arcpy.SearchCursor(fc) for row in cursor: print(row.getValue(field))


4

First, feature classes don't have symbology attributes. Symbology is attributed to layers in ArcGIS. When you add a feature class to a table of contents in ArcMap, a layer is created, though not saved anywhere as a .lyr file. If you are having your users add a feature class to ArcMap that they then symbolize as desired, below is the way of saving that ...


4

The Extent object supports a 'disjoint' (i.e. does not intersect) method. Try something like: for mxdname in arcpy.ListFiles('*.mxd'): print mxdname mxd = arcpy.mapping.MapDocument(os.path.join(env.workspace, mxdname)) df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] for lyr in arcpy.mapping.ListLayers(mxd, "" ,df): if ...


4

In Python a backslash is an escape character. In order to put a backslash in the string you need to need to put another backslash next to it to stop it from forcing a new line. myString = "this is\\ a string with a backslash" I can see your paths are set correctly but maybe the strings you are parsing only have a single backslash. You can solve this ...


4

Actually, logically Union is the the area shared by both plus the area of each of the two layers not shared by the other. Therefore the area returned must be equal to or greater than the area in the largest layer. This is what you are seeing. The way to extract just the portion where the land use layer and the limit layer intersect is to use the Intersect ...


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

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


4

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


3

Error 010246 from ESRI support describe either a state that all input points have the same location, or that one or none point were selected. I believe that the second one applies to your model. I suggest you manually check whethear some polygons don't contain points at all, or contain one point - you might use spatial join to get the counts. After that ...


3

Append may be what you are looking for. You should be able to select the polygon you want to move from the yellow layer and append it to the existing red layer.


3

Again, as explained in your earlier question (Creating Layer for Selected Features, then Moving it using ArcGIS for Desktop?), layers are views, not data. You need to manipulate the underlying data to achieve your desired result, and there are two approaches you can take. Neither is 'right' - they both have valid reasons to use. First, you can have one ...


3

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



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