Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run this query:

TRUNCATE sertaozinho.apps;

INSERT INTO sertaozinho.apps (id,tipo,the_geom)
    SELECT st_union(
    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 = '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
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)

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

Your Answer


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.