QuadTile infrastructure.
This commit is contained in:
parent
285d61bf4c
commit
33a65a90c9
7 changed files with 202 additions and 0 deletions
4
db/functions/Makefile
Normal file
4
db/functions/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
|||
QTDIR=../../lib/quad_tile
|
||||
|
||||
libquadtile.so: quadtile.c ${QTDIR}/quad_tile.h
|
||||
cc `mysql_config --include` -I${QTDIR} -fPIC -O3 -shared -o libquadtile.so quadtile.c
|
31
db/functions/quadtile.c
Normal file
31
db/functions/quadtile.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
#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 lon = *(long long *)args->args[0];
|
||||
long long lat = *(long long *)args->args[1];
|
||||
|
||||
return xy2tile(lon2x(lon / 1000000.0), lat2y(lat / 1000000.0));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue