0

When I run this query:

TRUNCATE sertaozinho.apps;

INSERT INTO sertaozinho.apps (id,tipo,the_geom)
VALUES (DEFAULT, 'app' ,(
    SELECT st_union(
    CASE 
    WHEN area.cobertura = 'lago' THEN ST_Transform(st_buffer(area.the_geom,15), 32723)
    WHEN area.cobertura = 'rio' THEN ST_Transform(st_buffer(area.the_geom,100) , 32723)
    WHEN linhas.name = 'corrego' THEN ST_Transform(st_buffer(linhas.the_geom,30) , 32723)
    WHEN pontos.tipo = 'nascente' THEN ST_Transform(st_buffer(pontos.the_geom,50) , 32723)
    END )
    FROM sertaozinho.area, sertaozinho.linhas, sertaozinho.pontos
    )
    )

I get this output:

ERROR: Error creating GEOS Coordinate Sequence
Estado de SQL:XX000

The query is only a sequence of buffers and then an union. The dataset contains about 1000 polygons and 200 lines. I have already succeeded in running this query, but after some minor edits in the polygons it stopped working. Any clue? EDIT: Sometimes after this query the server stops and needs to be restarted.

1

I'm guessing the problem is with the CASE statement, since it doesn't have an explicit ELSE component, so returns NULL. This is completely untested, but try inserting one line:

...
WHEN pontos.tipo = 'nascente' THEN ST_Transform(st_buffer(pontos.the_geom,50) , 32723)
ELSE 'POLYGON EMPTY'::geometry
END )
...

Note: you should always show your version with SELECT PostGIS_Full_Version();

  • thank you, the ELSE component was the first steep to solve the problem. Other than that I had to narrow the search with some WHERE conditions. Now it works fine. – Pablo Oct 31 '11 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.