Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Enumerations | Functions
geo.h File Reference
#include "groonga_in.h"
#include "ii.h"
#include "db.h"
#include <math.h>
Include dependency graph for geo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  grn_geo_cursor_entry
struct  grn_geo_cursor_in_rectangle

Macros

#define GRN_GEO_RESOLUTION   3600000
#define GRN_GEO_RADIUS   6357303
#define GRN_GEO_BES_C1   6334834
#define GRN_GEO_BES_C2   6377397
#define GRN_GEO_BES_C3   0.006674
#define GRN_GEO_GRS_C1   6335439
#define GRN_GEO_GRS_C2   6378137
#define GRN_GEO_GRS_C3   0.006694
#define GRN_GEO_INT2RAD(x)   ((M_PI / (GRN_GEO_RESOLUTION * 180)) * (x))
#define GRN_GEO_RAD2INT(x)   ((int)(((GRN_GEO_RESOLUTION * 180) / M_PI) * (x)))
#define GRN_GEO_MAX_LATITUDE   324000000 /* 90 * 60 * 60 * 1000 */
#define GRN_GEO_MAX_LONGITUDE   648000000 /* 180 * 60 * 60 * 1000 */
#define GRN_GEO_POINT_VALUE_RAW(obj)   (grn_geo_point *)GRN_BULK_HEAD(obj)
#define GRN_GEO_POINT_VALUE_RADIUS(obj, _latitude, _longitude)
#define GRN_GEO_KEY_MAX_BITS   64

Enumerations

enum  grn_geo_approximate_type { GRN_GEO_APPROXIMATE_RECTANGLE, GRN_GEO_APPROXIMATE_SPHERE, GRN_GEO_APPROXIMATE_ELLIPSOID }
enum  grn_geo_cursor_entry_status_flag {
  GRN_GEO_CURSOR_ENTRY_STATUS_NONE = 0, GRN_GEO_CURSOR_ENTRY_STATUS_TOP_INCLUDED = 1 << 0, GRN_GEO_CURSOR_ENTRY_STATUS_BOTTOM_INCLUDED = 1 << 1, GRN_GEO_CURSOR_ENTRY_STATUS_LEFT_INCLUDED = 1 << 2,
  GRN_GEO_CURSOR_ENTRY_STATUS_RIGHT_INCLUDED = 1 << 3, GRN_GEO_CURSOR_ENTRY_STATUS_LATITUDE_INNER = 1 << 4, GRN_GEO_CURSOR_ENTRY_STATUS_LONGITUDE_INNER = 1 << 5
}

Functions

grn_rc grn_geo_cursor_close (grn_ctx *ctx, grn_obj *geo_cursor)
int grn_geo_table_sort (grn_ctx *ctx, grn_obj *table, int offset, int limit, grn_obj *result, grn_table_sort_key *keys, int n_keys)
grn_rc grn_geo_resolve_approximate_type (grn_ctx *ctx, grn_obj *type_name, grn_geo_approximate_type *type)
grn_rc grn_geo_select_in_circle (grn_ctx *ctx, grn_obj *index, grn_obj *center_point, grn_obj *distance, grn_geo_approximate_type approximate_type, grn_obj *res, grn_operator op)
grn_rc grn_selector_geo_in_circle (grn_ctx *ctx, grn_obj *table, grn_obj *index, int nargs, grn_obj **args, grn_obj *res, grn_operator op)
grn_rc grn_selector_geo_in_rectangle (grn_ctx *ctx, grn_obj *table, grn_obj *index, int nargs, grn_obj **args, grn_obj *res, grn_operator op)
GRN_API grn_bool grn_geo_in_circle (grn_ctx *ctx, grn_obj *point, grn_obj *center, grn_obj *radius_or_point, grn_geo_approximate_type approximate_type)
GRN_API grn_bool grn_geo_in_rectangle (grn_ctx *ctx, grn_obj *point, grn_obj *top_left, grn_obj *bottom_right)
grn_bool grn_geo_in_rectangle_raw (grn_ctx *ctx, grn_geo_point *point, grn_geo_point *top_left, grn_geo_point *bottom_right)
double grn_geo_distance (grn_ctx *ctx, grn_obj *point1, grn_obj *point2, grn_geo_approximate_type type)
GRN_API double grn_geo_distance_rectangle (grn_ctx *ctx, grn_obj *point1, grn_obj *point2)
GRN_API double grn_geo_distance_sphere (grn_ctx *ctx, grn_obj *point1, grn_obj *point2)
GRN_API double grn_geo_distance_ellipsoid (grn_ctx *ctx, grn_obj *point1, grn_obj *point2)
double grn_geo_distance_rectangle_raw (grn_ctx *ctx, grn_geo_point *point1, grn_geo_point *point2)
double grn_geo_distance_sphere_raw (grn_ctx *ctx, grn_geo_point *point1, grn_geo_point *point2)
double grn_geo_distance_ellipsoid_raw (grn_ctx *ctx, grn_geo_point *point1, grn_geo_point *point2, int c1, int c2, double c3)
double grn_geo_distance_ellipsoid_raw_tokyo (grn_ctx *ctx, grn_geo_point *point1, grn_geo_point *point2)
double grn_geo_distance_ellipsoid_raw_wgs84 (grn_ctx *ctx, grn_geo_point *point1, grn_geo_point *point2)

