Question: Is there any way to create common PostGIS views (e.g. buffers, intersections, differences) by using script-created dialog boxes. A GUI for doing spatial analysis based on PostGIS would be quite helpful for users with no SQL skills.

Example 'Buffer':

[![enter image description here](https://i.stack.imgur.com/z41e2.png)](https://i.stack.imgur.com/z41e2.png)

[![enter image description here](https://i.stack.imgur.com/U20kS.png)](https://i.stack.imgur.com/U20kS.png)

```
CREATE VIEW test_schema.buffer_bus_stops AS
SELECT
    row_number() over() AS gid,
    ST_Buffer(geom, 100)::geometry(Polygon, /*SRID*/) AS geom
FROM test_schema.bus_stops;

```

Answer: 
If I understand correctly, you want a "wizard" to let you write SQL?

There is a plugin called **PostGIS Query Builder** which does just that... see [cheatsheet here](https://geogear.wordpress.com/postgisquerybuilder-v1-6-cheatsheet/). It seems to allow gradual building up of queries, and allows creation of views as an option.

Not used it in too much depth, but it sounds like what you're after.

See further down for details on installation... it didn't work 'out of the box', not for me anyway.

---

[![postgis query builder](https://i.stack.imgur.com/j3VBo.png)](https://i.stack.imgur.com/j3VBo.png)

---

[![postgis query builder](https://i.stack.imgur.com/sw1SE.png)](https://i.stack.imgur.com/sw1SE.png)

---

Note, if you're on Ubuntu you might need to install Qt Postgres bindings using 

```
sudo apt-get install libqt4-sql-psql

```

or you'll get a "Driver not loaded" message. See [this issue on the Github issues page](https://github.com/enricofer/postgisQueryBuilder/issues/15).

I have no idea if it works on Windows/Mac.
I am not sure if you want to achieve this without writing code, but if you want to create a Python script to create views in PostgreSQL/PostGIS by using drop-down menus for pre-programmed SQL, you could use the Python library psycopg2. You could use python variables as table names, etc. 

Take a look at the docs here: <http://initd.org/psycopg/docs/>

Then you could create a plugin for QGIS, use a custom designed form (using QT Designer) in which the user chooses some parameters.