diff options
Diffstat (limited to 'gpsclient.c')
-rw-r--r-- | gpsclient.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gpsclient.c b/gpsclient.c index f32b8af6..85269688 100644 --- a/gpsclient.c +++ b/gpsclient.c @@ -49,6 +49,18 @@ gpsclient_wgs84_separation(PyObject *self, PyObject *args) return Py_BuildValue("d", sep); } +static PyObject * +gpsclient_maidenhead(PyObject *self, PyObject *args) +{ + const double lat, lon; + char *gs; + + if (!PyArg_ParseTuple(args, "dd", &lat, &lon)) + return NULL; + gs = maidenhead(lat, lon); + return Py_BuildValue("s", gs); +} + /* List of functions defined in the module */ static PyMethodDef gpsclient_methods[] = { @@ -58,6 +70,8 @@ static PyMethodDef gpsclient_methods[] = { PyDoc_STR("String-format a latitude/longitude.")}, {"gpsd_units", gpsclient_gpsd_units, METH_VARARGS, PyDoc_STR("Deduce a set of units from locale and environment.")}, + {"maidenhead", gpsclient_maidenhead, METH_VARARGS, + PyDoc_STR("Maidenhead grid-square locator from lat/lon.")}, {NULL, NULL} /* sentinel */ }; |