[postgis-users] How best to build a regular grid from points

Andreas Forø Tollefsen andreasft at gmail.com
Thu Oct 21 00:12:46 PDT 2010


I used the ST_Envelope function.
Create a field with the X and Y column of your points, and add something
like this:
ST_MakeEnvelope(xcoord-"+0.1+", ycoord-"+0.1+", xcoord+"+0.1+",
ycoord+"+0.1+", 4326))

The above is from my python and pygresql script so ignore the syntax.
However, the idea is the same if you want to create grid cells from points.

Andreas

2010/10/18 Randall, Eric <ERandall at eriecountygov.org>

>
>
> Hi Brent,
>
>
> I use something like this, should be adaptable to your use (but might not
> be the best way).
> this makes a 10000 foot sided cell, and translates it 10x and 10y.
>
> Eric
>
>
>
> select st_translate(geom, 0 ,yseries) as geom from
> (select generate_series(0,90000, 10000) as yseries,st_translate(geom,
> xseries ,0) as geom from
> (select  generate_series(0, 90000, 10000) as xseries, geom from
> (select
> st_envelope(st_makeline(st_makepoint(1380000,630000),st_makepoint(1390000,640000)))
> as geom) as t1) as t2) as t3
>
>
>
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net]On Behalf Of
> pcreso at pcreso.com
> Sent: Sunday, October 17, 2010 1:39 PM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] How best to build a regular grid from points
>
>
> Hi,
>
> I have a set of 155,000,000 points on a regular grid. I need to convert
> these to a set of square polygons covering the area represented by the
> points.
>
> Can anyone suggest how this could be done in Postgis?
>
> Thanks,
>
>  Brent Wood
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101021/8bd793ff/attachment.html>


More information about the postgis-users mailing list