Macro Definition Documentation

#define GRN_GEO_BES_C1   6334834

Definition at line 38 of file geo.h.

#define GRN_GEO_BES_C2   6377397

Definition at line 39 of file geo.h.

#define GRN_GEO_BES_C3   0.006674

Definition at line 40 of file geo.h.

#define GRN_GEO_GRS_C1   6335439

Definition at line 41 of file geo.h.

#define GRN_GEO_GRS_C2   6378137

Definition at line 42 of file geo.h.

#define GRN_GEO_GRS_C3   0.006694

Definition at line 43 of file geo.h.

#define GRN_GEO_INT2RAD (   x)    ((M_PI / (GRN_GEO_RESOLUTION * 180)) * (x))

Definition at line 44 of file geo.h.

#define GRN_GEO_KEY_MAX_BITS   64

Definition at line 57 of file geo.h.

#define GRN_GEO_MAX_LATITUDE   324000000 /* 90 * 60 * 60 * 1000 */

Definition at line 47 of file geo.h.

#define GRN_GEO_MAX_LONGITUDE   648000000 /* 180 * 60 * 60 * 1000 */

Definition at line 48 of file geo.h.

#define GRN_GEO_POINT_VALUE_RADIUS (   obj,
  _latitude,
  _longitude 
)
Value:
do {\
_latitude = GRN_GEO_INT2RAD(_val->latitude);\
_longitude = GRN_GEO_INT2RAD(_val->longitude);\
} while (0)

Definition at line 51 of file geo.h.

#define GRN_GEO_POINT_VALUE_RAW (   obj)    (grn_geo_point *)GRN_BULK_HEAD(obj)

Definition at line 50 of file geo.h.

#define GRN_GEO_RAD2INT (   x)    ((int)(((GRN_GEO_RESOLUTION * 180) / M_PI) * (x)))

Definition at line 45 of file geo.h.

#define GRN_GEO_RADIUS   6357303

Definition at line 37 of file geo.h.

#define GRN_GEO_RESOLUTION   3600000

Definition at line 36 of file geo.h.

Enumeration Type Documentation

Enumerator:
GRN_GEO_APPROXIMATE_RECTANGLE 
GRN_GEO_APPROXIMATE_SPHERE 
GRN_GEO_APPROXIMATE_ELLIPSOID 

Definition at line 59 of file geo.h.

Enumerator:
GRN_GEO_CURSOR_ENTRY_STATUS_NONE 
GRN_GEO_CURSOR_ENTRY_STATUS_TOP_INCLUDED 
GRN_GEO_CURSOR_ENTRY_STATUS_BOTTOM_INCLUDED 
GRN_GEO_CURSOR_ENTRY_STATUS_LEFT_INCLUDED 
GRN_GEO_CURSOR_ENTRY_STATUS_RIGHT_INCLUDED 
GRN_GEO_CURSOR_ENTRY_STATUS_LATITUDE_INNER 
GRN_GEO_CURSOR_ENTRY_STATUS_LONGITUDE_INNER 

Definition at line 65 of file geo.h.

Function Documentation

grn_rc grn_geo_cursor_close ( grn_ctx ctx,
grn_obj geo_cursor 
)

