Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does PostGis support Lambert cylindrical projection or is there a way to add support for it? I'm probably searching the wrong terms, but google isn't bringing up anything useful. Any help is appreciated.

EDIT: if not Lambert, are there are other cylindrical equal-area projections which can be used in PostGis.

share|improve this question
up vote 2 down vote accepted

It's built in. POSTGis uses the Proj.4 library for projections. The source code for Lambert equal area is PJ_cea.c (in version 4.7.0); a better-documented version appears as cea.js in Proj4js version 1.0.2. Here is the header from the .js version:


PURPOSE:    Transforms input longitude and latitude to Easting and
        Northing for the Lambert Cylindrical Equal Area projection.
                This class of projection includes the Behrmann and 
                Gall-Peters Projections.  The
        longitude and latitude must be in radians.  The Easting
        and Northing values will be returned in meters.

Let's get back to your original problem, because we may have lost sight of it during the intervening questions:

Basically I'm generating a grid table. Then I'll be doing a join query on some points and the grid table and group them by the cell they fall into to create histograms.

You can do this easily without generating any grid at all, because the formulas for an equal-area rectangular grid in decimal degrees are simple:

Let the intended width be w and the desired area be A. On the plane, a rectangle's height would nominally be h = A / w. Once and for all, convert w and h from meters to decimal degrees, using a conversion of approximately 10,000,000/90 meters per degree. Suppose the grid's origin (lower left corner) is at (x0,y0) as longitude and latitude. To determine what grid cell a point with (lon,lat) equal to (x,y) would fall in,

  1. Compute x-x0 (as decimal degrees) and divide this by w. Round the result up to the nearest integer: this is the grid column index, j.

  2. Compute sin(y)-sin(y0) and divide by h. Round up to the nearest integer: this is the grid row index, i.

The ordered pair (i,j) identifies the grid cell: use this to bin the points in the histogram. It won't enable you to draw a picture of the grid, but maybe you don't need that for your analysis...

share|improve this answer
Great answer! I do need to draw the grid though. – ilia choly Aug 13 '11 at 16:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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