Comments (6)
Hi @thomasgwatson where are you seeing that example call? Because that's not correct.
You invoke geoToH3
with the H3 resolution you're interested, eg geoToH3 10
and then it starts and waits for user input for the lat and lng coordinates separated by newlines.
damocles@Talyn:~/oss/h3(master)$ ./bin/geoToH3 10
40.689167 -74.044444
8a2a1072b59ffff
^C
Like that. If you want a single command that takes all of the arguments up front, prints, and then exits, you have to type a slightly more awkward command involving echo and a pipe.
damocles@Talyn:~/oss/h3(master)$ echo "40.689167 -74.044444" | ./bin/geoToH3 10
8a2a1072b59ffff
from h3.
Ahh ok. I see. I just assumed it was a one liner.
Assuming it was built this way for performance reasons? That its faster to just throw a bunch of pairs on to stdin
than have separate calls?
Thanks for getting back to me!
from h3.
The tool was originally built by @sahrk for debugging purposes, I believe.
We've debated switching to something like getopt but then there's a split between GNU getopt and POSIX-style where GNU does the more useful thing, but then there's issues of cross-compatibility, licensing, and the added complication of making this code have another dependency in a language that doesn't handle dependencies (at all) for you.
In the end, we expect most people to use the bindings in other higher-level languages (whenever they get released. Hi, @isaacbrodsky ;) ), or use the code directly in their own C/C++ project, and these command-line utilities to get very little real-world usage, so the slightly unfamiliar usage pattern was considered "okay," but not great.
from h3.
Yes, I wrote the guts of several of the applications in src/apps/filters
while debugging and testing the core C functions, and the command line argument handling in those is primitive. But I would argue in defense of the usefulness of traditional Unix command-line filters that operate on text streams. For example, to transform a text file containing a sequence of latitude/longitudes into H3 indexes is as simple as geoToH3 8 < geo.txt > h3.txt
. And the filter applications can be added to pipelines with other filters to perform more complex reference frame transformations.
from h3.
I wasn't arguing against that @sahrk ! Going with a stream-based API from the get-go let's you work around a lack of single lat, lng request with just an echo and pipe.
GNU has simply made it common practice for commands to build in support for easily doing the top N tasks a tool can be used for, so we'll probably add that support at some point.
from h3.
Thanks for providing so much context, really appreciate it!
from h3.
Related Issues (20)
- About RFC: Polyfill modes release plan HOT 1
- replace `sprintf` with `snprintf` HOT 1
- Add additional modes for polygonToCells HOT 12
- Hex (cell) ID validation HOT 3
- Fuzzer timeout on fuzzerIj: gridPathCells
- Broken Link to website docs in contributing.md
- Broken link to website in contributing docs
- Uber CLA Contact HOT 1
- Has cell_to_vertex been implemented? HOT 2
- Replace empty function parameters with `void` HOT 1
- cell_to_child_pos() version 4 of the Python API client HOT 3
- polygonToCells: validity of polygons HOT 3
- Missing library stubs MYPY HOT 2
- polygonToCells not returning all H3Cells for the bounding box containing both USA and Russia HOT 1
- Confirmation of grid algorithm HOT 3
- cellToChildren error HOT 2
- Add function for returning the H3 indices of each endpoint of a directed edge HOT 5
- Expose cellToChildrenSize in bindings HOT 1
- Getting unexpected results when converting coordinates in either direction HOT 4
- Meta: blog post has broken images HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h3.