On 16 March 2012 15:47, Puneet Kishor <punk.k...@gmail.com> wrote: > I am trying to create a simple 1 deg x 1 deg grid and transform it to > spherical mercator > > 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 ( > SELECT Generate_series(-180, 180, 1) lng, > Generate_series(-90, 90, 1) lat > ) series > WHERE (lng + 1) < 181 AND (lat + 1) < 91 > ) lat_lng > > > I get > > ERROR: transform: couldn't project point (-180 -90 0): tolerance > condition error (-20) > > > > What am I doing wrong?
Transform has difficulties at the poles, since the limits of math are stretched. If you aren't gridding polar bears and/or penguins, then you should use only latitudes from 79S to 79N. Try this: 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 ( SELECT Generate_series(-180, 179, 1) lng, Generate_series(-89, 88, 1) lat ) series ORDER BY lng, lat ) lat_lng; _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users