Tag Info

Hot answers tagged

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


9

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


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


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


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

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


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

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

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


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


4

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


4

Assuming python and you want as a result a dict { "Facility Type" : None, "Geoid": "<a ...", "County" : "Saginaw County", "2010 Correctional Population": 18 } you could use mystr = "<div>Facility type: </div><div>Geoid: <blah></div><div>County: Saginaw County</div><div>Pop: 18</div>" parts = ...


4

I remembered an entry from ESRI's Geoprocessing blog which describes a tool which concatenates row values and does what you're after. I haven't used it before as I haven't had a need for it yet. But I thought it looked useful and I think this will be an easy solution for you. From the ArcGIS Resource Center: This tool is based on a python script that ...


3

I think Intersect will enable you to quickly identify the overlaps and give you an attribute table that you can use to zoom from one overlap polygon to the next. "Intersect can run with a single input. In this case, instead of discovering intersections between the features from the different feature classes or layers, it will discover the intersections ...


3

To all the people who are looking for a way to collect data via Popup as asked in my question, this is how I solved it (same script as in question except the added popup-function and the tool "select"): function init() { Save-strategy var saveStrategy = new OpenLayers.Strategy.Save(); //empty map, bounds are test-layer bounds (EPSG:32647) map = new ...


3

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


3

Changing of attribute types simply isn't supported. You can only QgsVectorLayer::addAttribute or QgsVectorLayer::deleteAttribute. Those two will only work while editing (ie. between QgsVectorLayer::startEditing() and QgsVectorLayer::commitChanges()) and then QgsVectorLayer::pendingFields() will reflect those changes and so will the UI. When not editing ...


3

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


3

Attribute table you can not see in the map service..You have to go back ArcMap and then you can see the correct information.. OR you can fire query through the REST url OR if you need to create web application in that you can verify the correct information through identify option (If you are using ArcGIS Server 10.0)


3

I have a solution. Not necessarily pretty but it works on my test dataset and is actually fairly easy. First up, this only works if your "houses" and "office" categorisation is numerical because you can't calculate a mode (what you want) from non-numerical data in ArcGIS. That should be easy enough to arrange so I'll leave it as an exercise for the reader. ...


3

I would use the Union tool of ArcGIS for Desktop to do this. How it works is described here.


3

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


2

I think you are confusing an Empty String, with a NULL Value. An Empty String is a unique string of length zero. This means that there are data in the field that represent a string. That is different than a Null, which indicates that data do not exist. To test for this, try selecting a feature in the attribute table, then calculate values on the field. ...


2

If the IDs are consecutive, I would add a new temporary column with unique values like @Ship.shp suggested and then use the query builder to search for ID != uniqueID. That would return the duplicates directly. After fixing the original IDs, remove the extra column or repeat the whole process as needed — it is not clear what kind of pattern your IDs must ...


2

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



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