Hot answers tagged

33

Disclaimer: Because the syntax for filtering in QGIS works with SQL, I'm assuming here that SQL rules apply. I'm not completely sure if that's entirely correct, but it seems logical and it does explain the behavior. The filter works with SQL, that's why you have to look there for an answer. In short, when using a logical operator in combination with null, ...


21

NULL is not a value, therefore it cannot equal = or not equal != anything. It is not the same as zero 0 which is a value. A NULL indicates that no value has been recorded in the cell you are looking at. To check if a value exists you ask if the cell IS NULL or if it IS NOT NULL IS NULL checks to see if the cell is empty IS NOT NULL checks to see if the ...


15

You can simply do: features = l.getFeatures('"Counties" = \'Norwich\'') The QGIS expression engine is also able to do this using the QgsFeatureRequest.setFilterExpression(str) method (Since QGIS 2.2) request = QgsFeatureRequest().setFilterExpression( '"Counties" = \'Norwich\'' ) it = l.getFeatures( request ) Starting with QGIS 2.10 it ...


15

You can use the tbl_metadata file as coverage layer in Atlas. Then use rule-based symbology with @layer_name = @atlas_pagename. I assume that your data looks like this (the attribute table is tbl_metadata table): Set the tbl_metadata as Coverage layer and select the field with dataset name as Page name. If you want to hide the coverage layer geometry, ...


13

This is how I'd do it with PyQGIS: In your QGIS ToC, turn off those layers that you want to keep untouched, i.e., leave visible only the layers you want to set the filter to. Now open a QGIS Python console and paste this code: layers = iface.mapCanvas().layers() for layer in layers: layer.setSubsetString('"osm_user" = \'donlaser\'') This should do ...


13

