[postgis-users] 3D data became 2d auf insertion?

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Tue Jan 22 08:12:10 PST 2008


On Tue, 2008-01-22 at 16:53 +0100, Simon Schneider wrote:
> Hi,
> 
> I have the following table...
> 
> _________________________________________
> create table objects
> (
>    name varchar(15) not null primary key,
>    parent varchar(15),
>    type varchar(15) not null
> );
> select addgeometrycolumn('objects','geom',-1,'POLYGON',3);
> _________________________________________
> 
> 
> ... in which I insert the following row:
> 
> _________________________________________
> insert into objects(name, type, geom3d) values('Main2', 'building', 
> GeomFromEWKT('POLYGON((0 0 0, 50 0 0, 50 50 0, 0 50 0, 0 0 50, 50 0 50, 
> 50 50 50, 0 50 50, 0 0 0))'));
> _________________________________________
> 
> 
> After querying the data of this table I get:
> 
> _________________________________________
> "Main2";"POLYGON((0 0,50 0,50 50,0 50,0 0,50 0,50 50,0 50,0 0))"
> _________________________________________
> 
> 
> And now I'm wondering where did my z-vals go? Can anybody explain to me 
> what's happened here?
> 
> 
> Thx,
> Simon


Hi Simon,

I think the question we all want to know is: how did you query the
data? ;)

But seriously, I suspect the problem is that you need to use
ST_AsEWKT()/AsEWKT() in your query. This is because PostGIS is compliant
to earlier versions of the Simple Feature Access spec, which only
specify 2D geometries. AsEWKT() provides the extra information, but is
not (yet) deemed to be spec compliant.


HTH,

Mark.

-- 
ILande - Open Source Consultancy
http://www.ilande.co.uk





More information about the postgis-users mailing list