New answers tagged

0

You may try the following expression. It loops other features from 'your_joined_layer_identifier', order by distance between the current geometry to each 'your_joined_layer_identifier' feature geometry to get milepost_id from nearest to furthest. Then, we get only the nearest with array_get and cast it to real to make calculation. We loop again to get the ...


1

Use ogrinfo. However, it does not know if the editing software has been updating the last update metadata in the .dbf file. GDAL and QGIS do update it. ogrinfo test.shp -al -so INFO: Open of `test.shp' using driver `ESRI Shapefile' successful. Layer name: test Metadata: DBF_DATE_LAST_UPDATE=2020-11-24 See also https://gdal.org/drivers/vector/...


1

A bash solution for this purpose. As stated by other in comments, this recipe considers that dates on your file system/OS can be trusted # Clean to be able to repeat the script multiple times rm *_meta.txt rm summary.txt # Double loop to get basename for shp then from this basename # get all files as your shp various files dates may differ # Sort by date ...


1

It is because of Max. Zoom Level number. If you click edit option on XYZ tiles(which yours is ESRI-Standard), you will see this parameter. Just increase it to 18. If it isn't enough quality, you can set it to 19. But 20 or more than 20 can cause to "Image data not available" problem.


0

So it seems the OP was saving his temporary layer to a CSV which removes the geometry, rendering the points invisible. As long as the geometry is needed, the data should be saved in a format that supports geometry such as a shapefile, as it also supports editing.


0

Using QGIS3, it's possible to use v.drape in the processing toolbox to attach z-values from a DEM to a vector layer of linestrings. The output layer will be MultiLinestringZ. As far as I know there is still no way in QGIS to then calculate the 3d length of those features and add them as an attribute because the $length function only calculates 2d length. If ...


1

from qgis.core import * from qgis.gui import * @qgsfunction(args='auto', group='Custom') def func(feature, parent): root = QgsProject.instance().layerTreeRoot() layer = qgis.utils.iface.activeLayer() lyr = root.findLayer(QgsProject.instance().mapLayersByName(layer.name())[0].id()) group = lyr.parent().name() if group != '': ...


0

you should connect all your buttons to functions before showing the dialog. you can use the function myFunction_suchen to print something for the beginning...: if self.first_start == True: self.first_start = False self.dlg = BaumkatasterDialog() # Signale und Slots verknuepfen self.dlg.pushButton_schliessen.clicked.connect(self....


0

The problem was resolved for me by using the tool vector / geometry / densif geometry (qgis 2.18.18), then i use the new layer for cut and the error it s gone.


1

If you want to use a field of the attribute table for buffering, you can choose buffer by variable distance as the tool you're using, this allows you to write down the field name. Or when using the plain buffer tool as you currently do, you can click data defined override (as you already did in your second screenshot) and then click edit. Enter here the ...


2

After multipart to singlepart as @eurojam suggested, you may select all green areas smaller than 1 sqkm by pasting the expression $area<1000000 into the select by expression dialogue. Your green layer has to use a m-based CRS in order for this to work properly. You then may merge the selected green areas with the other layer as you see fit.


1

There is a problem with whitespaces. New versions of QGIS want spaces before every plus sign except the first one.


6

you can use the processing tool "multiparts to singleparts" before: this will convert the multipolygon (the green one) into single polygons which you can join/merge afterwards.


0

No, the $length function only reports lengths from 2d geometries.


0

You can split the lines at points using the methods discussed here QGIS - splitting lines at points with SAGA OR QGIS - Splitting lines at points using grass Then create a field using the formula $length to calculate the length of the lines (make sure your coordinate system is projected in metres or the value you want your measurement in). This will add a ...


1

you could just use the Vector->Geometry Tools->Extract Verctices tool to make an output of all vertices. Then you could use a Select by expression to get the min and max vertices: "vertex_ind" = maximum("vertex_ind", group_by:="[your_id_field]") OR "vertex_ind" = 0 Then export the selected features as a new ...


0

Leaving the default output (temporary/memory .gpkg) for the grass processing tools was the problem. If you output to a real shapefile, v.to.3d and v.drape function normally and output MultiLinestringZ geometries without any special lco flags.


1

