0.1.1 • Published 2 years ago

grids-over-polygon v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Grids Over Polygon

Table of Contents

Features

  • Make grid polygons over a polygon having closed line rings
  • Make grid polygons by giving size in square kilometers

Installing

Using npm:

$ npm install grids-over-polygon

Using yarn:

$ yarn add grids-over-polygon

Size Scale

  • 0.010 -> 10 sqmeters
  • 0.020 -> 20 sqmeters
  • 0.030 -> 30 sqmeters
  • 0.040 -> 40 sqmeters
  • 0.050 -> 50 sqmeters
  • ...
  • ...
  • 0.1 -> 100 sqmeters
  • 0.2 -> 200 sqmeters
  • ...
  • ...

Example

smaple input polygon

In order to gain grid polygons your polygon must be in a closed line-ring format like:

let polygon = {
  type: 'Polygon',
  coordinates: [
    [
      [68.512042621, 25.3242867300001],
      [68.5112976780001, 25.3242098640001],
      [68.510249592, 25.3238493880002],
      [68.5093489910001, 25.32398536500011],
      [68.5089150000001, 25.3237670000001],
      [68.5088307380001, 25.3234603970002],
      [68.5070500000002, 25.322573],
      [68.5074308300001, 25.3222267860002],
      [68.507042148, 25.3216887290001],
      [68.506972433, 25.321487729],
      [68.5069487710001, 25.3211973530002],
      [68.5068385850002, 25.320900226],
      [68.5062476370001, 25.3200674550001],
      [68.5061603980001, 25.3198325710001],
      [68.505565, 25.3172970000001],
      [68.5036411620001, 25.3101630540002],
      [68.499214034, 25.3078994810002],
      [68.4986290000001, 25.3081460000001],
      [68.4970450000001, 25.3071580000002],
      [68.49534786, 25.305435619],
      [68.4949080930002, 25.3045316550001],
      [68.4920286710001, 25.3039871830001],
      [68.490853874, 25.304612589],
      [68.4904316530001, 25.3053757910001],
      [68.487973048, 25.3047899310001],
      [68.4874530060002, 25.304597969],
      [68.486944394, 25.3047813230001],
      [68.512042621, 25.3242867300001],
    ],
  ],
};

Usage

const { createGrids } = require('grids-over-polygon');
const {createGrids} = require('grids-over-polygon');

const yourPolygon = [...];
const yourSizeInKilometers = 0.1; // for grid size in square kilometers/meters

let output = createGrids(yourPolygon, yourSizeInKilometers);

Sample Output Structure

[
  {
    "polygon": {
      "type": "Polygon",
      "coordinates": [
        [
          [68.45690698868681, 25.180706117700627],
          [68.4578996405087, 25.1807061143897],
          [68.4578996405087, 25.181604434885035],
          [68.45690698868681, 25.181604438195958],
          [68.45690698868681, 25.180706117700627]
        ]
      ]
    }
  }
]

License

MIT

