[postgis-users] Exporting 3D Shape to PostGIS

Matthew Pulis mpulis at gmail.com
Fri Feb 8 09:27:20 PST 2008


Thanks a lot :)

Will try them out

I already tried this : 

select 
gid, stseg, z (
	pointn(
		geometryn(the_geom,1), 1
		)
 )





 from streets_3d order by z;

And resulted from 48.* to 157.* which shows that the data is quite flat hehe
:)

One last question please : Considering the datum is NAD83 and projection is
LCC, does the z coordinate reflect meters?

Thanks and regards

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Kevin
Neufeld
Sent: Friday, February 08, 2008 6:11 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Exporting 3D Shape to PostGIS

Hi Matthew,

Yes.  PostGIS actually supports a 4th dimension, measures, which it 
looks like your ogr utility program populated with '0'. 

You may be interested in these methods to verify this yourself.
ST_zmflag(geometry),
ST_ndims(geometry),
ST_Force_3d(geometry),

ie.
SELECT asewkt(force_3d(the_geom)) from streets_3d where gid=1;

Cheers,
Kevin

Matthew Pulis wrote:
> Hi Kevin and the rest :)
>
> Seems like it did the trick :
>
> select asewkt(the_geom) from streets_3d where gid=1;
>
> "MULTILINESTRING((625304.649659493 214113.544271209 111.1573080888
> 0,625301.199687227 214078.520974251 111.1573080888 0,625299.489760683
> 214056.176602372 111.1573080888 0,625299.289850496 214050.649031119
> 111.1573080888 0))"
>
> As opposed to :
>
> select asewkt(the_geom) from streets where gid=1;
>
> "MULTILINESTRING((625304.649659493 214113.544271209,625301.199687227
> 214078.520974251,625299.489760683 214056.176602372,625299.289850496
> 214050.649031119))"
>
> I can take it that 111.1573080888 is the altitude right? (considered as z
> coordinate) 
>
> Am I right in my supposition?
>
> Thanks a lot for your help :)
>
> Matthew
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Kevin
> Neufeld
> Sent: Friday, February 08, 2008 5:49 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Exporting 3D Shape to PostGIS
>
> http://postgis.refractions.net/docs/ch06.html#id2615538
>
> ST_AsText(Geometry) returns the WKT representation according to OGC 
> standards, which does not include 3D values.
>
> Try PostGIS's WKT extension instead: ST_AsEWKT(Geometry)
>
> Cheers,
> Kevin
>
>
> Matthew Pulis wrote:
>   
>> Hi,
>>
>>  
>>
>> I have a 3D Shapefile, which I am trying to export to a PostGIS table.
>>
>>  
>>
>> This is the an extract from the ogrinfo on the shape file :
>>
>>  
>>
>> yancho at Ubuntu:~$ ogrinfo -so streets3d_new_shps/ testogr
>>
>> Geometry: 3D Line String
>>
>> Feature Count: 49746
>>
>> Extent: (610869.384850, 196653.348553) - (676816.248304, 258102.572101)
>>
>> Layer SRS WKT:
>>
>> PROJCS["Lambert Conformal Conic",
>>
>>     GEOGCS["grs80",
>>
>>         DATUM["North_American_Datum_1983",
>>
>>  
>> SPHEROID["Geodetic_Reference_System_1980",6378137,298.257222101]],
>>
>>         PRIMEM["Greenwich",0],
>>
>>         UNIT["degree",0.0174532925199433]],
>>
>>     PROJECTION["Lambert_Conformal_Conic_2SP"],
>>
>>  
>>
>>  
>>
>> I exported this shapefile to PostGIS table and this is the result of this
>> query : 
>>
>>  
>>
>> select astext(the_geom) from streets_3d where gid=1; :
>>
>>  
>>
>> "MULTILINESTRING((625304.649659493 214113.544271209,625301.199687227
>> 214078.520974251,625299.489760683 214056.176602372,625299.289850496
>> 214050.649031119))"
>>
>>  
>>
>> And this is the resulting query from the streets table which is the
normal
>> 2D table :
>>
>>  
>>
>> select astext(the_geom) from streets where gid=1; :
>>
>>  
>>
>> "MULTILINESTRING((625304.649659493 214113.544271209,625301.199687227
>> 214078.520974251,625299.489760683 214056.176602372,625299.289850496
>> 214050.649031119))"
>>
>>  
>>
>>  
>>
>> Any idea what I can do so I can start using elevation on this table
>>     
> please? 
>   
>>  
>>
>> Any help will be extremely appreciated
>>
>>  
>>
>> Regards
>>
>>  
>>
>> Matthew
>>
>>  
>>
>>   _____  
>>
>> I am using the free version of SPAMfighter for private users.
>> It has removed 22873 spam emails to date.
>> Paying users do not have this message in their emails.
>> Try SPAMfighter <http://www.spamfighter.com/len>  for free now!
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>   
>>     
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>   
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

-- 
I am using the free version of SPAMfighter for private users.
It has removed 22884 spam emails to date.
Paying users do not have this message in their emails.
Get the free SPAMfighter here: http://www.spamfighter.com/len




More information about the postgis-users mailing list