I was looking at this FocalGrid MB source code posted by one of our users in Finland quite awhile ago:
http://butler.cc.tut.fi/~joutsini/mipro/
Looks like it could work nicely as a tool for generating hexagons.
I was tweaking some of the code and made it work to generate 10 square mile hex polygons pretty quickly over a UTM coordsys region of Arizona.
Does not allow using LonLat Coordsys.
It is hardcoded to Finnish KKJ system but can just change line 1032 to use this:
strProj = TableInfo(i, TAB_INFO_COORDSYS_CLAUSE)
There's some other WIN32 specific code to check how long it'll take to process, but I did not delve into the source too long.
Peter, your UI code could come from this too.
Please be sure to send email to author if you make some major updates to source and re-publish as a new tool.
Have fun.
------------------------------
Bill Wemple
Principal QA Engineer
Pitney Bowes
Troy, NY
------------------------------
Original Message:
Sent: 06-24-2019 02:45
From: Peter Horsbøll Møller
Subject: Hexagons in MapInfo Pro
I have always been some what fascinated by the Hexagon structures.
I came across a comprehensive post on the Red Blob Games blog diving into the details on the hexagons.
I used the pseudo-code from this site to create a module in MapBasic, HEXAGONLib.mb, that can create hexagons from a given extent.
It's still in the early days so I haven't built any user interface for the functionality yet. I have only published some of the main functions to the MapInfo Pro interface so that I can use the from the MapBasic window as you can see above.
The hexagons have some benefits and some drawback compared to normal square grids:
- It can uniformly cover a sphere
- The distance between a cell and its six neighboring cells is the same. That's not the case with a square grid. Four of the square grds neighboring cells are at the same distance and the remaining four cells (the corner cells) are further away).
- As a drawback I can mention that it's harder to subdivide hexagons
Read more about the benefits and drawback here on gis.stackexchange.com.
Have you considered or are you already using hexagons in your daily work in MapInfo Pro?
If you think building hexagons could be useful, I'm happy the share a pre-release of the WindowHelper tool that has this functionality.
------------------------------
Peter Horsbøll Møller
Pitney Bowes
------------------------------