This sample shows how to use solidDB geohash functionality. For more information about the geohash functions, see solidDB geohash functions.
The files for the sample are located in the soliddb-installdir\samples\geohash directory. For general information about running the samples, see Samples.
The sample consists of two applications and an SQL script:
▪ geohash.c: an ODBC application that performs the following steps:
– connects to a server,
– creates a table with columns for longitude, latitude, and geohash,
– creates an index on the geohash column,
– inserts pairs of longitude and latitude points into the table and calculates the geohash values for each pair,
– searches the table first with and then without an index.
▪ geohash.sql: an SQL script that performs the following steps:
– creates a table,
– creates an index on the geohash column (to speed up searches),
– inserts the longitude and latitude values for some cities and calculates geohash values for the cities,
– finds cities inside a specified geohash boundary,
– finds all the geohash blocks within a specified area,
– finds all the cities in a specified geohash block,
– find the co-ordinates of the edges and center of a specified geohash block.
▪ sageohash.c: an SA application that performs the following steps:
– finds the boundary of a given geohash and the boundary of the neighborhood for the geohash,
– lists each of the neigbors of a given geohash and all the geohashes in the neighborhood,
– lists all the geohash blocks within a boundary that is defined by lines of longitude and latitude.
Note You do not need to connect to a solidDB server to run this application.
Running the sample
Run the runme script (runme.bat in Windows), which compiles the applications, starts a server, runs the first application and the SQL script, stops the server, and runs the second application.