1"use strict";(globalThis.webpackChunkh3_website||=[]).push([[3737],{1642(e,n,i){i.r(n),i.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>a,frontMatter:()=>d,metadata:()=>r,toc:()=>c});const r=JSON.parse('{"id":"core-library/filters","title":"Unix-style Filters for H3","description":"The directory src/apps/filters contains unix-style stdin/stdout filters that perform conversions between integer H3 indexes and other useful types. It currently contains the filters listed in the table below. See the header comments in each application source code file for more information.","source":"@site/docs/core-library/filters.md","sourceDirName":"core-library","slug":"/core-library/filters","permalink":"/docs/core-library/filters","draft":false,"unlisted":false,"editUrl":"https://github.com/uber/h3/edit/master/website/docs/core-library/filters.md","tags":[],"version":"current","frontMatter":{"id":"filters","title":"Unix-style Filters for H3","sidebar_label":"Unix-style Filters for H3","slug":"/core-library/filters"},"sidebar":"someSidebar","previous":{"title":"Creating bindings","permalink":"/docs/core-library/creating-bindings"},"next":{"title":"Compilation options","permalink":"/docs/core-library/compilation-options"}}');var t=i(4848),s=i(8453);const d={id:"filters",title:"Unix-style Filters for H3",sidebar_label:"Unix-style Filters for H3",slug:"/core-library/filters"},l=void 0,o={},c=[{value:"Unix Command Line Examples",id:"unix-command-line-examples",level:2}];function h(e){const n={a:"a",code:"code",h2:"h2",li:"li",p:"p",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["The directory ",(0,t.jsx)(n.code,{children:"src/apps/filters"})," contains unix-style stdin/stdout filters that perform conversions between integer H3 indexes and other useful types. It currently contains the filters listed in the table below. See the header comments in each application source code file for more information."]}),"\n",(0,t.jsx)(n.p,{children:"Filters are experimental and are not part of the semantic version of the H3 library."}),"\n",(0,t.jsxs)(n.p,{children:["All latitude/longitude coordinates are in decimal degrees. See the ",(0,t.jsx)(n.a,{href:"/docs/core-library/h3Indexing",children:"H3 Index Representations"})," page for information on the integer ",(0,t.jsx)(n.code,{children:"H3Index"}),"."]}),"\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"filter"}),(0,t.jsx)(n.th,{children:"input"}),(0,t.jsx)(n.th,{children:"outputs"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"latLngToCell"})}),(0,t.jsx)(n.td,{children:"lat/lng"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"H3Index"})})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"cellToLatLng"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"H3Index"})}),(0,t.jsx)(n.td,{children:"cell center point in lat/lng"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"cellToBoundary"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"H3Index"})}),(0,t.jsx)(n.td,{children:"cell boundary in lat/lng"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"h3ToComponents"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"H3Index"})}),(0,t.jsx)(n.td,{children:"components"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"gridDisk"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"H3Index"})}),(0,t.jsxs)(n.td,{children:["surrounding ",(0,t.jsx)(n.code,{children:"H3Index"})]})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"gridDiskUnsafe"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"H3Index"})}),(0,t.jsxs)(n.td,{children:["surrounding ",(0,t.jsx)(n.code,{children:"H3Index"}),", in order"]})]})]})]}),"\n",(0,t.jsx)(n.h2,{id:"unix-command-line-examples",children:"Unix Command Line Examples"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsx)(n.p,{children:"find the index for c
1oordinates at resolution 5"}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"latLngToCell --resolution 5 --latitude 40.689167 --longitude -74.044444"})}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsxs)(n.p,{children:["output the cell center point for ",(0,t.jsx)(n.code,{children:"H3Index"})," 845ad1bffffffff"]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"cellToLatLng --index 845ad1bffffffff"})}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsxs)(n.p,{children:["output the cell boundary for ",(0,t.jsx)(n.code,{children:"H3Index"})," 845ad1bffffffff"]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"cellToBoundary --index 845ad1bffffffff"})}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsxs)(n.p,{children:["find the components for the ",(0,t.jsx)(n.code,{children:"H3Index"})," 845ad1bffffffff"]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"h3ToComponents --index 845ad1bffffffff"})}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsxs)(n.p,{children:["output all indexes within distance 1 of the ",(0,t.jsx)(n.code,{children:"H3Index"})," 845ad1bffffffff"]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"kRing -k 1 --origin 845ad1bffffffff"})}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsxs)(n.p,{children:["output all hexagon indexes within distance 2 of the ",(0,t.jsx)(n.code,{children:"H3Index"})," 845ad1bffffffff"]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"hexRange -k 2 --origin 845ad1bffffffff"})}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["Note that the filters ",(0,t.jsx)(n.code,{children:"cellToLatLng"})," and ",(0,t.jsx)(n.code,{children:"cellToBoundary"})," take optional arguments that allow them to generate ",(0,t.jsx)(n.code,{children:"kml"})," output. See the header comments in the corresponding source code files for details."]})]})}function a(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(h,{...e})}):h(e)}},8453(e,n,i){i.d(n,{R:()=>d,x:()=>l});var r=i(6540);const t={},s=r.createContext(t);function d(e){const n=r.useContext(s);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:d(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.