I am a beginner in GIS and Learning PostGIS. I came across this two terms Geom and Geog, Could anyone explain in brief. What is the best to use with map data and Do all functions support both Geom and geog.
2 Answers
You can find your answer in "PostGIS in Action", from Regina O. Obe and Leo S. Hsu, Edited by Manning
The difference from geometry and geographyc type:
"PostGIS 1.5 introduced a new spatial type called geography, which uses geodetic measurement instead of Cartesian measurement. Coordinate points in the geography type are always represented in WGS 84 lon lat degrees (SRID 4326), but measurement functions and relationships ST_Distance, ST_DWithin, ST_Length, and ST_Area always return answers in meters or assume inputs in meters."
What is best to use? It depends:
"When choosing between the geometry and geography type for data storage, you should consider what you’ll be using it for. If all you do are simple measurements and relationship checks on your data, and your data covers a fairly large area, then most likely you’ll be better off storing your data using the new geography type. Although the new geography data type can cover the globe, the geometry type is far from obsolete. The geometry type has a much richer set of functions than geography, relationship checks are generally faster, and it has wider support currently across desktop and web-mapping tools."
Also, take a look in an already answered question here.
-
1Thanks @Alexandre Neto, I got one mroe interesting which is similar to yours, thought of sharing workshops.opengeo.org/postgis-intro/…– azzaxpMay 28, 2012 at 12:23
First, I would suggest reading this excellent answer (ahem!) on the differences between CRS, SRS, and projections.
Fundamentally, the Geometry
column type can hold geometric data of any type and in any (or no) projection and CRS. It really just deals with geometry on a 2.5D Euclidean plane (by 2.5D, I mean that geometry has x and y coordinates, and a notional z coordinate that is ignored by most functions). So even if your data was stored in latitude (y) and longitude (x), unless the function explicitly says so, it would work as if they were planar coordinates. This means that, for instance, area calculations would be measured in "square degrees", which would not correspond to any useful notion of area.
Geography
columns, on the other hand, are much more limited. It is assumed all coordinates are in the WGS84 CRS. All functions that work on geography columns (of which there are fewer than for the geometry
type, but increasing with each release), will give you correct results such as distance or area. This can be an issue if you're dealing with data that uses a different datum or ellipsoid, in which case a geometry column would need to be used.