[postgis-users] Problem With Geometries and a View

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jan 30 07:22:12 PST 2007


Why are you quoting 'the_geom' in:

   select extent('the_geom') from geom;

shouldn't this just be:

    select extent(the_geom) from geom;
or
    select extent("the_geom") from geom;

-Steve

Leonardo Mateo wrote:
> Hi everyone, I have a problem trying select geometries from a view. It
> raises an "Invalid Geometry' error.
> What I'm doing is:
> - Create a view from a table with several inner joins and generating
> the POINTS in the select sentence, for example:
> [CODE]
>   create view geom as
>    select
>     record.oid,
>     record.recordid,
>     GeomFromText('POINT(' || datax.value || ' ' || datay.value || ')'),
>     label.value
>    from record
>    inner join schema on schema.objectid = record.schemaid
>    inner join giscontrol on giscontrol.schemaid = schema.objectid
>    inner join step on step.schemaid = schema.objectid
>    inner join control on control.stepid = step.objectid and
> control.islabel = true
>    inner join data as datax on datax.recordid = record.recordid and
> datax.controlid = giscontrol.xcontrolid
>    inner join data as datay on datay.recordid = record.recordid and
> datay.controlid = giscontrol.ycontrolid
>    inner join data as label on label.recordid = record.recordid and
> label.controlid = control.objectid
>    where schema.ismain = true and record.datasetid = 515
>    order by recordid;
> [/CODE]
> 
> - Then check the view was created with the data I need:
> [CODE]
>   select * from geom;
> [/CODE]
>  And results like these:
> 46051;9105;"010100000048E17A14AE471D40713D0AD7A3704640";"ACEA
> PINEROLESE INDUSTRIALE SPA"
> 46037;9106;"010100000048E17A14AE471D40713D0AD7A3704640";"ITALGAS"
> 26202;9107;"010100000048E17A14AE471D40713D0AD7A3704640";"SIPTEL"
> 26203;9108;"010100000048E17A14AE471D40713D0AD7A3704640";"SIPTEL"
> 26204;9109;"010100000048E17A14AE471D40713D0AD7A3704640";"SIPTEL"
> 
> Which look just fine.
> 
> - Then I try to select the extent of these points with:
> [CODE]
>   select extent('the_geom') from geom;
> [/CODE]
>  And I got this error:
>  ERROR:  parse error - invalid geometry
> 
> The weird thing is that if I insert that SELECT sentence into another
> table and create a view from that table with something like this:
>  [CODE]
>    create view geom as Select * from <newtable>
>  [/CODE]
> 
> The extent is selected properly.
> 
> What am I doing wrong? It's driving me nuts.
> 
> Thanx a lot in advance.
> 
> 




More information about the postgis-users mailing list