I tried the query "select POLYGON((75.15 29.53 1,77 29 1,77.6 29.5 2,75.15 29.53 2)) :: geometry;" but it didn't work neither in version 3 nor in version 4...
I used "St_GeomUnionArg" to make two columns of points together, and then again , so I made a union of the 4 columns of points.
At last, with the function "st_convexhull", I made a polygon with the union of 4 points...
Happy to see you again!
Here is a few lines of my data: test.gdms I'm now doing a real project of Saclay, application of URBS on this area. Orbisgis is still a tool I use frequently at this time.
But sometimes the mixed usage of version 3 and version 4 makes me confused... For example, "select...union select..." is only valid in version 4 and "ToString() " is only valid in version 3...
Otherwise, Orbisgis is still a tool I prefer because of the facility to write SQL squery, the large amount of functions already writen and the possibility to create a new plug-in...
I tried to resolve your problem ... and it's not so easy.
Below is something that is not perfect but that is working well
-- all points are listed in the same table, that contains two fields : the_geom and the id
CREATE TABLE g1 AS SELECT startpoint as the_geom, new_id FROM test UNION SELECT endpoint as the_geom, new_id FROM test;
CREATE TABLE g2 AS SELECT start_proj as the_geom, new_id FROM test UNION SELECT end_proj as the_geom, new_id FROM test;
CREATE TABLE g AS SELECT * FROM g1 UNION SELECT * FROM g2;
-- Points are unified if they are linked to the same object
CREATE TABLE points AS SELECT ST_UNION(the_geom) as the_geom, new_id FROM g GROUP BY new_id;
-- We produce the polygons on the basis of each multipoints
CREATE TABLE polygons AS SELECT ST_CONVEXHULL(the_geom) as the_geom, new_id FROM points;
DROP TABLE g1 PURGE;
DROP TABLE g2 PURGE;
DROP TABLE g PURGE;
DROP TABLE points PURGE;
And here is the result :
Between V3.0.2 and V4.0 the SQL langage as changed (in an optimal way ... to be more compliant with the standard). That's why some things have been modified.
Concerning the UNION : In V3.0.2, you have to use:
CREATE TABLE toto AS SELECT table1 UNION table2;
In V4.0, you have to use :
CREATE TABLE toto AS SELECT * FROM table1 UNION SELECT * FROM table2;
Concerning the conversion (cast) of fields :
In the V3.0.2 we had some specific functions (like ToString). But now in the V4.0 we use a magic term that allows to convert on the fly. This magic term is :: So you can now write
SELECT *, my_field_int :: string as my_field_string FROM my_table;