New answers tagged

0

Alright, after some more hours of tinkering I was able to find a workaround for this issue. I put the operation into a graphical processing model that anloy takes one input. This way the batch processing dialogue worked the way I needed it to when running the processing model. Leaving this up here in case more people run into the same problems!


0

Indeed, tables with geography behave that way, when loaded from DB Manager into the canvas with with 'right click' > 'add to canvas' Chosing a different approach within QGIS will lead to the expected result, though: Drag and drop from the browser into the canvas Use the dialog from the top menu 'Layer' > 'Add Layer' > 'Add PostGis Layers...'


1

Probelm of projections and accuracy of measurements: Since EPSG:3857 (and every Mercator projection) heavily distors lengts (the more so the closer you get to the poles), measurements in this CRS don't make any sense, as @Vince already stated. Cartesian vs. ellipsoidal measuremts: which one is more accurate: This also means that the difference between ...


0

I'm not aware of a plugin that does this (it's a fairly specific workflow), but it can certainly be achieved with a simple Python script, run from the Python console. Firstly create your text file and save it somewhere. It should have the following structure. *It should go without saying that this is just an example. All lines in the txt file must exactly ...


1

You can use a conditional expression to match the second space using regular expression. Supposing your layer has a name field: Go to Layer Properties > Formatting Click the Expression button (E) beside Wrap on character > click Edit Add the following expression, then click OK: if(regexp_match("name",'^[^ ]+ [^ ]+ '),' ','') Make sure ...


2

Not sure what you tried but before going through the programming, you could try selecting a range of layers in the "Data Source Manager" for your database. Using a click to start with Shift key and clicking again later in the list select a range of tables/layers (PostGIS/QGIS perspectives) For a programming perspective, you can do the following: # ...


0

Thanks to the local Linux User Group I found a solution to the problem. It turned out, that PostGIS was updated in the background and the new version did not correspond with PostgreSQL 12.6 any more. Since PostGIS was already installed, it did not show me this but the error message above instead. To check if PostGIS is still compatible with PostgreSQL, I ...


0

You could use JavaScript to load a custom URL: <script type='text/javascript'> let layer = expression.evaluate("lower(@layer_name)"); window.location.replace("http:/host.domain.tld/"+layer+"/"); </script>


4

