Tag Info

Hot answers tagged

13

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


11

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.


11

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

For this you can use UpdateCursor, which opens the feature class or table and steps through each record (row) incrementally. The script below works on this test data +-----------------------+ | Time| Home_Away|Trip | +-----|----------|------+ | 1 | 0 | <nul>| | 2 | 1 | <nul>| | 4 | 1 | <nul>| | 5 | 0 | ...


8

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


8

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


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

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.


6

The event is OnChangeFeature.


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

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


6

CSV layers cannot be edited. You have to save to a different format, e.g. Shapefile, before you can start editing.


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

You should have no problem calculating a field based on another. One way to accomplish this is through the field calculator directly. You can also easily incorporate calculations such as this using stand-alone Python scripting. I've attached a screenshot from ESRI's Calculate Field examples that will hopefully get you started. Keep in mind you will have ...


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 ArcMap, you could use python to run nested search cursors. For example: arcpy.MakeFeatureLayer_management("region shapefile location", "Regions") arcpy.MakeFeatureLayer_management("event shapefile location", "Events") out_features = "name and location for output clips" out_count = 0 r_rows = arcpy.SearchCursor(Regions) for r_row in r_rows: r_name = ...


5

If the output file is a shapefile, it is not possible due to the restrictions of the shapefile definition: http://www.gdal.org/ogr/drv_shapefile.html Attribute names can only be up to 10 characters long


5

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.


4

You will need to first load both of the layers you want to join into the map canvas - there is no option to add an additional file once you've opened the Properties dialog. Or am I misunderstanding the problem? You can add any OGR compatible layer - e.g. a CSV file - as a layer (doesn't need to be a delimited text layer with X and Y!) and then do a join. ...


4

you can check this example on openlayers. OpenLayers.ProxyHost = "proxy.cgi?url="; var map; function load() { map = new OpenLayers.Map('map', { maxExtent: new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573) }); var political = new OpenLayers.Layer.WMS("State Boundaries", ...


4

The Feature Merger transformer will allow you to Join by attributes Using FME Desktop 2012 SP2 here http://docs.safe.com/fme/pdf/FMEReadersWriters.pdf Search 'Feature Merger' A good blog post 'Joiner vs Feature Merger' by Mark Ireland http://evangelism.safe.com/fmeevangelist79/


4

This can be done easily in a number of ways, but the best way would be to use the FeatureMerger Transformer. The Requestor will be the shapefile, the Supplier will be the text file. If you leave the settings on their defaults that should be fine for you. This will give you parameters that look like this: Note: The first few times you run it be sure to ...


4

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


4

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.


4

The ArcGIS 10 help under "calculate field examples" shows you how to "Calculate the accumulative value of a numeric field." This will do the trick, provided the data are physically in the intended temporal order. To apply it directly, invert your [Home/Away] indicator (subtract it from 1) so that "0" means "away" and "1" means "home". I call this ...


4

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


4

in arcgis you want to do a spatial join. from the arctoolbox select analysis tools, overlay, spatial join. choose the one to many operation. "ESRI desktop help 10.1" use the intersect match option. In my example the first time I got the target features switched so pay attention to the target and join features.


4

What you are doing is fine and good practice. You are not creating a new class but a new feature each time. A new class in your case would be if you added a new LandUse code, say "Big Building" or something like that. What has happened in the original dataset is your colleague has draw in each building and then combined them into a single object called a ...



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