C library implementation

115 views
Skip to first unread message

Joshua Saxby

unread,
May 5, 2017, 3:37:42 PM5/5/17
to open-location-code
Greetings, fellow open location code enthusiasts!

I have a keen interest in creating an implementation of this system in C.

I wanted to let you folks on here know, in case anyone else was already making one for C, I wouldn't want to step on anyone's toes. I haven't found any C implementations so far.

Also, is there a recommended interface that libraries implementing this system should follow? I could not see anything of the sort at openlocationcode.com

Regards,

J.S.

Doug Rinckes

unread,
May 8, 2017, 7:33:50 AM5/8/17
to Joshua Saxby, open-location-code
Hi Joshua,

Cool - I don't know of a C version in progress, so that would be great!

As a starting point, you could take the C++ implementation and use that interface, or if you're intending to be more focused towards static methods, you could replicate one of the other languages (like JS). Just make sure you have a test harness so you can tell when it works. ;-)

If you want to do it under your own github project, that's perfectly ok, we can provide a link to it. Otherwise you'll need to sign the Google CLA (see CONTRIBUTING.mdhttps://github.com/google/open-location-code/blob/master/CONTRIBUTING.md
).

 


Doug Rinckes, Technical Program Manager, Google Switzerland GmbH; 9GHJ+P88 Zürich


--
Public site: http://www.openlocationcode.com/
Github project: https://github.com/google/open-location-code
Demo site: http://plus.codes/
---
You received this message because you are subscribed to the Google Groups "open-location-code" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-location-code+unsub...@googlegroups.com.
To post to this group, send an email to open-location-code@googlegroups.com.
Visit this group at https://groups.google.com/group/open-location-code.
To view this discussion on the web, visit https://groups.google.com/d/msgid/open-location-code/8e882c62-fbb6-42de-966d-e433f677d6b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joshua Saxby

unread,
May 8, 2017, 3:30:26 PM5/8/17
to Doug Rinckes, open-location-code

Thanks Doug!

On reflection, I should have more thoroughly looked at the project's site, as I later found the list of required methods that conforming implementations should support. Thanks for referencing the C++ implementation —I had initially considered creating a C version as a wrapper around that but I think I will decide against this due to various caveats that would produce (void pointers to C++ objects, reliance on a C++ compiler). It is definitely helpful reference material though :) I think I'll have a look at implementations in the various languages I'm most familiar with and use their interpretations and the aforementioned required methods list as a guide for designing the API of any library that I produce.

I'll probably opt to put it on my own Github repo. Once I get the time, I'll have a go at building it and if I am successful will make the project public and let you know so you may link to it if you find what I've built helpful.

Best,

J.S.

My PGP Public Key Identity
pub   4096R/B7A947E4  [expires: ]
      Key fingerprint = E2C4 514F F0FA 52D1 896A  B1D6 3D42 BFD9 B7A9 47E4
uid   Joshua Saxby joshua.a.saxby+UMvL...@gmail.com
uid   Joshua Saxby (saxbophone) joshua....@gmail.com
sub   4096R/0A445946 2016-11-16 [expires: ]

0xB7A947E4.asc
signature.asc

Doug Rinckes

unread,
May 9, 2017, 3:32:03 AM5/9/17
to Joshua Saxby, open-location-code
No worries! Let us know if you run into any problems!


Doug Rinckes, Technical Program Manager, Google Switzerland GmbH; 9GHJ+P88 Zürich

On Mon, May 8, 2017 at 9:30 PM, Joshua Saxby <joshua....@gmail.com> wrote:

Thanks Doug!

On reflection, I should have more thoroughly looked at the project's site, as I later found the list of required methods that conforming implementations should support. Thanks for referencing the C++ implementation —I had initially considered creating a C version as a wrapper around that but I think I will decide against this due to various caveats that would produce (void pointers to C++ objects, reliance on a C++ compiler). It is definitely helpful reference material though :) I think I'll have a look at implementations in the various languages I'm most familiar with and use their interpretations and the aforementioned required methods list as a guide for designing the API of any library that I produce.

I'll probably opt to put it on my own Github repo. Once I get the time, I'll have a go at building it and if I am successful will make the project public and let you know so you may link to it if you find what I've built helpful.

Best,

J.S.

My PGP Public Key Identity
pub   4096R/B7A947E4  [expires: ]
      Key fingerprint = E2C4 514F F0FA 52D1 896A  B1D6 3D42 BFD9 B7A9 47E4
uid   Joshua Saxby (saxbophone) joshua....@gmail.com
sub   4096R/0A445946 2016-11-16 [expires: ]
On 08/05/17 12:33, Doug Rinckes wrote:
Hi Joshua,

Cool - I don't know of a C version in progress, so that would be great!

As a starting point, you could take the C++ implementation and use that interface, or if you're intending to be more focused towards static methods, you could replicate one of the other languages (like JS). Just make sure you have a test harness so you can tell when it works. ;-)

If you want to do it under your own github project, that's perfectly ok, we can provide a link to it. Otherwise you'll need to sign the Google CLA (see CONTRIBUTING.mdhttps://github.com/google/open-location-code/blob/master/CONTRIBUTING.md
).

 


Doug Rinckes, Technical Program Manager, Google Switzerland GmbH; 9GHJ+P88 Zürich

