Hot answers tagged

43

Renaming is possible using Table Manager plugin (http://plugins.qgis.org/plugins/tablemanager/)


17

The MultiQML plugin lets you apply one QGIS layer style to multiple layers at once. I think that's as close to what you are looking for as currently possible.


14

Simplest answer I've found, based on Ryan Garnett's advice to do it within QGIS: Use regexp_replace This capability was added to field calculator 1 year ago by J├╝rgen Fischer (as illustrated by this bug report). I tried for a while to find out how to do this, but failed searching for "qgis regex" and other vague terms. It's functionality is probably ...


10

Form layout You have the following methods to do this: QgsVectorLayer.setEditForm( '/path/to/your/ui/file' ) to provide a UI file and QgsVectorLayer.setEditFormInit( 'python.Function' ) to provide a python init method So having a QgsVectorLayer vl the following will do what you are looking for vl.setEditForm( '/home/me/uifile.ui' ) vl.setEditFormInit( ...


10

By default CSV layers cannot be edited. You have to save to a different format, e.g. Shapefile, before you can start editing. Update 2015-11: There's a new plugin that solves this issue called Editable GeoCSV. It can handle x and y columns for points or a WKT column. For more details see http://giswiki.hsr.ch/Editable_GeoCSV_QGIS_Plugin


9

Use Group Stats plugin and set the ID as a field classification. You can see how many times each value has been entered in 'count' column.


9

One way you could do this (while avoiding the two other solutions you mentioned - creating a new layer from selected features, or adding a new field for color) is to use a Definition Query. First, you will want to create a duplicate of your current layer so its in your Table of Contents twice. Then you will need to set a Definition Query for each of ...


9

You can use this command to replace all commas in the fields of your Species column with spaces: regexp_replace( "Species", ',', ' ' ) In this post answered by Nathan, the regex_replace function is described by : regexp_replace(string,regex,after) So in your case: 'string' is your column (species) 'regex' is the character you want changed (comma) ...


7

Creating a new integer column is the right way to go - but the 1*FIPS that you used (which would work in Excel or Libreoffice) is where the problem comes in; QGIS doesn't automatically convert between field types in a calculation. You need to use one of the conversion functions (toint converts to integer, tostring to text, and toreal to real/decimal) with ...


7

This may be a dumb answer, as it may be a learning objective for the grad students, but is there a reason why you are not editing the attributes in QGIS with the use of the Field Calculator? In previous versions of QGIS (pre 1.7) editing attributes directly within QGIS was not possible; hence the need for editing .DBF files in OpenOffice etc. As of 1.7 ...


7

If you don't need some kind of routine or script, here is the simple procedere using QGis (Master 1.9, but 1.8 should also work). Add your shapefile as vector layer in QGIS Add your table (can be .csv or .xls files) to QGis in the same way -> Add Vector Layer Both, table and layer should now be visible in the layer table of contents. Now make a simple Join ...


7

use vector ->geoprocessing tools --> dissolve: select shapefile and field (LEP_NAME in your case), choose name for new shapefile and you are done


7

Shapefile format cannot support column names longer than 10 characters (a limitation of the dBase format). If you converted to an enterprise geodatabase (ArcSDE) table the limit would be 31 characters (30 in Oracle). File geodatabase supports 64 character column names.


7

Edit: The first method I posted wouldn't work. This one should though. One straightforward way to do this would be to select everything you want to keep via Make Feature Layer with a where clause of X <> c. Then, use Copy Features to save the result.


7

Here is the arcpy version of zoom to next feature. You may run this in your ArcMap python window: mxd = arcpy.mapping.MapDocument("CURRENT") # currently opened map doc df = arcpy.mapping.ListDataFrames(mxd, "Layers") [0] # define layer you want to iterate and zoom on for lyr in arcpy.mapping.ListLayers(mxd): if lyr.name == 'myTOCLayerNameHere': ...


6

The event is OnChangeFeature.


6

A quick (although inelegant) way to do this is to go into Layer properties, select Style - Categorized using the column that you're interested in. Apply this, then right click on the layer in the layers window and check the Show Feature Count checkbox. Then expand the layer in the layers window and you can immediately see how many times each value has been ...


6

What you want to do is called a Spatial Join. A common GIS task is to join the attributes from one spatial data layer to another. In this example we will join the attribute table from a polygon layer to a points layer, based on which polygon contains the points. In QGIS, you can do that by using the JOIN ATTRIBUTES BY LOCATION TOOL. You can ...


6

I think that the best way to think of an attribute is "some property or characteristic of the thing I care about". So for a point that represents a place, it could be the name of the place, the street address, the kind of place it is (e.g. a shop, or a house), or the properties of the soil that is present, or the height of the antennas. Obviously what ...


6

Use field calculator (Python) on shape field, e.g.: arcpy.Point(1747952,5907660) If you know coordinates of this point. This is extension of original answer. Create a copy of the layer in table of content and and call it 'points'. Select correct point in 'points. Use field calculator (Python) on shape field for record with missing geometry: def ...


6

It sounds like you want to subset your data and plotting is secondary. Please keep in mind that it is not always necessary to create a new object. If you are only wanting to plot subsets of the data it is far more efficient to take @fdetsch advice and subset in the call to plot. Here are some examples of subseting and plotting sp class data using the meuse ...


6

First part is the AddIn, the real work is done on a form: Inherits ESRI.ArcGIS.Desktop.AddIns.Button Private pForm As fFeatureInspector Public Shared IsFormLoaded As Boolean = False Public Sub New() End Sub Protected Overrides Sub OnClick() 'My.ArcMap.Application.CurrentTool = Nothing If Not IsFormLoaded Then pForm = New fFeatureInspector ...


6

You need to use the following syntax. title('yourstring') or title("yourfield") The answer to that question is talking about using a 3rd party plugin (not sure why really)


5

You should use context property of Style object: options = { div: "map", zoom: 12, center: [-9074392.9993436, 5021122.97485], layers: [ new OpenLayers.Layer.OSM() ] }; map = new OpenLayers.Map(options); OpenLayers.Util.extend( OpenLayers.Feature.Vector.style.default, { label: "${getLabel}", pointRadius: ...


5

If you need to get the fields of a layer you can use QgsVectorLayer::pendingFields() in Python like so: fields = layer.pendingFields() which will give you something like this: {0: <qgis.core.QgsField object at 0x46d9d40>, 1: <qgis.core.QgsField object at 0x46d9b00>, 2: <qgis.core.QgsField object at 0x46d9cb0>, 3: ...


5

Try right clicking the "Field" column header and un-check 'Sort Fields' if it's checked.


5

Quantum GIS has excellent support for PostGIS (which I guess you can use at home since it's free software), so if you are familiar with it, you could script this procedure using SQL with something like this: UPDATE poly_layer p SET neighbors_class = ( SELECT class FROM ( SELECT class, count(0) FROM poly_layer n WHERE ...


5

In ArcGIS 10 you can use the Lookup tool (requires a Spatial Analyst license though) which is used to create a new raster based on the value in the attribute table of another raster.


5

Using the python field calculator: http://hub.qgis.org/wiki/17/Using_Python_to_calculate_attribute_values_with_'fieldpyculator' You should be able to us the .title() method on your strings: http://stackoverflow.com/questions/3728655/python-titlecase-a-string-with-exceptions Edit: Assuming the attribute field you want to change is "FIELD", the sintax to ...



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