The Stack Overflow podcast is back! Listen to an interview with our new CEO.
51

In QGIS 3.x you have to right click on the page in your layout to find "Page Properties".


15

It's sort of hidden, but still there. In QGIS 3.0, you can now have multiple pages in a single composer screen, and each page can be adjusted on its own. The pages are hidden from the Items panel, but all you need to do is right-click on any page and select Page properties. The settings you're used to seeing will pop into the Item properties tab:


6

You need to scroll down just a little bit more to find Grids options. Then the difference from the linked tutorial are: Click on Modify grid... to call up Appearance properties. Set CRS for the Grid in this Appearance menu.


5

You can use Add a new arrow to layout which is a graphic path and select None for End marker: The result is this: Or you can also use Add node item and select polyline to add polyline directly: Here is the output: For adding points, I agree with @jberrio in his comment, there is no specific tool to do that. But for my understanding it might not be so ...


5

I set font-size in a surrounding span when font size alone didn't do the trick <span style="background-color:%s; padding: 5px; font-size: %spx;"> <font face="%s" color="%s">%s</font> </span> https://github.com/anitagraser/TimeManager/commit/75fae61da07ab5c7867287706751d476a6502851


5

It is possible in QGIS 3.0 After you add pages, R-click on the page to edit its properties. Select page size that you want. Note, this function may change to a different menu in 3.2


4

You will also need to include PdfExportSettings() when using the exportToPdf() method. You can call the default values using QgsLayoutExporter.PdfExportSettings(). So your code could look like: QgsLayoutExporter(layout).exportToPdf( filepath, QgsLayoutExporter.PdfExportSettings() )


4

With your code, you are creating a new instance of QgsLayoutManager. So, you don't get current list but an empty one. You should retrieve the project instance with projectInstance = QgsProject.instance() From it, you can get the current layoutManager instance and deduce the layouts projectLayoutManager = projectInstance.layoutManager() ...


4

You can simplify this script considerably in QGIS 3.0: projectInstance= QgsProject.instance() projectLayoutManager = projectInstance.layoutManager() image_settings = exporter.ImageExportSettings() image_settings.dpi = 300 # or whatever you want for comp in projectLayoutManager.printLayouts(): if comp.atlas().enabled(): result, error = ...


4

The method setLegendFilterByMapEnabled will filter legend items to those layers which are spatially located i.e. have features which are within the area shown in your layout map, it won't filter out layers which are not checked in your table of contents panel. Correction: setLegendFilterByMapEnabled(True) filters the legend items to show just the ones ...


3

Based on @Gabriel De Luca being able to reproduce the PDF without my same issues, I had hope that I was doing something wrong on my end. My original QGIS Print Layout would only create a 1 mile scale bar that was 360 px at 300 DPI, when it should be 300 px for the intended scale of 1:63360 (1 in = 1 mile). I created a new QGIS Print Layout, with ...


3

If the values are included in your layer: you can call them in the printcomposer by going to tab 'Atlas generation'. In the section 'Output' you can define the outputname. In your example it would be: "Projectcode" ||'_' || "Title" || '_' || day(now())|| '-' || month(now()) || '-' || year(now()) Which gives the result Projectcode_Title_15-01-2019 You ...


3

This a basic example how export to pdf where you can espify the layout. projectInstance = QgsProject.instance() layoutmanager = projectInstance.layoutManager() layout = layoutmanager.layoutByName("test") #Layout name exporter = QgsLayoutExporter(layout) exporter.exportToPdf("C://test.pdf", QgsLayoutExporter.PdfExportSettings() )


3

Great, it's gone! thank ndawson. My new code write atlas result in subdirectories, if can help anyone import os folder = "D:\CARTE_THEMATIQUE\OUTPUT" projectInstance= QgsProject.instance() projectLayoutManager = projectInstance.layoutManager() for comp in projectLayoutManager.printLayouts(): comp.atlas().setFilenameExpression( "CODE_CENTRE ||'/'|| ...


3

The best I can come up with is [% @layout_numpages * @atlas_featurenumber + @layout_page - @layout_numpages %] which seems to work for 2 & 3 page layouts. Code explanation : @layout_numpages * @atlas_featurenumber : gives the last page number for the feature (e.g. : with 4 pages at the 5th feature, the last page will be 20) ; @layout_page - @...