acornacorn-globalsacorn-walkacorn-jsxansi-colorsajvansi-regexansi-escapesansi-stylesanymatchargparsearia-queryarr-diffarr-unionarr-flattenarray-equalarray-includesarray-uniquearray-unionarray.prototype.flatarray.prototype.flatmapassert-plusassign-symbolsasn1ast-types-flowastral-regexasynckitasyncroatobat-least-nodeaws-sign2axobject-querybabel-eslintbabel-jestbabel-plugin-annotate-pure-callsbabel-plugin-dynamic-import-nodebabel-plugin-dev-expressionbabel-plugin-jest-hoistbabel-plugin-polyfill-corejs2babel-plugin-istanbulbabel-plugin-polyfill-corejs3babel-plugin-macrosbabel-plugin-polyfill-regeneratorbabel-plugin-transform-rename-importbabel-preset-current-node-syntaxbalanced-matchbabel-preset-jestbasebcrypt-pbkdfbrace-expansionbinary-extensionsbrowser-process-hrtimebracesbrowser-resolvebs-loggerbuffer-frombserbuiltin-modulesbytes-ieccall-bindbrowserslistcallsitescamelcasecapture-exitcaselesscache-basecaniuse-litechalkchokidarci-job-numberclass-utilschardetcli-cursorcli-spinnerscli-widthcliuiclonecocollection-visitcollect-v8-coveragecolor-namecolor-convertcommandercombined-streamcommondircomponent-emitterconfusing-browser-globalsconcat-mapconvert-source-mapcopy-descriptorcore-js-purecore-js-compatcosmiconfigcore-util-iscross-spawncssomcssstyledamerau-levenshteinci-infodebugdata-urlsdecamelizedeep-isdeepmergedefaultsdefine-propertiesdefine-propertydetect-newlinedelayed-streamdecode-uri-componentdiff-sequencesdir-globdomexceptiondoctrineecc-jsbnelectron-to-chromiumemoji-regexend-of-streamenquireres-abstractes-shim-unscopableses-to-primitiveesbuildescaladeesbuild-darwin-64escape-string-regexpescodegeneslinteslint-config-prettiereslint-config-react-appeslint-import-resolver-nodeeslint-module-utilseslint-plugin-flowtypeeslint-plugin-importeslint-plugin-jsx-a11yeslint-plugin-reacteslint-plugin-prettiereslint-plugin-react-hookseslint-scopeeslint-visitor-keysesprimaespreeesrecurseeslint-utilsestree-walkeresqueryababerror-exexecaexec-shexitexpectexpand-bracketsextend-shallowestraverseexternal-editorextglobextsprintffast-deep-equalfast-difffast-globfastqfb-watchmanfiguresfile-entry-cachefind-cache-dirfill-rangefind-upflat-cacheflattedfor-inforever-agentform-datafragment-cachefs-extrafseventsfast-json-stable-stringifyesutilsfunction.prototype.namefunctional-red-black-treefunctions-have-namesgensyncget-caller-filefunction-bindget-intrinsicget-package-typeget-stdinfast-levenshteinget-symbol-descriptiongetpassget-valueglob-parentglobglobalsextendglobbyfs.realpathgraceful-fsget-streamgrowlyhar-validatorhar-schemahashas-bigintshas-property-descriptorshas-flaghas-tostringtaghas-valuehas-valueshosted-git-infohtml-encoding-snifferhtml-escaperhas-symbolshttp-signaturehuman-signalshumanize-durationignoreiconv-liteimport-freshaws4import-localglobreximurmurhashinquirerglobalyzerinternal-slotip-regexinterpretis-arrayishis-accessor-descriptoris-bigintis-binary-pathinflightis-boolean-objectis-bufferinheritsis-core-moduleis-callableis-data-descriptoris-ciis-date-objectis-dockeraxe-coreis-extendableis-descriptoris-fullwidth-code-pointis-generator-fnis-extglobis-globis-interactiveis-numberis-moduleis-number-objectis-plain-objectis-referenceis-negative-zerois-regexis-streamis-shared-array-bufferis-symbolis-stringis-weakrefis-typedarrayis-windowsisarrayis-wslisobjectisstreamisexeistanbul-lib-instrumentistanbul-reportsjestdashdashjest-changed-filesjest-diffjest-docblockjest-eachjest-environment-nodejest-environment-jsdomjest-get-typejest-jasmine2jest-haste-mapjest-configistanbul-lib-reportjest-message-utiljest-matcher-utilsjest-pnp-resolverjest-resolve-dependenciesjest-leak-detectorjest-regex-utiljest-runnerjest-resolvejest-runtimejest-snapshotjest-serializerjest-watcherjest-utiljest-workerjest-watch-typeaheadjest-validatejpjsjs-yamljsbnjs-tokensjsdomjson-parse-even-better-errorsjsescjson-schemajson-stringify-safejson-schema-traversejson5jsonfilejsprimjson-stable-stringify-without-jsonifyjsx-ast-utilskleurkind-oflanguage-subtag-registrylevnlevenlilconfiglanguage-tagslodashlines-and-columnslodash.debouncelodash.memoizelocate-pathlodash.mergelodash.sortbylog-symbolslog-updatelolexloose-envifylower-caselru-cachemagic-stringistanbul-lib-source-mapsmake-errormakeerrormake-dirmap-cachemap-visitmerge-streammicromatchmerge2mime-dbmimic-fnmime-typesminimatchmixin-deepmkdirpminimistmrimsmute-streamnanoidnanospinnernanomatchnatural-comparenice-tryno-casenode-notifiernode-int64normalize-package-datanormalize-pathnpm-run-pathnode-releasesnwsapioauth-signobject-assignobject-inspectobject-copyobject-keysobject-visitobject.entriesobject.assignobject.fromentriesobject.hasownobject.pickobject.valuesonetimeoptionatororaos-tmpdirp-finallyp-each-seriesp-limitp-locateparent-moduleparse-jsonp-tryparse5pascalcasepath-existsoncepath-keypath-typepath-parsepath-is-absoluteperformance-nowpicomatchpicocolorspkg-dirpiratesposix-character-classespnprelude-lsprettierpretty-formatprogressprettier-linter-helpersprogress-estimatorprop-typespromptspumppslpunycodeqsqueue-microtaskrandombytesread-pkgreaddirpread-pkg-uprealpath-nativerechoirregenerate-unicode-propertiesregenerateregenerator-transformregenerator-runtimeregex-notregexp.prototype.flagsregexpu-coreregexppreact-isregjsgenregjsparserremove-trailing-separatorrepeat-elementrequestrequest-promise-nativerepeat-stringrequest-promise-corerequire-directoryrequire-main-filenameresolve-cwdresolveretresolve-fromrestore-cursorrimrafreusifyrollup-plugin-sourcemapsrolluprollup-plugin-terserrollup-pluginutilsrsvprun-asyncrun-parallelrxjssadesafe-regexsafer-buffersanesaxessemverserialize-javascriptsafe-bufferset-valueshebang-commandshelljsshellwordsshebang-regexside-channelsignal-exitsisteransislashslice-ansisnapdragonsnapdragon-nodesnapdragon-utilsource-map-resolvesource-mapsource-map-urlsource-map-supportjest-clisourcemap-codecspdx-correctspdx-expression-parsespdx-exceptionssplit-stringspdx-license-idssshpksprintf-jsstatic-extendstealthy-requirestack-utilsstring-lengthstring.prototype.matchallstring-widthstring.prototype.trimendstring.prototype.trimstartstrip-ansistrip-bomstrip-eofstrip-final-newlinestrip-json-commentssupports-colorsupports-hyperlinkssupports-preserve-symlinks-flagsymbol-treetableterminal-linktersertest-excludethroattext-tablethroughtiny-globtmptmplto-fast-propertiesto-object-pathto-regex-rangeto-regextough-cookietr46tsconfig-pathstsutilstunnel-agenttweetnacltype-checktype-detecttype-festtypedarray-to-bufferunbox-primitiveunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunion-valueuniversalifyunicode-property-aliases-ecmascriptunset-valueupdate-browserslist-dburixuri-jsuseuuidv8-compile-cachevalidate-npm-package-licensev8-to-istanbulverrorw3c-hr-timejest-mockw3c-xmlserializerwalkerwebidl-conversionswcwidthwhatwg-encodingwhatwg-mimetypewhichwhatwg-urlwhich-boxed-primitiveword-wrapwhich-modulewrap-ansiwrappywritewrite-file-atomicwsxml-name-validatoryamlxmlcharsy18nyallistyargsyargs-parseristanbul-lib-coverageset-blockingresolve-urlpascal-case
0.1.1

2 years ago

0.1.0

2 years ago