create user defined function in sqlite android? -
create user defined function in sqlite android? -
i developing 1 application need create sqlite function distance, have 2 fields latitude , longitude in database, , want find near locations using function, have developed application in iphone, have implemented functionality using sqlite3_create_function
calling callback function, give me distance.
but problem is: can not able create function in sqlite using android, know improve way nearby locations sqlite using android?
the other problem sqlite not back upwards sin, cosine functions calculate distance between points.
hello jignesh,
in view, there 2 solutions problem.
1. utilize javascript perform functionscreate necessary functions in javascript , utilize result update/query sqlite.
javascript suited trigonometry; sine, cosine , tangent. javascript can calculate advanced mathematical problems extremely fast.
example: calculating reply next problem
the sum of squares of first 10 natural numbers is, 1^2 + 2^2 +... + 10^2 = 385. square of sum of first 10 natural numbers is, (1 + 2 + ... + >10)^2 = 55^2 = 3025. hence difference between sum of squares of first 10 >natural numbers , square of sum 3025 – 385 = 2640. find difference >between sum of squares of first 1 hundred natural numbers , square of >the sum.
function problem_6() { "use strict"; var = 1, ns = 0, sqs = 0; { ns += i; sqs += * i; += 1; } while (i <= 100); homecoming ns * ns - sqs; }
answer: 25164150
this illustration rolando garza’s el blog de rolandog, based on own extension javascript’s global math object; math.js.
references:
mozilla’s javascript references global math object:
trigonometry—sine, cosine , tangent javascript, jj gifford.
2. geonames databasegeonames open source database on geographical info countries, cities, , villages in world, including latitude , longitude distances other geo-locations.
geonames available both webservice through json api, , downloadable tables.
2.1 query geonames through json apiexample: finding nearest intersection given latitude/longitude
http://api.geonames.org/findnearestintersectionosmjson?lat=37.451&lng=-122.18&username=demo
{"intersection":{"street2":"curtis street","street1":"roble avenue","distance":"0.08","highway2":"residential","highway1":"residential","lng":"-122.1808166","lat":"37.4506308"}}
store required geo-information locally in sqlite.
more information: http://www.geonames.org/
android sqlite
Comments
Post a Comment