I'm trying to take advantage of the many functions available in Postgis for dealing with latitude and longitude coordinate systems. However, I would like to add some altitude information to my database and I can't find the proper answer for which datatype should be used for properly holding Latitude, Longitude and Altitude in Postgis?

I have found that Geometry type is capable of X, Y and Z, but the Geography type only holds Latitude and Longitude. Is there and differences between both?


2 Answers 2


I don't see why geography can't hold Z. Did you try it?

As per the docs:

CREATE TABLE testgeog(gid serial PRIMARY KEY, the_geog geography(POINTZ,4326) );


For geometries, like PointZ which can store Z values, you can try the WKB or WKT formats for example.
WKB is particularly well suited for database.
Transformations are easily performed as it is an OGC standard.


  • I would highly recommend using the postgis geometry/geography types instead of using WKB or WKT. The performance will be much better and the use of postgis functions will be a lot easier (and faster).
    – tilt
    Commented Jun 8, 2017 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.