New answers tagged

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


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.


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.


0

I was having the same problem as Anthony To where I can only edit Alias in ArcCatalog, but when I closed the ArcMap where the same feature class is being used, I was now able to edit the Field in ArcCatalog. In short, make sure the feature class is not being used in any open ArcMap.


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


0

So, I will post an answer, which could be useful to other users which are using central European characters. I think it could work other characters and encoding for other languages, but the encoding and characters must be changed, depending of the language. This is example for central european, and character Đ. This site could be useful for the codes. ...


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


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


0

Sometimes I have needed to be dynamically linked to an Excel sheet that others interact with. One thing you might try is to open Access, go to the External Data tab, hit the Excel button, select Link to the data source by creating a linked table, and ensure your fields are all importing as the correct type. If you create a database connection with the ...


0

Might be good idea to review this since you said it is clean and doesn't contain any characters, sometimes you might be missing something... http://desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/understanding-how-to-use-microsoft-excel-files-in-arcgis.htm


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.


0

You can use virtual layer for creating a new calculated table. I'm not sure to understand the result you want. If you want a table like : Trail | Type | count you can use a query like : SELECT Trail, Element_type, count(*) AS count FROM layer GROUP BY Trail, Element_type ORDER BY Trail, Element_type For a unique trail (to repeat as differents ...


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


4

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


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

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


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



Top 50 recent answers are included