[postgis-users] hexagonal grid

Martin Davis mbdavis at refractions.net
Fri May 30 10:12:19 PDT 2008


This is great!  Added to the wiki at  
http://postgis.refractions.net/support/wiki/index.php?GenerateHexagonalGrid

Sufficool, Stanley wrote:
> Generate a hexagonal grid of 64x128 hexes, then follow the slice/dice from bostongis at step 4.
>
> Substitute the values in generate series with your datasource min/max X/Y extents.
>
> ===============================
>
> create table hex_grid (gid serial not null primary key, the_geom geometry not null);
>
> INSERT INTO hex_grid (the_geom)
> SELECT translate(the_geom, x_series, y_series)
> from generate_series(0 - 128, 10000 + 128, 128) as x_series,
> generate_series(0 - 128, 10000 + 128, 256) as y_series,
> (
> 	SELECT 'POLYGON((0 0,64 64,64 128,0 192,-64 128,-64 64,0 0))'::geometry as the_geom
> 	UNION SELECT translate('POLYGON((0 0,64 64,64 128,0 192,-64 128,-64 64,0 0))'::geometry, 64, 128)  as the_geom
> ) as one_hex
>
> ===============================
>
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Matias Massigoge
> Sent: Thursday, May 29, 2008 12:58 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] hexagonal grid
>
>
> Thanks Paul!!
>
> On Thu, May 29, 2008 at 4:42 PM, Paul Ramsey <pramsey at cleverelephant.ca> wrote:
>   
>> Try this:
>>
>> http://www.bostongis.com/blog/index.php?/archives/35-Map-Dicing-and-ot
>> her-stuff.html
>>
>> P.
>>
>> On Thu, May 29, 2008 at 12:34 PM, Matias Massigoge 
>> <matias.massigoge at agerpro.com.ar> wrote:
>>     
>>> Hi all,
>>>
>>> I'm looking for something similar but squared.
>>> This theme have been covered in the past?
>>> Sorry, I'm newby.
>>> Thanks all.
>>>
>>> Matías
>>>
>>>
>>>
>>> On Thu, May 29, 2008 at 12:42 PM, Brent Wood <pcreso at pcreso.com> 
>>> wrote:
>>>       
>>>>> On Thu, May 29, 2008 at 7:08 AM, Randall, Eric 
>>>>> <ERandall at eriecountygov.org>
>>>>>           
>>>> wrote:
>>>>         
>>>>>> Has anyone created a method for generating a hexagonal grid over 
>>>>>> a polygon
>>>>>>             
>>>>> envelope using postgis? Thought I'd ask before setting out.  
>>>>> Thanks.
>>>>>           
>>>> Hi Eric
>>>>
>>>> I haven't specifically done this in PostGIS, but have briefly looked 
>>>> into something similar with a colleague who uses R extensively, and 
>>>> was looking at cellular automata modelling over a hexagonal grid. He 
>>>> was using such a dataset in R, & there were a few ways this could be 
>>>> transferred to PostGIS, including the R:gdal package, or a 
>>>> dump/parse/reformat/import script.
>>>>
>>>> Cheers,
>>>>
>>>>   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
>>>
>>>       
>> _______________________________________________
>> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-users mailing list