Here my little piece of SQL to create grids (points or areas). Start with a drawing called Frame that contains a polygon that roughly describes the area of interest. The projection of this drawing is used for the resulting grid as well, and must be in meters (not in lat/lon). I just tested it with a Frame in lat/lon, and that worked well. After creation I shows nicely in the Eckert IV projection for example. 
Modify the value of the @width, @height and @snap parameters. Width/height is the size of the gridcell and @snap determines if the starting corner is the bottom-left of the frame polygon of the nearest (smaller) coordinate that is a multiple of the grid size. The query creates a table with two geometry fields, one for the points and one for the areas. For both a drawing is created. Hope this is useful for you (and others). -- $manifold$ VALUE @width INT64 = 1000; -- width of the grid in meters VALUE @height INT64 = 1000; -- height of the grid in meters VALUE @snap BOOLEAN = TRUE; -- if TRUE snap to the first multiple of grid size otherwise use bottomleft of the frame SELECT [value] AS [col] , [value 2] AS [row] , [Value] * @width + bottomLeftX as [x] , [Value 2] * @height + bottomLeftY as [y] , GeomMakePoint( VectorMakeX2( [Value] * @width + bottomLeftX , [Value 2] * @height + bottomLeftY ) ) as [geom_point] , GeomMakeRect( VectorMakeX4( [Value] * @width + bottomLeftX , [Value 2] * @height + bottomLeftY , ([Value] + 1) * @width + bottomLeftX , ([Value 2] + 1) * @height + bottomLeftY ) ) as [geom_area] INTO [Grid Table] FROM ( SELECT CASE @snap WHEN TRUE THEN Floor(bottomLeftCornerX / @width) * @width ELSE bottomLeftCornerX END as bottomLeftX , CASE @snap WHEN TRUE THEN Floor(bottomLeftCornerY / @height) * @height ELSE bottomLeftCornerY END as bottomLeftY -- , Ceil(width / @width) AS cols -- , Ceil(height / @height) AS rows , SPLIT CALL ValueSequence(0, Ceil(width / @width), 1) -- cols , SPLIT CALL ValueSequence(0, Ceil(height / @height), 1) -- rows FROM ( -- Get width and height of the frame SELECT VectorValue(GeomBoundsX([Geom]), 0) AS bottomLeftCornerX , VectorValue(GeomBoundsY([Geom]), 0) AS bottomLeftCornerY , VectorValue(GeomBoundsX([Geom]), 1) - VectorValue(GeomBoundsX([Geom]), 0) AS width , VectorValue(GeomBoundsY([Geom]), 1) - VectorValue(GeomBoundsY([Geom]), 0) AS height FROM [Frame] ) ) ; ALTER TABLE [Grid Table] ( ADD [mfd_id] INT64, ADD INDEX [mfd_id_x] BTREE ([mfd_id]), ADD INDEX [geom_point_x] RTREE ([geom_point]), ADD INDEX [geom_area_x] RTREE ([geom_area]), ADD PROPERTY 'FieldCoordSystem.geom_area' ComponentFieldCoordSystem([Frame], 'Geom'), ADD PROPERTY 'FieldCoordSystem.geom_point' ComponentFieldCoordSystem([Frame], 'Geom') ); CREATE DRAWING [Grid Points] ( PROPERTY 'FieldGeom' 'geom_point', PROPERTY 'Table' '[Grid Table]' ); CREATE DRAWING [Grid Areas] ( PROPERTY 'FieldGeom' 'geom_area', PROPERTY 'Table' '[Grid Table]' ); Chris Attachments:
grid-eckert-iv-projection.png
http://www.mppng.nl/manifold/pointlabeler |