Definition at line 1660 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double grn_geo_distance ( grn_ctx ctx,
grn_obj point1,
grn_obj point2,
grn_geo_approximate_type  type 
)

Definition at line 2282 of file geo.c.

Here is the call graph for this function:

GRN_API double grn_geo_distance_ellipsoid ( grn_ctx ctx,
grn_obj point1,
grn_obj point2 
)

Definition at line 2381 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double grn_geo_distance_ellipsoid_raw ( grn_ctx ctx,
grn_geo_point point1,
grn_geo_point point2,
int  c1,
int  c2,
double  c3 
)

Definition at line 2239 of file geo.c.

Here is the caller graph for this function:

double grn_geo_distance_ellipsoid_raw_tokyo ( grn_ctx ctx,
grn_geo_point point1,
grn_geo_point point2 
)

Definition at line 2260 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double grn_geo_distance_ellipsoid_raw_wgs84 ( grn_ctx ctx,
grn_geo_point point1,
grn_geo_point point2 
)

Definition at line 2271 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

GRN_API double grn_geo_distance_rectangle ( grn_ctx ctx,
grn_obj point1,
grn_obj point2 
)

Definition at line 2305 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double grn_geo_distance_rectangle_raw ( grn_ctx ctx,
grn_geo_point point1,
grn_geo_point point2 
)

Definition at line 2189 of file geo.c.

Here is the caller graph for this function:

GRN_API double grn_geo_distance_sphere ( grn_ctx ctx,
grn_obj point1,
grn_obj point2 
)

Definition at line 2354 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double grn_geo_distance_sphere_raw ( grn_ctx ctx,
grn_geo_point point1,
grn_geo_point point2 
)

Definition at line 2224 of file geo.c.

Here is the caller graph for this function:

GRN_API grn_bool grn_geo_in_circle ( grn_ctx ctx,
grn_obj point,
grn_obj center,
grn_obj radius_or_point,
grn_geo_approximate_type  approximate_type 
)

Definition at line 1814 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

GRN_API grn_bool grn_geo_in_rectangle ( grn_ctx ctx,
grn_obj point,
grn_obj top_left,
grn_obj bottom_right 
)

Definition at line 1892 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_bool grn_geo_in_rectangle_raw ( grn_ctx ctx,
grn_geo_point point,
grn_geo_point top_left,
grn_geo_point bottom_right 
)

Definition at line 1882 of file geo.c.

Here is the caller graph for this function:

grn_rc grn_geo_resolve_approximate_type ( grn_ctx ctx,
grn_obj type_name,
grn_geo_approximate_type type 
)

Definition at line 717 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_geo_select_in_circle ( grn_ctx ctx,
grn_obj index,
grn_obj center_point,
grn_obj distance,
grn_geo_approximate_type  approximate_type,
grn_obj res,
grn_operator  op 
)

grn_geo_select_in_circle: : the index column for TokyoGeoPoint or WGS84GeoPpoint type. : the center point of the target circle. (ShortText, Text, LongText, TokyoGeoPoint or WGS84GeoPoint) : the radius of the target circle (Int32, UInt32, Int64, UInt64 or Float) or the point on the circumference of the target circle. (ShortText, Text, LongText, TokyoGeoPoint or WGS84GeoPoint) : the approximate type to compute distance. : the table to store found record IDs. It must be GRN_TABLE_HASH_KEY type table. : the operator for matched records.

It selects records that are in the circle specified by and from . Records are searched by . Found records are added to table with operation.

Definition at line 828 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int grn_geo_table_sort ( grn_ctx ctx,
grn_obj table,
int  offset,
int  limit,
grn_obj result,
grn_table_sort_key keys,
int  n_keys 
)

Definition at line 673 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_selector_geo_in_circle ( grn_ctx ctx,
grn_obj table,
grn_obj index,
int  nargs,
grn_obj **  args,
grn_obj res,
grn_operator  op 
)

Definition at line 757 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_selector_geo_in_rectangle ( grn_ctx ctx,
grn_obj table,
grn_obj index,
int  nargs,
grn_obj **  args,
grn_obj res,
grn_operator  op 
)

Definition at line 980 of file geo.c.

Here is the call graph for this function:

Here is the caller graph for this function: