Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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();

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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