On Fri, May 5, 2017 at 9:37 PM, Joshua Saxby <joshua....@gmail.com> wrote:
Greetings, fellow open location code enthusiasts!

I have a keen interest in creating an implementation of this system in C.

I wanted to let you folks on here know, in case anyone else was already making one for C, I wouldn't want to step on anyone's toes. I haven't found any C implementations so far.

Also, is there a recommended interface that libraries implementing this system should follow? I could not see anything of the sort at openlocationcode.com

Regards,

J.S.

--
Public site: http://www.openlocationcode.com/
Github project: https://github.com/google/open-location-code
Demo site: http://plus.codes/
---
You received this message because you are subscribed to the Google Groups "open-location-code" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-location-code+unsubscribe@googlegroups.com.

Shawn K. Quinn

unread,
May 9, 2017, 3:42:46 AM5/9/17
to open-loca...@googlegroups.com
On 05/05/2017 02:37 PM, Joshua Saxby wrote:
> Greetings, fellow open location code enthusiasts!
>
> I have a keen interest in creating an implementation of this system
> in C.
>
> I wanted to let you folks on here know, in case anyone else was
> already making one for C, I wouldn't want to step on anyone's toes. I
> haven't found any C implementations so far.

We seem to be missing a simple command line encoding/decoding tool, such
that I can run something like "olcdecode 76X6PGRQ+FQ" (or something
similar for a truncated code with a trailing latitude/longitude pair)
and get back the appropriate latitude/longitude of at least the center
if not the full bounding box, and something similar for the likes of
"olcencode 29.74124 -95.46061". Given that most of Unix and other
operating systems these days is written in C, it makes most sense to do
this as part of a C implementation.

Or do we actually have this already, and maybe I have just missed it?

--
Shawn K. Quinn <skq...@rushpost.com>
http://www.rantroulette.com
http://www.skqrecordquest.com

Joshua Saxby

unread,
Oct 18, 2018, 3:50:32 PM10/18/18
to Plus Codes Community Forum
Dear all,

Apologies for the lack of any communications from me on this topic —a lot has happened in the interval, including me quitting my job and enrolling at university!

I hope to get started on a C implementation of OLC very soon, assuming noöne else has already started doing so.

Regarding Shawn K. Quinn's suggestion that a command-line utility be bundled with a C library, it's an interesting idea —I think I'd like to focus primarily on getting a library produced first. There is no reason then that a future command-line program can be produced which uses that library. C is after all still the common-denominator of most systems so having a library (and CLI) available in that language will surely be useful!

Best Regards,

J.S.

Joshua Saxby

unread,
Oct 18, 2018, 3:55:38 PM10/18/18
to Plus Codes Community Forum
Never mind, I've just seen this thread (https://groups.google.com/forum/#!topic/open-location-code/U8IvkYy8dFg) explaining that someone else has produced a C implementation!

Joshua Saxby

unread,
Oct 18, 2018, 3:56:58 PM10/18/18
to Plus Codes Community Forum
Shawn, if you're still in need of a command-line tool for working with OLC, then I might take a crack at that one!


On Tuesday, 9 May 2017 08:42:46 UTC+1, Shawn K. Quinn wrote:

Gonzalo Diethelm

unread,
Nov 1, 2018, 3:15:12 AM11/1/18
to Plus Codes Community Forum
Hi Joshua,

You are right, I finally got off my ass and sent the PR to merge my C implementation (which was merged yesterday). I do remember I saw your posts when I was looking to see if someone had already started work on such a thing. Anyway, I am sorry if you were already working on this and somehow got "trumped" (he) by me.

I hope the C implementation turns out to be useful. I intend to use it myself in at least one other project.

Cheers,
Gonzalo

Joshua Saxby

unread,
Nov 1, 2018, 3:57:18 AM11/1/18
to open-loca...@googlegroups.com

Hi Gonzalo,

Anyway, I am sorry if you were already working on this and somehow got "trumped" (he) by me.
Don't worry, there's nothing you need to apologise for. I had only got as far as writing headers for the functions of my version, before I had to put the project on hiatus big-time to focus on more immediate goals (I was in a job that wasn't working for me at the time, now I'm studying at University!). It was a pleasant surprise to see that someone had realised the work I intended to do in the time being, great job!

I hope the C implementation turns out to be useful. I intend to use it myself in at least one other project.

I'm sure it will be, see my comments about a possible command-line open location code utility, written in C. I'm sure it'd be much easier to do it in C++, but given C's portability (and I don't think such a program needs the extra features of C++ to be honest) and that it's been asked for by someone else, this might be something I have a look at if I get time to do it.

Best of luck with your project!

Best Regards,

J.S.

My PGP Public Key Identity
pub   4096R/B7A947E4  [expires: ]
      Key fingerprint = E2C4 514F F0FA 52D1 896A  B1D6 3D42 BFD9 B7A9 47E4
uid   Joshua Saxby joshua.a.saxby+UMvL...@gmail.com
uid   Joshua Saxby (saxbophone) joshua....@gmail.com
sub   4096R/0A445946 2016-11-16 [expires: ]

--
You received this message because you are subscribed to a topic in the Google Groups "Plus Codes Community Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/open-location-code/Q5HSbU5pceY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to open-location-c...@googlegroups.com.
To post to this group, send email to open-loca...@googlegroups.com.
signature.asc
Reply all
Reply to author
Forward
0 new messages