I had the exact same issue: connection established, layer displayed in browser panel, WFS features accessible through web browser. After franticly trying everything it turned out that setting the WFS connection version to 1.0 in the QGIS desktop client worked.


0

You could do it by checking 'Export text as objects' while exporting to an SVG.


1

Adding the OS Vector Tile API to QGIS should be relatively straight-forward process. You will need QGIS 3.16 or higher (as this in when the enhanced VTS Support was added). Create a Vector Tiles | New Generic Connection... In the Vector Tiles Connection dialog – you will need to add the following: Name: OS Vector Tile API URL: https://api.os.uk/maps/vector/...


2

Using the virtual layer, you can compute both start and end point in a single row. Beware that your layer will now have 2 geometry fields, which are a pain to display (the 1st one is usually used) SELECT From_id, st_startpoint(geometry) as geometryFrom, To_id, st_endpoint(geometry) as geometryTO FROM lineshp


3

Yes, you can use "Point"-Input in your model: It expects a user given point by clicking on the canvas and return x,y [EPSG:xxxx] e.g. -0.12,12.4 [EPSG:4326]. You can turn this into a geometry-point by using regular expressions like make_point( array_get(string_to_array((regexp_substr(to_string('-0.12,12.4 [EPSG:4326]'),'[^\\s]*'))),0), array_get(...


1

Normally you should be able to use it as a variable @Coefficient, (originally used inputname without whitespaces and an @ at first sign) e.g. 99 * @Coefficient + 123, but in my experience this sometimes does not work using the processing tool field calculator in graphical model. However, you can simply use refactor fields instead. It offers pretty much the ...


0

It seems that I found the solution here: No sync geopackage raster layer to QFIELD ! Even if I checked the option "relative path" in the project properties in QGIS, it seems that QFIELDSync still exported my project.qgs with absolute paths for rasters. I try to explain how I did it: I opened my "project.qgs" directly in the mobile folder ...


6

You can use the SQLite function row_number() for that, see this example: SELECT ROW_NUMBER () OVER ( ORDER BY name ) RowNum , name, ST_StartPoint(ST_Line_Substring(geometry,0.5,1)) FROM "test" with this result:


0

Run the extract specific vertices tool. Select 0 and -1 for the start and end points to be created as a point layer. Join attributes by location to get both point datasets into the same layer.


3

A pretty dirty solution to this is to use the "String concatenation" tool to generate an expression that you feed into the field calculator.


2

You are doing nothing wrong here. The expression is correct. It just seems like, the attribute() as well as attributes() function does not work in print layout (at least in 3.16). I dont know why. I can only provide a rather poor workaround: Instead of a textfield, add an attribute table and select your layer as datasource and remove the header as well as ...


5

For string-typed target field: to_string( to_date( "field_1" , 'dd/MM/yyyy' ) + to_interval( '10 days' ) ) For date-typed target field: to_date( to_date( "field_1" , 'dd/MM/yyyy' ) + to_interval( '10 days' ) )


5

You can use something like: format_date(to_date("field_1",'dd/MM/yyyy')+to_interval('10 Days'),'dd/MM/yyyy') First you need to convert your string to a date (the to_date() function), so you can add a datetime interval. The format_date() is needed, because the result of + to_interval() will return a datetime format. So you convert the result back ...


7

You can use GRASS v.mkgrid tool in Processing Toolbox > GRASS > Vector.


0

If you could share a screenshot or image it would be easier to provide some more feedback. Is the polyline enclosed? like a circle/rectangle shape? In that case you can use the polygonize tool to create a polygon from your line features. Then afterwards, use the "Join attributes by Location" tool to combine the attribute field. In case the lines ...


3

You can use the 'Categorized' type and define your own classes: So that, they will stay fixed upon your different layers. You can also go for some rule-based symbology if you want to fit some classes with precise intervals: These are the best way to deal with discrete classes or categories. On the other hand, the graduated symbology is better suited for ...


3

You could use Miller (https://github.com/johnkerl/miller). Starting in example from this example input.csv lat/lon 12 14 15 13 38 5 37 4 2 3 35 4 4 3 38 7 8 6 and running mlr --csv reshape -r "[0-9]" -o item,value \ then filter -x -S '$value==""' \ then label y,x,value ./input.csv >./output.csv you will have y,x,value 38,14,5 ...


3

Your problem is that, that is not a CSV file - which is a series of features one per row. What you have is more like an ASCII grid file, so with some editing you might be able to import it that way. You need to create a header block: ncols 4 nrows 6 xllcorner 0.0 yllcorner 0.0 cellsize 0.25 NODATA_value -9999 where you can fill ...


4

You need to add an attribute to your features that you can set to a number, I would use row number for now using the expression: @row_number Then you can use that attribute as a label, and add an Attribute Table to the Print Layout to let people see the number to name relationship. If you just want to number some of your polygons and label the others then ...


5

For this to be the most consistent you should create a new column (attribute) in the dataset that is the number. For example to automatically generate numbers in the filed calculator using the expression: @row_number Then you can do categorized symbology with following expression, to add it to the legend: "ID_COLUMN" || ' - ' || "...


1

Copy the image into a new one that is using some of the integer data types. You can see the alternatives from https://gdal.org/programs/gdal_translate.html#gdal-translate Select one of Byte, UInt16, Int16, UInt32, Int32.


0

I did on Windows what Mike mentioned, but instead I created a symbolic link from D:\grass78 <<===>> D:\Users\*user*\programs\QGIS 3.16.3\apps\grass\grass78


1

It should be the CRS defined for the measurments. Go to the menu project / properties on the general tab


4

Try running the code snippet below in the Python console: default_style = QgsStyle().defaultStyle() color_ramp = default_style.colorRamp('Spectral') #Spectral color ramp color_ramp.invert() layer = QgsProject().instance().mapLayersByName('Shapefile')[0] field_index = layer.fields().lookupField('Intensity') unique_values = list(layer.uniqueValues(field_index)...


2

Your difficulty likely arises from QGIS and the server not communicating well about the dpi (dots per inch) resolution of the map requested from the server. Many WMS servers default to 90 or 96 dpi. Many computer screens operate at a "logical" (i.e., used for calculating display font sizes in all applications) of 96 or 120 dpi. These are fairly ...


6

Allow me to rephrase the question "change the pixel value from 0 to 10" as follows; if the pixel value equals 0, then change it to 10. if the pixel value is not 0, then keep the original pixel value. (1) The first one is expressed as ("YourRaster@1" = 0) * 10. (A) when the pixel value is 0, condition ("YourRaster@1" = 0) ...


1

Custom (TTF) fonts are not yet supported by InputApp, and the progress on this issue is tracked in the ticket https://github.com/lutraconsulting/input/issues/1195 (disclaimer: I am part of the InputApp development team)


0

Thanks everyone for helping me. Found the solution by copying symbology from one layer to another, then just changing symbol to dots. The only one disadvantage is when you want to change some specific cell color then would need to do it in two layers. I will just keep 2 layer styles one for database layer and one for imported data.


3

Michael Stimson's comment has the appropriate answer to this question. This can be done by using the "cell statistics" (Processing Toolbox -> Raster Analysis -> Cell statistics). The associated documentation can be found here. You will need version 3.16 or greater of QGIS to access this feature. Select the rasters you want to count ...


4

This is a workaround using Reclassify by layer tool (so it is not a direct answer to your query). (1) Prepare a classification table by a spreadsheet software ( I used MS-Excel). (2) Drag and Drop the Excel file to the QGIS then it will appear on the TOC (Layers Panel). ] (3) Start Reclassify by layer tool and select Min, Max and Output fields from the ...


1

Looking at your files, your feature id and OBJECTID are different, I would first update the OBJECTID column with the feature id (using the calculator $id varible) then create a new column called 'to_id' (or something else you want. then attaribute this new column with the connecting points id (from the updated UNIQUEID column). You can then simply apply a ...


5

This information gets added to the Metadata statement of the layer. in QGIS, if you right click - properties - Metadata, you will see where the information is and available to edit. I believe Identifier gets added to the Title field, whilst the Description gets added to the Abstract. This is also available for view on the Information summary page of the ...


5

I couldn't find a manual solution. But It is easily performed using PyQGIS. threshold = 50000 # 1:50.000 # get layout and items manager = QgsProject.instance().layoutManager() layout = manager.layoutByName("layout_name") mapItem = layout.itemById("map_name") scalebar = layout.itemById("scalebar_name") def map_extent_changed(): ...


Top 50 recent answers are included