[postgis-users] Problem With Geometries and a View

Uwe Seher uwe.seher at googlemail.com
Tue Jan 30 07:12:41 PST 2007


Am 30.01.2007, 14:47 Uhr, schrieb Leonardo Mateo <leonardomateo at gmail.com>:

> 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.
>
>

Maybe you have to set an SRID?

CU Uwe


-- 
_____________________________________
ingenieurbüro kauppert

nebeniusstr. 34
d-76137 karlsruhe

fon   +49 721 3548969-3
fax   +49 721 3548969-5

email uwe.seher at ib-kauppert.de
web   www.ib-kauppert.de
_____________________________________



More information about the postgis-users mailing list