6

You can find the page type (if exists) with the following code : project = QgsProject.instance() composition = QgsPrintLayout(project) document = QDomDocument() template_file = open("C:/Users/Thysma/Documents/Stage/Composeurs/A4 Portrait.qpt") template_content = template_file.read() template_file.close() document.setContent(template_content) ...


5

For my example, I took the QGIS plugin Plugin Builder 3 (link). After install of this plugin, a new repository is made in : \QGIS\QGIS3\profiles\default\python\plugins\pluginbuilder3 (here is the default profile default, it can be an other). If you look in the __init__.py : def classFactory(iface): """Load PluginBuilder class from file ...


5

QGIS uses the Python environment installed by itself. You have to install packages to Python 3.7 installed by QGIS installation. Open OSGeo Shell Run py3_env Run pip install pandas


5

In Qt Designer, add a QgsMapLayerComboBox for "Input file", add QgsFieldComboBox for "Latitude" and "Longitude" as in the image. In run method of your plugin (I guess it has a run method), add the following lines. (Use your own object names. I used cb_input_file, cb_latitude, cb_longitude) def run(self): # other lines ...


5

As an example, you can use the following structure: point_layer = iface.activeLayer() for feature in point_layer.getFeatures(): point = feature.geometry().asPoint() x, y = point.x(), point.y() # OR # xy = [point.x(), point.y()] # Do whatever you want with x and y of each point feature Or you can get a point feature by id: feature = ...


4

You can offer a zip file with your plugin anyway over any platform. The user should then use in the "manage and Install Plugin" Dialog the option "Install from ZIP". To provide a ZIP just zip the folder with your plugin in it.


4

Plugin Builder adds a method named run to the plugin.py. You can implement the script below with a little editing. I assume you have set storageMode to QgsFileWidget.StorageMode.GetDirectory for QgsFileWidget and named localsave in Qt Designer. def run(self): if self.first_start == True: self.first_start = False self.dlg = testDialog() #...


4

That cyan color is probably The Atlantic Ocean. Try the following way. It worked for me. test_data = 'testdata/airports.shp' canvas = QgsMapCanvas() vlayer = QgsVectorLayer(test_data, "test", "ogr") canvas.setCanvasColor(Qt.white) canvas.enableAntiAliasing(True) tms = 'type=xyz&url=https://tile.openstreetmap.org/{z}/{x}/{y}.png&...


4

You can do this, but I would recommend keeping it simple. If you just want to see points on a map, where the coordinates are stored in Excel, you can use a "Virtual Layer" (Data Source Manager > Virtual Layer). Open your Spreadsheet in QGIS (just drag it in form Explorer) and add a virtual layer like select makepoint(x,y,25832) as geometry, x, y ...


4

There is an equivalent tool, namely Rectangles, Ovals, Diamonds, in the QGIS's Toolbox Ctrl+Alt+T > Vector geometry.


3

Visibility Analysis plugin adds the related tools to Processing Toolbox as in the image.


3

Solution 1 is to: open the port on your PostGIS database declare the connection in the Data Source Manager of QGIS directly consume the PostGIS table within QGIS where you can edit No need to go through any import/export or something like a REST API. Main drawback is while you do local edit on QGIS, you may get edit also on Web app. It can be a "deal ...


2

You can use the plugin "Spreadsheet Layer": Below an example: A spreadsheet with coordinate. Don't forget to close the file now You can import your data. The plugin will create a additive file *.vrt Your points are now in QGIS. Now close QGIS Before reopen excel I add two new data. I close excel and reopen QGIS Tadaa! (ps. you can alsa add ...


1

You can set the map extent based on your line layer like this : ms = QgsMapSettings() context = QgsRenderContext.fromMapSettings(ms) ms.setLayers([line_layer]) rect = QgsRectangle(ms.fullExtent()) rect.scale(1.2) ms.setExtent(rect) map.setExtent(rect) layout.addLayoutItem(map) Then when you add the legend you can compare the extent of your layers with your ...


1

Use os.path.join(folder,file) instead of concatenation. You have no path separator


1

I had the same issue in Windows while using QGIS 3.16. So this is for anyone using Windows. Check this site on installing Python packages https://landscapearchaeology.org/2018/installing-python-packages-in-qgis-3-for-windows/ You might realize you are missing the following .dll files api-ms-win-crt-process-l1-1-0 api-ms-win-crt-conio-l1-1-0 Install them ...


1

As you do, I really like the JOSM digitizing tool. The "W" function but also the way to modify attribute or copy and paste some of them, the support for geolocated audio note... In QGIS I found nothing to do this. The solution I founded is to do my digitizing work in JOSM. Here are two solutions : If your digitizing work could benefit to ...


1

I am working on a simple plugin that allows to zoom to a specific coordinates and draw a mark with an annotation pop up (image below) : 1st : You have to declare a global List that will contain the markers drawn in the scene: Markers = [] 2nd : Function to delete Marker Point: def Delete_Marker(canvas): canvas = iface.mapCanvas() global Markers ...


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