MapInfo Pro

Expand all | Collapse all

Hexagons in MapInfo Pro

  • 1.  Hexagons in MapInfo Pro

    Posted 06-24-2019 02:46
    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
    ------------------------------


  • 2.  RE: Hexagons in MapInfo Pro

    Posted 07-01-2019 12:06
    Hi Peter,

    We use hexagons for a number of things. I like them because they look cool, our statistical analyst likes them because of their uniformity and distance benefits, as you mention.

    If you could share the pre-release I'd be happy to test it out.

    Regards,

    Richard

    ------------------------------
    Richard Cantwell
    Gamma Ltd (VAR)
    DUBLIN 8
    ------------------------------



  • 3.  RE: Hexagons in MapInfo Pro

    Pitney Bowes
    Posted 07-22-2019 14:32
      |   view attached
    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
    ------------------------------

    Attachment(s)

    zip
    FocalGrd.zip   20K 1 version


  • 4.  RE: Hexagons in MapInfo Pro

    Posted 07-31-2019 11:28

    Hi

    Sorry for not get back earlier - my summer vacation got in the way :-)

    I worked a bit on an interface for the Hexagon tool to make it a bit more user friendly.

    The sourcecode can be found here on github: HexagonTool.
    And if you just want to give the tool a try, you can grab it here (also from GitHub)

    It will go into the MapInfo Marketplace too but it need a bit more testing before that.



    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------



  • 5.  RE: Hexagons in MapInfo Pro

    Posted 08-02-2019 09:50
    Thanks @Tony Maber for giving the tool a spin.

    I have incorporated your suggestions and compiled a new version, 1.10 (grab it here)



    Improvements:
    • Added Browse button in dialog to select output tab file
    • Stores certain settings between session, such as size, type and tab file
    • Added properties for handling pen and brush of the hexagons (not in dialog yet)
    • Added note in dialog that lat/long isn't supported
    I have a few other things I want to add to the tool at some point, such as:
    • Set Brush and Pen style via dialog (currently is can be set via HexagonTool.ini in this folder %appdata%\mapinfo\mapinfo
    • Support creating the hexagons using (0,0) of the current coordsys as the offset. Will position the hexagons at the same position every time
    • Support Lat/Long

    Any obvious improvement suggestions are welcomed!

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------



  • 6.  RE: Hexagons in MapInfo Pro

    Posted 08-02-2019 10:31
    I love hexagons too and that's a great-looking tool, Peter. Can't wait to try it.

    In a world where I'm already burdened with too many choices, I now have to decide between Pointy Top and Flat Top hexagons. :-)

    #gisdilemma



    ​​​

    ------------------------------
    Warren Vick
    Europa Technologies Ltd.
    London, U.K.
    ------------------------------



  • 7.  RE: Hexagons in MapInfo Pro

    Posted 08-20-2019 02:46
    I had seen this post about the Uber H3 earlier and today @Ashley Crane passed it onto me again: H3: Uber's Hexagonal Hierarchical Spatial Index

    They have written this in C and but also posted a number of bindings on Github. All these are Open Source under the Apache License. Maybe I should have a closer look at the C# binding and see how that could be incorporated into MapInfo Pro, either using MapBasic or via the MDAL API.

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------