<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
I decided to check out Anthropic Claude's ability to write PyQgis
code. I asked it to write code to list all the features beneath
where I click the cursor. Not earth shattering, but it's easy to
verify if the code is doing what I want. The first pass on the code
generated a run-time error, which I fed back to Claude. The revised
code still had the same error, which I again gave back to Claude.
The third iteration worked fine. I then asked to refine the code to
only show visible layers, which it got right the first time. I then
further refined to only show attributes containing the string
"name". Nailed it again.<br>
<br>
So, if you've been hesitating to dip your toes into PyQgis
programming, this is an easy route to get the basics of your program
handed to you. And even if you're adept at PyQgis programming, this
gets a lot of the boilerplate out of the way.<br>
<br>
As with anything produced by LLMs, you need to verify that the code
is producing the results you are expecting. <br>
<br>
I was using the free tier of Claude.<br>
<br>
Attached are the code and the entire dialog.<br>
<br>
<br>
</body>
</html>