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


19

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


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.


11

Use the methods available on the ISQLSyntax interface to make your code workspace-independent. As the help on IQueryFilter.WhereClause explains, use the ISQLSyntax.GetSpecialCharacter method to return the delimited identifier prefix and suffix specific to your workspace and add them to your column identifiers. Example: ISQLSyntax sqlSyntax = (ISQLSyntax)((...


11

In QGIS you should be able to filter your data with an SQL expression in the Query Builder dialog. Just right click your layer in the table of contents and select "Query" ("Filter..." in the more recent versions).


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


9

In QGIS you have the raster calculator (Under the "Raster" menu) which will do what you want. (not a shell script command) Load your Globcover raster into QGIS, and open the Raster Calculator. The raster will appear in the "Bands" window. Enter a name for the new "Output Layer". Now double click on the Globcover band name so that it appears in the lower "...


9

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

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


7

To read a filter from a string should look something like: var my_filter_xml, parser, xml; parser = new OpenLayers.Format.Filter.v1_1_0 (); xml = new OpenLayers.Format.XML(); my_filter_xml = '<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyIsEqualTo matchCase="true"><ogc:PropertyName>code</ogc:PropertyName><ogc:...


7

Are you trying to do this in near real time with telemetry feedback to an R/C controller, or against a datalog after recovery? Either way have a look at your datastream or datalog file. Depending on the brand of GPS and type of data logging you might have full NMEA sentences, or just abreviated fixes to work with. If NMEA 183 sentences look for--GGA-GSA-...


7

Filtering (ie. using Layer / Query or the Query Builder in layer properties) in QGIS justs adds a where clause to the query that is executed. So that shouldn't be different to you want to do "in" PostGIS. Although I'm not sure what you intent to do there.


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


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

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


6

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.


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

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

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


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

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


5

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


5

Figured it out! The following SLD uses a rendering transformation to call "gs:Clip", which clips vector features to a bounding geometry. The result is then rasterized by GeoServer's WMS. <?xml version="1.0" encoding="UTF-8"?> <StyledLayerDescriptor version="1.0.0" xmlns:ogc="http://www.opengis.net/ows" ...


5

You can enter the following python command which will create an expression based on the selected feature ids on the active layer. '$id in ({})'.format( ','.join( str(id) for id in iface.activeLayer().selectedFeaturesIds() ) ) $id in (497483783,497483784,497483785) or something that works also with persistent values but needs to be finetuned for your ...


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