Hot answers tagged

5

You can use the Sort and Number plugin. It allows you to sort an attribute table by up to 3 fields, then it creates an additional field that contains the order of the sorted features. Disclaimer: I'm the author of the plugin.


5

You need to use the str.replace() to replace the characters in your field values. Also needed to put a for fc in fcs: to loop through your shapefiles, and remove the square brackets from around fieldList in your cursor (this is what is giving you the error 'field_names' must be string or non empty sequence of strings) And note the u in front of u"Ü" so ...


4

You can easily achieve that with select by expression dialogue. "my_field" LIKE '%specific_words%' See this example


3

If is OK to save the result permanently you can sort the shapefile with GDAL ogr2ogr -f "ESRI Shapefile" -dialect sqlite -sql "SELECT * FROM my_shapefile ORDER BY attr_1, attr_2, attr_3" sorted.shp my_shapefile.shp Took less that 3 minutes with a shapefile having one million polygons.


3

you can also use strpos( "myField", 'awesome') > 0 and for case insensitive searches strpos( lower("myField"), 'awesome') > 0 this is slightly more error-prone as you need to put double quotes around field names and single quotes around string values. I always fall into that trap. I noticed that a recent version of QGIS (2.12?) has quietly ...


3

The tool does not carry over source point layer field/attributes. You will have to apply other tools/methods (e.g. spatial join) to bring over those attributes.


3

Not that I'm aware of in ModelBuilder as a setting. The only way I can see calling that action would be calling a python script at the end of the model that makes the .net arcobject call to open said layer/table.


2

If you want to extract the content of the first <b> tags of each field, you can use the following expression in the field calculator: regexp_substr( "fieldname", '^<b>(.*)</b>') With your samples, this results in: xyz: 11.02.2016 04:05 - 14.02.2016 04:03 xyz: 01.03.2016 04:01 (null) If you need something more advanced (such as ...


2

Save your excel file as a .csv, or export the excel file as a .dbase table or into a geodatabase. You should then be able to successfully join.


2

Create a separate column and enter the value you want there. You can select all elements and enter the value directly in the second level of the toolbar. Make you sure you name all columns you want to be merged the exact same.


2

Since you mentioned "Select by Attribute", I'll assume you're using ArcGIS. If your time values are stored in a datetime field (as opposed to a text, integer, or other field type) you can do this using the Less Than and Greater Than operators. Less than works as "earlier than" for time values, and greater than is "later than". Greater than/less than can also ...


2

I see a couple things going on here. In your first code example you tried to set fc to a list of two feature classes. The listFields function expects a single feature class, not a list. If you wanted to do that, you'd have to iterate through your feature class list. The next big thing I see is that those funny characters that you're trying to get rid of are ...


2

This is Linear Referencing task, however Python makes it much easier. Solution below assumes your points and line are in projected coordinate system. Add your line to mxd, call layer "line". Add numeric field to your points table, use advanced mode in field calculator, python and this expression to polulate it: def Chainage(shp): mxd = ...


2

I would use the Count Points in Polygons tool in the Processing Toolbox -> QGIS Geoalgorithms -> Vector Analysis Tools. The result is your layer "province" but with an additional field which lists the number of hotels. Note that this tool counts points, so you'd have to convert your hotel polygonal layer into a point layer using Polygon Centroids or some ...


2

The DB Manager plugin in QGIS now has a 'Virtual Layers' node that allows you to write SQL commands against shapefiles loaded into your QGIS project. So now that you have this ability, the SQL logic to sort by multiple fields is in the ORDER BY statement, using asc (ascending), desc (Descending), and you can string them together to sort by multiple columns: ...


2

You can access the attribute table if the pixel values are in integer type because opening attribute table of float type raster is not possible. If you have ArcGIS, you can open the attribute table after converting the float type raster into integer type, but unfortunately, this cannot be done in QGIS even if you converted your raster to integer type. Check ...


1

If your data is regular enough that your data is always between b and /b it should be possible without using special python expressions. The Idea is to use the "substr" function for this. But as it is not always the same length and position probably you need to find the position first. That can be done with the function "strpos" that gives you the position ...



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