[postgis-users] Creating polygons from lines fails

Kevin Neufeld kneufeld at refractions.net
Tue May 5 08:35:52 PDT 2009


Stefan Donath wrote:
...
> 
> I do the following command:
> 
> INSERT INTO pl_zonen_gen VALUES ('SELECT right_pl_zone, 
> ST_BuildArea(ST_Collect(geometry))
> FROM pl_zonen_kante_gen GROUP BY right_pl_zone','xxxx')
> 
> I get error message:
> 
> ERROR: parse error - invalid geometry
> SQL Status:XX000
> 
> What does that refer to?
> 

Your query syntax is not correct.  To illustrate, here's your query simplified...
INSERT INTO pl_zonen_gen VALUES ('some text string1', 'some text string2');
Since you didn't specify columns names, I assume by the error message PostgreSQL is trying to cast your first text 
string into a geometry like this: 'POINT(1 2)'::geometry.

Try rewriting your query to something like this:

-- I'm guessing on your column names here ... replace as necessary.
INSERT INTO pl_zonen_gen (postal_code, geometry)
SELECT right_pl_zone, ST_BuildArea(ST_Collect(geometry))
FROM pl_zonen_kante_gen
GROUP BY right_pl_zone;

Cheers,
-- Kevin



More information about the postgis-users mailing list