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


20

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


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


12

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

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.


12

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


11

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


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

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

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.


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

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

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


5

Problem was solved by setting the SRID value to the database and using the native SRS in Geoserver. Even though the declared (and forced) SRS code in Geoserver was the same as the native SRS, it apparently affected the spatial filters. http://172.17.14.211:8080/geoserver/wfs?request=GetFeature&version=1.1.0&srsName=EPSG:3067&typeName=LiVi:...


5

Use Focal Statistics weighted kernel file to omit the central cell with the format: 3 3 1 1 1 1 0 1 1 1 1 See example of ASCII weighted kernel file in the help topic How Focal Statistics works. Save as *.txt. The only statistics available with this neighborhood are mean, std, and in this case sum (useful on binary rasters of each landcover value - so ...


5

You can do it by converting your bounding box to pixel offset and size: from osgeo import gdal def map_to_pixel(mx,my,gt): #Convert from map to pixel coordinates. #Only works for geotransforms with no rotation. px = int((mx - gt[0]) / gt[1]) #x pixel py = int((my - gt[3]) / gt[5]) #y pixel return px,py def extent_to_offset(xmin,ymin,...


5

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


5

Some GPS hardware/subsystems in modern smartphones implement Kalman Filtering and sensor fusion. For example, this is the system log output (edited for relevant portions- full dump is here) from a Samsung Galaxy S3 with Android 4.3 after I fire up the LocationListener, when listening to the GPS_PROVIDER. Here you see the app (GPS Benchmark) listening for GPS ...


5

The sieve model is fairly straight forward and you can implement it in ArcGIS using "RegionGroup", "ExtractByAttributes", "SetNull" and "Nibble". It is good to understand how these methods actually work so, I encourage you to work through this method yourself. I do have a sieve function available in the Geomorphometry & Gradient Metrics Toolbox. You ...


5

Right-click your layer in the table of contents. Choose Filter... Enter a valid SQL statement (see here for more) that excludes the rivers with no name, such as: "NOME" is not NULL


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