New answers tagged

0

Maybe using the fabulous MapProxy Server (with a small customization) could solve your DPI export hassle: How to lock a WMS layer to scale in QGIS?


0

Thanks for the clue. I'm then loading a style from PostGIS like this: uri_prod.setDataSource('public', 'layer_styles', None) styles = QgsVectorLayer(uri_prod.uri(False), 'layer_styles', "postgres") styleqml = "" for style in styles.getFeatures(): if style['f_table_schema'] == 'my_schema' and style['f_table_name'] == 'my_layer_name': ...


0

I just had this exact problem. Turns out that (for me) it was because the file I was attempting to import existed on a network drive. (so the usual rather lengthy pathname towards the file). I moved the data file onto a local folder (like C:\Documents) and it worked fine.


0

Open the 'Processing Toolbox' via Processing > Toolbox and search for "Zonal Statistics" Additionally to the option suggest by @babel, there are two more options, respectively SAGA Zonal raster statistics a.k.a. Zonal Grid Statistics GRASS r.stats.zonal


1

QGIS Field Calculator indeed accepts $x and many other geometry functions. I do not think QGIS Raster Calculator ever supported x, y, column or row. But SAGA raster calculator does support position functions and can be used from within QGIS (Processing Toolbox): xpos(), ypos() Get the x/y coordinates for the current cell row(), col() Get the current cell'...


1

Not exactly what you are asking, but a way to get a longitudes or latitudes raster. Use the gdal2xyz process to export the raster data as a CSV XYZ file: For a single band, 1000x1000 pixels in Float64 format, the CSV file weighs 34 MB. Import the CSV file to the map: I don't like to work over this kind of spatial CSV, so export it as a Geopackage vector ...


1

Zonal statistics for raster layers can be found in the processing toolbox: https://docs.qgis.org/3.10/en/docs/user_manual/processing_algs/qgis/rasteranalysis.html?highlight=zonal%20statistics#raster-layer-zonal-statistics


1

From askers comment: I finally found a workaround to my issue. Instead of trying to test if a way is a member of a relation inside QGIS, I ran an additional Overpass API request to fetch ways that aren't par of any relation. Thus I now have a third layer with those ways, on which I can apply a simple labeling rule.


1

Coming back to add an alternative: as of version 3.14, QGIS supports vector tiles. See https://www.maptiler.com/news/2020/06/vector-tiles-in-qgis-3-14/ With the MapTiler plugin and this vector tile support, you should be able to generate high quality printed maps at any zoom level/scale and any projection, without having to pre-download specific local data. ...


0

I think i just had to replace the config path as below. No more folders are made: # Set a custom config path QgsApplication.setPrefixPath("C:/Program Files/QGIS 3.14/apps/qgis", True) qgs = QgsApplication([], False) qgs.initQgis()


0

Use final_output['OUTPUT'] since the output is saved in a dictionary: output_lyr = QgsVectorLayer(final_output['OUTPUT'], "output_testing", "ogr")


2

This looks like a great project! Here's two ideas for how to visualize the fur trapper's paths: Straight lines. You can use the Join by lines (hub lines) in QGIS to connect origins/destinations. You'll need a "Hub" layer and a "Spoke" layer, with connecting points labeled by ID. If you know quantities (number of trips, volume of fur etc.)...


0

You can create a virtual layer and make use of the group_concat function to aggregate the names Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the following query. Replace the layer name for yours select a.*, group_concat(b.name,'; ') as red_names from brown a join red b on st_intersects(a.geometry, b.geometry) group by a.ID


1

If you want to have that information in the attribute table, try the aggregate function. Some examples here https://spatialthoughts.com/2019/04/12/summary-aggregation-qgis/


1

This answer is not a complete answer as I don't have the same exact environment. You need to cast to get the "right result". The content should be more or less like the following SELECT id /*:int*/, ST_Line_Interpolate_Point(geometry, 0.3) AS geom /*:point:4326*/ FROM demo_pts FIY, when I tried with "in memory" layer, the previous code ...


1

There doesn't seem to be a simple way to do this with the GUI, because of the (paired) data structure your data have. However, I found the use case interesting and had attempted a script before the other answer published (although, I didn't published it waiting for other answers using the GUI). This is the result with an azimuthal projection: And this is ...