A "True" condition evaluates numerically to 1, and a "False" condition to zero, so if you add up the result of multiplying the test conditions by the value expressions for those tests, you get the result you are after. So: ("slope@1" < 9 ) * (10.8 * sin("theta@1")+0.03) + ("slope@1" >=9 ) * (16.8 * sin(&...


1

I'm sure someone else can come up with a more elegant solution using PostGIS or python, but here's something I cobbled up using regular tools that should work if you're only concerned with a few river polygons. I hope I understood the size you want your resulting polygon relative to the original: v.voronoi.skeleton to find centerlines clean up the "...


0

After looking at the log & message, it seems that the problem came from Python: warning:/Applications/QGIS3.10.app/Contents/MacOS/../Resources/python/qgis/utils.py:737: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses mod = _builtin_import(name, globals, locals, fromlist, level)


1

I need to do something similar, but I don't seem to find the Euclidean distance tool. I have a polygon which represents a riverbed area and I would like to make a buffer based on the river width. So I am wondering if the proposed procedure is suited to achieve what I am trying to do. The buffer would be n*width with n an integer number I choose. If you look ...


0

This is a fairly common occurrence. You should be able to fix is quite easily by running the "Fill Sinks" tool in SAGA. There are several ones to chose from. It literally just lifts low points in your DEM to allow for smooth flow of water. The resultant DEM is "hydrologically correct"


0

A quick update to the answer. You may find that your data haven't been saved in UTF-8. You will need to use a different code in the cpg file. For example, Latin-9 requires the code ISO 88591 instead. Just that, one small line of text at the top of a text file. The encoding of this text file (the cpg file) can be UTF-8 or whatever the OS prefers. QGIS doesn't ...


3

Let's assume there is a point layer called 'random_points_test', see image below. Here a path using this order 4,8,1,9,2 for "id"-field will be created. Apply RMC over the layer > Filter... with "id" IN (4,8,1,9,2) (or "Select Features by Expression") Apply the "Point to Path" geoalgorithm (if features were ...


2

To connect points in the order of a an attribute value, you can use QGIS expressions with either Geometry generator or Geometry by Expression. Use an expression like the following one, where order is the name of the attribute field (your N values). See below if you first have to bring your N values in the correct order. make_line ( geometry ( ...


1

When the OK button is pressed in the Built Virtual Raster tool after the files have been selected a new tab "Parameters" should open. At this state nothing has really happened yet. The tool has built a list of the selected files and a template GDAL command has been created. No checking if the selected files are valid is done. I verified that by ...


3

Your "package" already exist it is the geopackage file format. You're able to store all the components your project will require (vector/raster layers). The project itself can also be embedded in the geopackage. Even the images (raster/vector) or files (.pdf) you could have to use (for layouts or help files) can be inserted in the tables of the ...


4

Another approach using the "Extract by location" with 'intersect' as geometric predicate, see image below. To get more familiar with geometric predicates, please check this answer.


0

You may want to use one of these functions in Vector -> Geoprocessing Tool


0

I ended up using the Intersection feature in Processing -> Toolbox -> Vector overlay to identify the area of overlap of the two shapefiles. Then, using the resulting shapefile, I went to the Attributes table -> Open Field Calculator and created a new field using $area. With this I got the area of each polygon which I ended up exporting as a csv ...


0

I came across this question in my own quest to install geopandas for qgis and I figured this might be useful for future reference: I am using an osgeo4w installation of qgis 3.16 (it may be available in previous versions but I haven't checked) and geopandas 0.7.0 is now available through the OSGeo4w setup. This probably won't be the solution for everyone ...


2

The expression pre validation sometimes is not working properly in the print composer even if the expression is valid and would work. Your first expression is evaluated on the layer so get_feature_by_id have no problem to verify the formula result and let you click ok button. To make it work you have to add the expression without the expression dialogu box. ...


2

You can use QGIS expressions with the function overlay_intersects( ), available since QGIS 3.16. Set the field type to string as the output will be formatted as text: array_to_string ( overlay_intersects( 'polygon2', $id ) ) Screenshot: on the blue polygon1, create a new attribute, refering to the intersecting orange polygon2 ...


0

If you want to extract the values without having 0's, you need to use a different formula in the Raster Calculator. "img1@1"/("img1@1">0) 0 values will be returned as no values.


5

The join is only permanent within the project you did the join in; basically the attributes are just linked and the link information is stored in the project file (.qgs or .qgz). If you want to hardcode the joined attributes in a layer, you need to export the joined layer as a new file via right clicking on that layer and choosing export -> save features ...


1

Create a polygon-grid (squares) over you buffer polygons in the same size that you want your pixels to be (in my case: 1x1 meter). The extent of the grid should be the same as the buffer layer. Than calculate how many buffers each grid-cell covers. You can do this calculating a new attribute with field calculator and an expression like this: array_length ( ...


2

In QGIS, when you set the CRS, there is a window t the bottom that shows the WKT version of the CRS, and the Proj version. It contains the length unit. The area is the square of that. For South America Albers Equal Area Conic (ESRI 102033), for example, it is: WKT PROJCRS["South_America_Albers_Equal_Area_Conic", BASEGEOGCRS["SAD69", ...


0

Easiest way probably is snapping the grid to the polygon layer with the squares: Activate snapping (choose snap to vertices and all layers). Select all features of the grid (like Ctrl+A in Windows). Toggle editing for the grid layer. Select Move feature, click on one of the corners of the grid and move it over one of the corners of the green rectangles ...


0

(("Landcover_raster"=9)+("Landcover_raster"=10))*.21 should work. It multiplies X by .21 where X is either 0 or 1, depending on whether it is land cover (9 or 10). It is helpful to remember that with 1 and 0, OR is +, AND is *


3

You know the spacing is 100m in both x and y. Go to Vector - Research Tools - Create Grid Grid Type - set it to Rectangle Grid Extent set it to Calculate from Layer and select the polygon layer - it will fill in the numbers. The first 2 are the east-west range of the polygon layer, the last 2 are for north-south. The CRS of the layer is also shown. modify ...


0

If your heatmap was created from a point layer, you can adjust the Opacity in Layer Rendering. Hope this helps.


0

I am new-bee, my answer is welcome to be corrected. Seems in ArcGis, you can open the aux file in 2 ways: 1. if your folder looks like: in this case, the aux file acts like an entrance of the bundled-files, you can open this via: step1. open ArcMap ( version > 10 ? seems this is a requirement to show the correct raster pyramids) step2. Ctrl + N to open a ...


0

If you want to convert .qml or .sld files, all you need to do is: 1 - Import the .qml or .sld to the layers 2 - Look for the Create style database from project function in the toolbox 3 - Put a name in the output file This is going to save your .qml or .sld to a .xml file. If you have .lyr, I recommend seeking help from a ArcGis Users. If you have .style ...


5

This seems to be a classical case for a Two-point equidistant projection, see: Wikipedia: Two-point equidistant projection and ArcGIS: Two-point equidistant. Create a custom projecton, based on the pre-installed Sphere_Two_point_Equidistant projection (ESRI:53031) with the two points in England and Germany as the two points. For my example of London (51 N, ...


2

This is not really GIS related problem, but purely HTML one. But anyway, first make positions inside map div relative, and then inside this div put absolutely positioned logo image. Image must have z-index attribute high enough to be above all OpenLayers elements. Code could then look something like this: <body> <h1>Megacorp Industries</h1&...


4

On a map, you could make 2 rasters (rectangular grids). One would have the distance to the German location, and the other to the point in the UK. You could then use the Raster Calculator to highlight cells where the difference between them is less than 100 km. This would create a third grid, which you would display on a map. There are probably more elegant ...


1

You need to make a grid. In QGIS, this is done in the Vector - Research Tools - Create a Grid. The grid should cover the extent of your point data. For example, if you have the locations of all Pokemon in your city, you could make a rectangular grid with side length 1 km. From the Pokemon locations, you can then use the grid to show the density of Pokemon ...


0

You can export .xml styles using the style manager. This, however, only allows you to save symbologies and labels, not attribute forms etc.


2

I finaly find the solution: The problem comes from the sink construction. line: (sink, dest_id) = self.parameterAsSink(...) I changed the source.fields() to output_layer['OUTPUT'].fields() source.fields() was limiting the number of fields with the number of fields of the input layer.


1

Run Menu Processing / Toolbox / Merge vector layers: this gives you a new vector layer with all features from all inputs layer and with all attributes separateley, containing NULL for attributes that did not exist in the layer the feature orginiates from. Run Menu Processing / Toolbox / Aggregate: it allows you the define in detail which attributes should ...


4

First, you have to add the following method to your processing algorithm class to be able to add temporary layers to the project. def flags(self): return super().flags() | QgsProcessingAlgorithm.FlagNoThreading Then use this anywhere before return: QgsProject.instance().addMapLayer(output_layer['OUTPUT'])


3

You should calculate a new field with field calculator. Notice the difference between capital and small characters! Here is an expression which should work. It first converts the content of your start_date field to a date type and then reformats it: format_date(to_date("start_date",'dd.MM.yyyy'), 'yyyy-M-d')


1

Two solutions : If you want to use a PNG as icon you can go to property of your layer, then symbology (1), then click on the simple marker (2), then click on the list wich contain simple marker (3) and choose : Raster image marker. Click on the ... box and choose your png file. If you want to use a SVG as icon you can go to property of your layer, then ...


1

I faced the same problem with the modeller in QGIS and find some workaround but no solution inside the modeller. The only way to get an iterative algorithm is to use Vector Features like you do. Then all the model is run for every feature so the merge vector layer algorithm will be run once for every feature... My workaround using two models. The goals is to ...


3

It's supported meanwhile (since 3.0): lay = iface.activeLayer() field_aliases = [field.alias() for field in lay.fields()] https://qgis.org/pyqgis/3.2/core/Field/QgsField.html#qgis.core.QgsField.alias


1

The solution from @geozelot works perfectly. Thanks, heaps. I also manage to extract polygon by using ST_CollectionExtract. Below is my revised query and the table is now accessible from QGIS too. CREATE TABLE boundary AS SELECT row_number() OVER () As id, ST_CollectionExtract(ST_ConcaveHull(ST_Collect(p.geom), 0.99),3) As geom FROM mypoints p;


3

You have to specify the layer (feature class) name in the path string. layer_name = "countries" layer = QgsVectorLayer("path.gdb|layername=" + layer_name, "Countries", "ogr") QgsProject.instance().addMapLayer(layer)


3

Maybe this will help: library(sf) eco_l2 <- st_read("na_cec_eco_l2/NA_CEC_Eco_Level2.shp") Reading layer `NA_CEC_Eco_Level2' from data source `/home/micha/work/tmp/na_cec_eco_l2/NA_CEC_Eco_Level2.shp' using driver `ESRI Shapefile' Simple feature collection with 2261 features and 8 fields Geometry type: POLYGON Dimension: XY Bounding box: ...


3

You could use if(array_agg($id,group_by:="ELEV")[0] = $id,"ELEV",'') as label value. But keep in mind this costs some calcuation and may slow down rendering especially on large layers. How it works: the expression generates an array of each feature-id, grouping the ones together having the same elevation. Now it checks for each feature ...


Top 50 recent answers are included