Project Plugin Demonstrations and a Vegetation Monitoring App

I have been working on a QField Project Plugin for Vegetation Monitoring for my organisation. To help other developers who are also trying to make project plugins, I have turned it into a series of code demonstrations. I start with a demo1_hello_world and work my way up component by component to the complete plugin in demo5_species_entry. I hope it can be of use for you!

This plugin is rich in widgets and interactions: there is a search bar, a cool swipey tab widget, and a neat dynamic list widget. It demonstrates querying, adding, deleting and editing features. There is a data model for dynamically generated widgets and a central style.

It does not at the moment have a connection to the map- to click on a plot and open the plugin. The user has to select the plot by plot_id in the search bar. I am currently working on a mapclick demo that will add this functionality. I’ll post when it’s up.

Note: This is developed to be used on an iPad. From demo3 and up it will be squished on an iPhone.

Are you also working on project plugins? I’d love to hear from other developers.

2 Likes

@Heather_Hillers , this is fantastic, thanks for sharing! FYI, I’ve just added the missing piece of the puzzle to add map canvas click interaction for plugins here: Expose map canvas point handler item to plugins by nirvn · Pull Request #6516 · opengisch/QField · GitHub

With this in, you’ll be able to capture taps onto point features in your plots layer and possibly redirect those to your QML plugin components. You’d do something like this: Component.onCompleted: { iface.addItemToPluginsToolbar(pluginButton) - Pastebin.com

Ah yeah, I was looking for that objectName. Thanks for the code update, I’m looking forward to the release!

@Heather_Hillers , I’ve added two new invokable functions that will make filtering for feature simpler / faster:

const p1 = mapCanvas.mapSettings.screenToCoordinate(Qt.point(point.x - 4, point.y - 4))
const p2 = mapCanvas.mapSettings.screenToCoordinate(Qt.point(point.x + 4, point.y + 4))
const rectangle = GeometryUtils.createRectangleFromPoints(p1, p2);
let it = LayerUtils.createFeatureIteratorFromRectangle(qgisProject.mapLayersByName("plots")[0], rectangle)

That’ll be in QField 3.7.2.