0

This can be done with a standard spatial join. Depending on how you want to extract the values from Layer B, use the "Join attribute by location" or "Join attribute by location (summary)" algorithm from the Processing Toolbox. https://www.qgistutorials.com/en/docs/3/performing_spatial_joins.html


0

You are measuring the ellipsoidal distance in QGIS but the planimetric or cartesian one in your cad system. Also, you can measure the planimetric distance in QGIS and get the same value as in the cad system. But the real problem is that a measure tape is not projected into reality with EPSG:3857 system, so the best solution is to adopt some reference system ...


1

I dont think this is 100 % correct but maybe you can fix it or understand whats causing it? Some constellations look a bit weird with line going across the map. import csv pointlyr = QgsProject.instance().mapLayersByName('StarsNamed2')[0] pointdict = {f['Stars_Named_HIP']:QgsPoint(f.geometry().asPoint()) for f in pointlyr.getFeatures()} # Create a ...


4

You may try to adapt a recipe I've already provided in another answer to programmatically adding custom projections my_new_projection = QgsCoordinateReferenceSystem("PROJ:+proj=ortho +lat_0=51.470129 +lon_0=-0.452751 +x_0=0 +y_0=0 +a=1188300 +b=1188300 +units=m +no_defs") my_new_projection.saveAsUserCrs('my_new_projection name') # Save the ...


4

You should try the following legend.rstyle(QgsLegendStyle.Symbol).setMargin( QgsLegendStyle.Top , 0) This variable above is the value I change in following animation


4

Just hit the rectangle with the two triangles attached to it to the right of the point count or density field. This allows you to choose data defined override - e.g. by choosing a column which holds valid values. So no, there hasn't be any renaming, the GUI simply has been made more sleek.


0

Assuming you have an attribute (field) that identifies the LVL10 basin, I would join each subspecies shapefile to a new combined shapefile, using the LVL10 id as the join field. When defining the join you can decide which fields to carry into the join, presumably avoiding any fields that are duplicates in the two shapefiles. You can then use the field ...


0

No it isn't possible like in ArcGIS but It is possible to create new selections using filters and expressions, ore remove from the selection. you can find the documentation here: https://docs.qgis.org/3.10/en/docs/user_manual/introduction/general_tools.html#automatic-selection If you need the possibility to select inside a selection by clicking you can do a &...


1

I'm still on 3.12 and Data Source Manager is working for me - but its probably because im not connecting to the same data sources as you. The 'Getting Tiles' message at the bottom suggests that you have a connection to 'something' - a Tile service? in your project... Your problem is more than likely related to a service that you previously had connected in ...


1

Here is an of an example of how you could achieve your goal of allowing the user to select any number of available fields. This is how I would approach it anyway! Since you want to get user input, I am assuming you want some kind of simple GUI. You could use a few simple widgets like a QgsMapLayerComboBox, a QListWidget, a QTableWidget and a couple of ...


2

I found this explanation for the scale_exp function which states what the exponent does. Exponent - A positive value (greater than 0), which dictates the way input values are mapped to the output range. Large exponents will cause the output values to ‘ease in’, starting slowly before accelerating as the input values approach the domain maximum. Smaller ...


0

Could also be related to the fact that there are two QGIS executables that get installed, one without a lot of the additional extensions, one with. Check your shortcuts folder, there should be two icons/executables. Make sure you run 'QGIS Desktop with Grass 7.x'.exe


0

I've found out that one can simple put a json file called rastercalcexpressions.json to the PROFILENAME\processing folder, where 'PROFILENAME' is the QGIS profile folder (Settings > User profiles > Open active profile folder). This file should contain expressions to use in raster calculator with bands replaced with [bandname] placeholders, something ...


2

In the Value Relation widget, the Key Column option is the column with the values that will be stored in the table, and the Value Column option is the column with the values that QGIS will show (instead of the key) in the attribute. A Key Column must have unique values to avoid your behaviour, but the child table has not a key column. The only column with ...


1

"Dissolve" is the tool you're looking for. You can also use the plugin "Dissolve with stats" if you want to calculate the sum of subspecies within a main basin for example. EDIT: you have also the "Agregate" tool


