Code Monkey home page Code Monkey logo

Comments (6)

dfellis avatar dfellis commented on August 17, 2024

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.

thomasgwatson avatar thomasgwatson commented on August 17, 2024

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.

dfellis avatar dfellis commented on August 17, 2024

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.

sahrk avatar sahrk commented on August 17, 2024

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.

dfellis avatar dfellis commented on August 17, 2024

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.

thomasgwatson avatar thomasgwatson commented on August 17, 2024

Thanks for providing so much context, really appreciate it!

from h3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.