7 tile_for_point(PG_FUNCTION_ARGS)
9 double lat = PG_GETARG_INT32(0) / 10000000.0;
10 double lon = PG_GETARG_INT32(1) / 10000000.0;
12 PG_RETURN_INT64(xy2tile(lon2x(lon), lat2y(lat)));
15 PG_FUNCTION_INFO_V1(tile_for_point);
18 * To bind this into PGSQL, try something like:
20 * CREATE FUNCTION tile_for_point(int4, int4) RETURNS int8
21 * AS '/path/to/rails-port/db/functions/libpgosm', 'tile_for_point'
24 * (without all the *s)
27 #ifdef PG_MODULE_MAGIC