1

Try the following vectorLayers = [layer.id() for layer in QgsProject.instance().mapLayers().values() if isinstance(layer, QgsVectorLayer)] QgsProject.instance().writeEntry( "WFSLayers" , "/", vectorLayers); QgsProject.instance().write() Adapted from my previous answer Publishing a layer as WFS with PyQGIS


1

To change the behaviour of Identify feature tool just go in the Identify Results Tab and turn off the option "Auto open form for single feature results" as shown in the image.


0

I had roughly the same problem on Ubuntu 18.04 LTS: apt states that I have broken dependencies. Yet it warns me every time, that a large group of packages are not necessary anymore so I should clear them with 'sudo apt autoremove'. I was reluctant to do just that, as I was afraid it would remove packages which are necessary for my development environment. I ...


2

Try from .PrograssDialog import PrograssDialog


0

Another possible solution using ST_Split is given in this PostGIS User list thread. However, it relies on the lines having no coincident linework (since in that case ST_Split errors out).


1

Here's a solution that makes use of the fact that in PostGIS running ST_Difference on two intersecting LineStrings (or MultiLineStrings) has the effect of noding the first line. So it's possible to loop over every line in the table, and difference it with the collection of lines that intersect it, to effectively node it. The noded line is computed as a ...


2

I was able to parse the expression in your code by removing the outer enclosing quotes (initialising the qry object as an empty string like qry = '') and removing the backslashes before the double quotes around the field names in the formatted string. Try with the adjusted code snippet below: InputFeatureLayer = QgsVectorLayer(r'D:\Temp\Qgis\shp\qgis.shp',&...


0

Have you tri with diagrams? or


6

Use Filter Current Selection:


5

In the case of the Select by location tool, you can define a spatial criteria to select features only within the already selected features.


4

CAD-like digitizing tools are activated via View > Panels > Advanced Digitizing panel > Enable advanced digitizing tools Angles for the cursor to stick are selected by clicking the 'gear button' on the Advanced digitizing panel. Cursor position indication is activated by the 'Toggle floater' button of the same panel. Not sure, if this is proper use ...


3

There is a setting to choose in witch units the coordinate are displayed. Go to Project>Properties... then go to the "general" tab, here the "Coordinate and Bearing display" section lets you choose between map unit and degrees (decimal, DM or DMS) That being said if your shapefile is indeed in EPSG:4326 the map unit should be degree ...


1

First, create the entire process within the modeler, and include the input "File/Folder". Then open it with the inbuilt Python editor in QGIS, then edit any code with the file path to the name of the input. In my example, I have defined the folder as "folderlocation", given it a path. This is the only place you will need to change the ...


0

You may choose using Qt approach e.g using recipe from Connecting QGIS, SpatiaLite and Python? (change import to from qgis.PyQt.QtSql import *) You may also want to use the new "Connections API" mentioned in Access SpatiaLite connections with PyQGIS QgsProviderMetadata (QGIS 3.10.7 LTR) combined with it executeSql method


0

I recreated the original vector layer and now it works. Unfortunately I haven't figured out where the problem was since I think I did the layer the same as before but extract by expression gives me now the correct results.


0

Why don't you change 'OUTPUT':'TEMPORARY_OUTPUT' to 'OUTPUT':'/tmp/myfile.tif' and then use gdalnumeric.LoadFile() on it?


1

you need to use sub_vlayer.saveStyleToDatabase(name="name_style",description="example", useAsDefault=True, uiFileContent="")


1

Surprisingly, after @BERA's comment, this was not a computationally taxing as I thought it would have been. I used the Generate points (Pixel Centroids) inside polygons as you suggested; though it only made a list of points and with no values. I then used the Sample Raster Values to sample the DEM, using the points generated from the previous step. Made the ...


1

Try saving this script as "save_log.py", and then: Connect to your device via the QGIS GPS Information Panel Drag and drop the script over the qgis window Pick a destination file for the GPS log Leave it to record some points, and then disconnect the GPS from the QGIS GPS Information Panel Attach some of the lines from the saved log file. It's ...


Top 50 recent answers are included