Your observation is correct, The Query Builder does not use the same syntax as the rest of QGIS. Throughout QGIS, the syntax is based on QGIS Expressions a customized SQL dialect. This is portable between almost all parts of QGIS where you can enter a filter, calculate a value... This syntax is parsed and evaluated directly in QGIS (and parts of it may be ...


12

Using Overpass turbo, the syntax is: area["name"="Nordrhein-Westfalen"]->.boundaryarea; ( nwr(area.boundaryarea)[amenity=bank]; ); out meta; nwr is a short for node-way-relation


12

Assuming you don't have a unique id field, you can use rule based symbols with the following filter $id % 10 = 1 The % sign is equivalent to remainder, so any row that divides by 10 with a remainder, i.e, every 10th row will remain while the others will be filtered out of the result.


10

If you have a raster DEM already, then there is a tool that I developed in Whitebox Geospatial Analysis Tools called Remove Off-Terrain Objects, contained within the LiDAR toolbox, that works well for creating bare-earth DEMs, particularly in urban and agricultural settings. It works less well where either the terrain is steeply sloped or the forest cover is ...


8

I got good results with mDenoise. This tool uses the Sun's denoising algorithm which removes noise without filtering sharp edges like ridges or peaks. Good for mountainous areas especially high mountains. You can define the threshold and the number of iterations. You have to try something around to get the best result. Before denoising ASTER GDEM2: After ...


8

I was able to filter using "START_DATE" > '2001-01-01' (double quote for Fields and single quote for Variable are important) if I opened the attribute table and used select by expression, but the same expression failed using query builder using QGIS 2.8.


8

Try with intersects: <ogc:Intersects> ... </ogc:Intersects>


8

Layer filters don't use QGIS expressions, and are instead handed directly off to the underlying data provider. So, for instance, a filter on a postgis layer is passed to postgres to evaluate, and accordingly must use postgres syntax and functions. This means QGIS expressions functions and features like variables don't work in layer filters.


8

Alright, I figured it out. Filtering can be done using the image properties (you can see what properties are available by searching for the product in the search bar). In this case, NASA's NEX-DCP30 data comes with a 'scenario' property, so adding a single line of code filters to this level. For example, to access only the RCP 4.5 projections: var ...


7

The Quick OSM plugin for QGIS generates the following working Overpass query: <osm-script output="xml" timeout="200"> <id-query {{nominatimArea:Austria}} into="area"/> <union> <query type="node"> <has-kv k="amenity" v="bank"/> <area-query from="area"/> </query> <query ...


7

Your Code These lines don't seem to work out: var dateFilter = ee.ImageCollection(longRain2016.merge(shortRain2016).merge(longRain2017).merge(shortRain2017).merge(longRain2018)); var s2dateFilter = s2.filter(dateFilter); You are trying to construct another ee.ImageCollection passing existing ImageCollections to it. According to the API, this won't work. ...


6

There is nothing wrong with your query. = is a comparison operator and it returns all the records which begins with your string Use this instead: "GNR" LIKE '.11' When you compare alphabetic characters, use ILIKE instead. EDIT In QGIS 2.0.1 or newer you can use regular expressions, also: regexp_match("GNR", '^.11$') where: ^ indicates the start of ...


6

First of all you can't use both BBOX and FILTER in key value pair formatted GET request. In the WFS standard version 1.1.1 it is written as "BBOX (Prerequisite: TYPENAME) (Mutually exclusive with FEATUREID and FILTER.) In lieu of a FEATUREID or FILTER, a client may specify a bounding box as described in subclause 13.3.3." WFS 2.0.0 standards puts it as "For ...


6

Use "LIKE" with percentages. In my shapefile of countries I can select any country with a name like "This and that" with: "CNTRY_NAME" LIKE '% and %' this selects only "Bosnia and Herzegovina". If I remove the spaces: "CNTRY_NAME" LIKE '%and%' I get Iceland, England and all the others with "and" in them. That all works for shapefiles - the help for the ...


6

I just finished writing a script to accomplish this task using the free and open-source GIS Whitebox Geospatial Analysis Tools (download here), for which I am the lead developer. The source code of the script can be found here. Although the script is not yet part of the current official Whitebox release (v. 3.2.1) you can get an early version of it by ...


6

here is a rough, general approach, with a few code examples (using jQuery/javascript): Set up a couple of color styles for the markers (using circle markers here) var blueMarker = { radius: 8, fillColor: "#0000ff" }; var redMarker = { radius: 8, fillColor: "#ff0000" } Add the geojson features as L.circleMarkers, keeping track of each as a ...


6

Here is an example of the syntax for DWITHIN http://demo.opengeo.org/geoserver/wfs?request=getfeature&version=1.0.0&service=wfs&typename=topp:states&outputformat=json&cql_filter=DWITHIN(the_geom,Point(-88 38),0.1,kilometers) Note that DWITHIN takes three parameters: reference geometry, distance, and distance unit. However, GeoServer ...


6

You are using WFS 1.0.0. That WFS version is using Filter Encoding Standard 1.0.0 http://portal.opengeospatial.org/files/?artifact_id=1171 and there is indeed a typo in the standard. On page 17 the schema for filter capabilities is defined as: Spatial capabilities are encoded according to the following XML Schema fragment: <xsd:complexType name="...


6

First, your GeoJSON is invalid. Each feature should have a geometry and a properties property. i.e. the following is wrong: var feature = { "type":"Feature", "geometry":{ "type":"Point", "coordinates":[ "4.347903728485107","50.846658450225334" ], "id":2, "destination":"Museum" } } And the following is right: var feature = { "type":"...


6

This is tricky, as there are actually two issues: It's called system:index even though the UI shows it as id. The id is a string, rather than an integer So the correct way to do this is: print(g200.filter(ee.Filter.eq("system:index", '3')))


6

Make a list of millisecond dates, and then use filter inList: var collection = ee.ImageCollection("MODIS/MYD11A1").select('LST_Day_1km'); var reference = collection.filterDate('2016-01-01', '2016-12-31') var datelist = ee.List(['2005-08-05','2009-09-01','2017-02-08']) .map(function(date){return ee.Date(date).millis()}) var newcol = collection.filter(ee....


6

You can remove images from an image collection by creating a date filter for the 'bad/missing' data and then remove it using ee.Filter.not(). For example: var collection = ee.ImageCollection('NCEP_RE/surface_temp'); var AST2015 = collection.filterDate('2015-01-01', '2016-01-01'); var start_bad_data = '2015-06-18T00:00:00'; var end_bad_data = '2015-06-20T00:...


6

Did you see More Efficient Spatial join in Python without QGIS, ArcGIS, PostGIS, etc and other answers on GIS SE ? Simply import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) uk = world[world.name == "United Kingdom"] type(uk) geopandas.geodataframe.GeoDataFrame So uk is a GeoDataFrame uk.head() pop_est ...


6

You need to create a grouplayer and from that you can add or remove the layer, in that way refreshing the data with the filter from the same dataset. Here are two working examples: the first using buttons, the second radio buttons. http://bl.ocks.org/zross/47760925fcb1643b4225 http://www.gistechsolutions.com/leaflet/DEMO/filter/filter.html


6

What I ended up doing: Layer > Create Layer > New Virtual Layer… Import rid CSV layer. Set query as select "State", count(*) AS “TERPS” from rid group by "State". Click 'Add'. This creates a virtual layer that counts the number of points per date. Close dialog. Go to the properties of the shapefile layer. Create a new join that joins to the virtual layer ...


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