openstreetmap-website/db/functions/quadtile.c
Tom Hughes 9afb35449b Change the gps_points table to store latitude and longitude values to
seven decimal places to given a worse case precision of about 1cm.
2007-09-18 23:29:47 +00:00

31 lines
734 B
C

#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <quad_tile.h>
my_bool tile_for_point_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if ( args->arg_count != 2 ||
args->arg_type[0] != INT_RESULT ||
args->arg_type[1] != INT_RESULT )
{
strcpy( message, "Your tile_for_point arguments are bogus!" );
return 1;
}
return 0;
}
void tile_for_point_deinit(UDF_INIT *initid)
{
return;
}
long long tile_for_point(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
long long lat = *(long long *)args->args[0];
long long lon = *(long long *)args->args[1];
return xy2tile(lon2x(lon / 10000000.0), lat2y(lat / 10000000.0));
}