[GIS] Easy way to Create Vector Grid polygons

mapbasicmapinfovector

We're currently using MapInfo & MapBasic to analyze daily tests results for planning purposes.For each test,exported result may contain empty values (say 999,we know Mapinfo has no NULL values),so we decided to maintain each result (by point values) by averaging and cleaning empty results for each parameters inside a square(piece of grid),that way results may not repeat at the same coordinates and separation of empty values.(Or you can say get results by grid where each grid contain how many points and joining results for each cell by averaging)

In this scenario,firstly we thought about creating these grids via gridmaker.mbx which is free tool for Mapinfo,but when the area is too large or the cell size is too small or even if grid maker has no chance to imply our algoritm that like in the following

We approach this problem by creating rectangles by 10 to 5000 meter values which are square cell sizes,and insert these values onto these tests via MBR or Convex polygon objects by checking out whether cell intersects these generated object from test.

The problem starts here even if we process these cells,generating results may last weeks,months even.So my question is likely in the title,so i ask a different and easy way to approach this problem.

Solutions,scenarios,algorithms you answer may not be solved only in mapinfo,but other tools as well.

Best Answer

An alternative approach would be to use a database engine (could be MapInfo) to analyse your result data and generate a file that could then be plotted in MapInfo as a vector grid:

Assuming Result data has a format like the following: X, Y, Value...

  1. Decide on the cell size of your MapInfo vector grid
  2. Truncate the X and Y coordinates to the nearest whole number of cell sizes
  3. Summarise (group by) the truncated X and Y columns generating the summary data that you require - mean, count etc.
  4. Transfer the summary into MapInfo and plot points from the truncated coordinates - these should plot in the lower left corner of each grid cell with data.
  5. Convert the points into grid cell squares using the following MapBasic code (could be in a MBX, or from the MapBasic window):

set coordsys table ResultPoints
update ResultPoints set obj = mbr(createline(centroidx(obj), centroidy(obj), centroidx(obj) + GridCellSize, centroidx(obj) + GridCellSize))

(You need to substitute the value from step 1 into the second line in place of GridCellSize)

The result should be very similar to what you were aiming for originally.