3

You have two options: Option 1: Apply the following expression on the Position and Size of the photo frame. You can apply it only on X position if you want as follows: Case when @atlas_featureid in (200,250) then 320 end Where the 200 and 250 are just examples of the feature ids that do not have photos and the 320 is a value to place the frame outside ...


3

Create your atlas with your Point Of Interest layer as coverage layer. For each of the two maps, make them controlled by the atlas and fix their scales. If you want different scales from one POI to another, create two integer fields in the coverage layer for each map scale. You can define after the scale of each map in the control by attribute dropdown by : ...


3

In the item properties of your map in the print composer scroll down to the Grids section. Select your grid and press the Modify Grid.... Now scroll down to Draw Coordinates. The Format dropdown menu allows you to select the display format of the coorinates of your grid. From the dropdown select any item that includes with suffix to print the Northing/...


3

..I got it! I use this expression for a composer item label with 'insert expression': aggregate(layer:='Corridors_86ef2ea9_d1a1_4d9f_9735_7b7b2fb54cb2', aggregate:='concatenate', expression:="Name", filter:=within($geometry, map_get( item_variables('Main Map'), 'map_extent')), concatenator:=', ') Works like a charm:)


3

The values are in the QGIS3.ini and under QGIS, in the properties > Advanced tab > core > Layout > searchPathsForTemplates. I modify the values with the following code : new_template_dir = "/home/me/my_custom_template_dir" app = QgsApplication.instance() params = QgsSettings( app.qgisSettingsDirPath() + "QGIS/QGIS3.ini", QSettings.IniFormat ) params....


2

Seems like a bug, you should submit a bug report. A possible workaround could be to change the rendering settings of the map from the Item Properties section. For a fairly simple map such as the one you have shown, you could try Darken mode. You will be prompted if you want to export the pdf as raster or vector. I used a simple example, not sure if the ...


2

go with your mouse to the layout page und press the right mouse-button. then you can change the page properties


2

Style are based on pixels (the screen unit). They are not related to resolution (related to scale). If you want to tie width with scale on the map, you should use a function instead as it can access resolution var layerWFS = new ol.layer.Vector({ source: sourceWFS, title: 'plot_layer', name: 'plot_layer', style: function(feature, resolution) ...


2

Finally figured it out. I didn't realise that although I had selected show all labels, 'scale dependent visibility' was selected and as a result, my labels were not visible in layout. After unselecting and refreshing the view, the country names appeared.


2

Use the following expressions. They are based on regular expressions, so will be nice and tolerant of slight differences in format: For Drawing Number: regexp_substr(@project_filename,'(.*?)R') For Revision Number regexp_substr(@project_filename,'.*?R\\s*(.*?)\\s*-') Title: regexp_substr(@project_filename,'-\\s*(.*)\\.')


2

There is an expression variable @layout_name which contains the name of the current layout.


2

I think this function will work (for QGIS version >= 3.0) : def rmvLyr(lyrname): qinst = QgsProject.instance() qinst.removeMapLayer(qinst.mapLayersByName(lyrname)[0].id()) Call it by : for lyr in ['Patient Data', 'Google Maps']: rmvLyr(lyr)


2

The QgsLayoutItemLabel class has a setFont method which takes a QFont object. So you could try modifying your script like this: label.setText("This is my map label") label.setFont(QFont('Arial', 14)) #Change to your desired font and size label.adjustSizeToText() Depending on what your import statements look like, you may need to import QFont first like: ...


2

The fix would be to not include a period . in the output file name. I have verified this in QGIS version 3.6.2-Noosa Example, if your print composer layout is named Atlas test-8.5x11, when you output a raster, then be sure to name the output file without any extra ., e.g., Atlas test-85x11.tif. For vector output, such as PDF or SVG, you do not have to do ...


2

This link on page 3 shows how the author achieved a drop shadow effect by creating a box with add rectange and without border settings and then uses Offset, Blur radius and Transparency. PS: I intended this to be a comment but I don't see the feature for me. I should also add that the version used in the attachment isn't stated.


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