Skip to content

Commit

Permalink
v0.6.51
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Nov 28, 2023
1 parent 397a297 commit dba6d89
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/cli/mapshaper-options.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -995,12 +995,12 @@ export function getOptionParser() {
describe: 'side length (e.g. 500m, 12km)',
type: 'distance'
})
// .option('cols', {
// type: 'integer'
// })
// .option('rows', {
// type: 'integer'
// })
.option('cols', {
type: 'integer'
})
.option('rows', {
type: 'integer'
})
// .option('bbox', {
// type: 'bbox',
// describe: 'xmin,ymin,xmax,ymax (default is bbox of data)'
Expand Down
4 changes: 3 additions & 1 deletion src/grids/mapshaper-grid-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ export function twoCircleIntersection(c1, r1, c2, r2) {
}
return r1sq * Math.acos(d1/r1) - d1 * Math.sqrt(r1sq - d1 * d1) +
r2sq * Math.acos(d2/r2) - d2 * Math.sqrt(r2sq - d2 * d2);
}
}


20 changes: 20 additions & 0 deletions src/grids/mapshaper-hex-grid.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ import { orient2D } from '../geom/mapshaper-segment-geom';
// Currently the origin cell is always an "outie" (protruding); in the future
// "innie" origin cells may be supported

export function getHexGridParams(bbox, interval, opts) {
var params = {};
params.flatTop = opts.type != 'hex2'; // hex2 is "pointy-top" orientation
// origin cell (bottom left) may be "outie" or "innie" ... could be settable
params.outieOrigin = true;

// get origin and counts for centered grid
// params.u0 = _getUOrigin();
// params.v0 = _getVOrigin();
// params.colCounts = _getColCounts(bbox, interval);
// params.rowCounts = _getRowCounts(bbox, interval);

if (opts.aligned) {

}
}


// interval: side length in projected coordinates
// bbox: bounding box of area to be enclosed by grid
//
Expand All @@ -23,6 +41,8 @@ export function getHexGridMaker(bbox, interval, opts) {
var _uOrigin = _getUOrigin();
var _vOrigin = _getVOrigin();

var params = getHexGridParams(bbox, interval, opts);

function cells() {
return _rowCounts[0] * _colCounts[0] + _rowCounts[1] * _colCounts[1];
}
Expand Down

0 comments on commit dba6d89

Please sign in to comment.