--- /dev/null
+#define _GNU_SOURCE
+
+#include <math.h>
+#include <glib.h>
+
+#include "osm.h"
+
+/* Int ranges for integerized lat/lon */
+#define LATLON_MAX 2147483646
+#define LATLON_MIN -2147483646
+
+/* Convert latitude to integerized+mercator projected value */
+gint32
+lat2mp_int(gdouble lat)
+{
+return lat > 85.051128779 ? LATLON_MAX : lat < -85.051128779 ? LATLON_MIN :
+ lrint(log(tan(M_PI_4l+lat*M_PIl/360))/M_PIl*LATLON_MAX);
+}
+
+/* Convert longitude to integerized+mercator projected value */
+gint32
+lon2mp_int(gdouble lon)
+{
+return lrint(lon/180*LATLON_MAX);
+}
+