[postgis-users] creating a grid; transform error

Mike Toews mwtoews at gmail.com
Thu Mar 15 22:00:40 PDT 2012


On 16 March 2012 16:52, Puneet Kishor <punk.kish at gmail.com> wrote:
> Thanks Mike... works.

I just noticed there was something funny going on with the
generate_series cross product, so it wasn't producing as many rows. It
should be:

SELECT ST_Transform(ST_MakeEnvelope(minx, miny, maxx, maxy, 4326),
900913) the_geom
FROM (
    SELECT lng minx, lat miny, (lng + 1) maxx, (lat + 1) maxy
    FROM generate_series(-85, 84, 1) lat,
         generate_series(-180, 179, 1) lng
    ORDER BY lng, lat
) lat_lng;

-Mike



More information about the postgis-users mailing list