GIS: Need help

26 views
Skip to first unread message

Thejesh GN

unread,
Nov 2, 2012, 2:58:04 PM11/2/12
to data...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hello All,
I am working on the PostBox App. Actual end user application is online
now [ http://openbangalore.org/postbox/ ]. It gets data from Instagram.
Instagram gives me lat, long which are stored as floats in an sqlite DB
[https://bitbucket.org/thejeshgn/postbox/src/tip/db]. Now I haven't used
SQLite for GIS things in the past. So here are my questions.

1. How easy is spatialite and can it work with PHP? I will try n avoid
using it as much as possible.
2. How to get center point given a set of points?
3. How to get nearest points give a point?

Q2 and 3 become difficult if I am not using spatialite. Are there simple
solutions using just sqlite and php?

Let me know.

Thej

- --
Thejesh GN
http://thejeshgn.com
GPG ID : 0xBFFC8DD3C06DD6B0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCgAGBQJQlBe8AAoJEL/8jdPAbdawp20QAK2ZvAzaU3rAtbXYxf2KBVSq
eh3OZBChRk5fMyAMPmUkWEFIX66bEcw12QKM7gg+8+lhyQG9upVanjyLj7/KStdG
zgWERU5LJVpXShpwcaM6E4NqpcMRbdur9hxC/uZKFEXX+sdlxRre4auSWCKpEAKG
cRFBXgngX5Ibj+FhzSKXMfovZluNstDoZJ+lqBbU2u4iczcHo8Mq5VuEXy5kyjYb
3NcE0ni76M4avAU9yaNhj4i6xAK/wjZFH4/2AJgfNO/43B/6AagYGRc9r4OqtXdv
SZO4VjKHMZAVu01p2ROQbWZIo5d51oli4cpSALk2TK6q7sVMk4H8mpMgUeDGZOTo
Q+uYRIzWRtyedHT63doaOhefiY9D2xorcVknYAKazFs5R2rT2GacFpgRw3K4IF3a
FWjHQ7xmLUTrpc/Jhi8ZcTaWbkACjFwCyOQvyShD/Ec8Om5q7nmCX8PflwEAvrLA
gnicBhHz3GeSQcdrtpIbXP2FU7Et4jTDQff3r1Az63x/gg5pojQ6Pd8w66m0qzrR
HmciDioAteMDy466fB5w1Q0Ehv8IUhXWcsJC6l+pmi/WrdBoBKAj0kaA/FJzD59G
dDCbry0+C98+jvyFn68iljz42wGsusNebOzZG14nQ942tdUa9LRSxeTnA7veFPiW
srs0u/xVKnlxAhl4PA0t
=fqiL
-----END PGP SIGNATURE-----

L. Shyamal

unread,
Nov 4, 2012, 1:16:55 AM11/4/12
to data...@googlegroups.com
No knowledge of spatialite but here are some suggestions for questions 2 and 3

2) by centre you probably mean the barycenter/centre of gravity/average - which would be the point having the x as mean of the x values of the points and the y as mean of the y values of points. This would hold if you use lat - longs and there is no problem with curvature if you are working on India related data (the only tricky points would be around the polar regions). Another measure of a "centre" could be the barycenter of the points that lie on the convex hull of the set of points you have.

3) point(s) nearest to a set of points can be implemented based on the amount of data and performance required - for a large set of data the most efficient method would be to have the points in a k-d-tree structure but for a small set you could identify candidate points within a limited bounding rectangle around your search point and then search with actual distances to the reduced set of points in the box. You can search within the candidate points within the  bounding rect rapidly if you have the lat-longs sorted/indexed but the computations of distance dx*dx+dy*dy (can skip the square root since you only need to find the smallest values) will be a bit of a brute force method but could still be within performance requirements for interactions with small data sets.

best wishes
Shyamal

Shyamal Lakshminarayanan
http://muscicapa.blogspot.com
http://en.wikipedia.org/wiki/User:Shyamal


Thejesh GN

unread,
Nov 5, 2012, 12:05:26 AM11/5/12
to data...@googlegroups.com
Thanks a lot Shyamal. I will let you know once I implement them.


Thej
--
Thejesh GN | ತೇಜೇಶ್ ಜಿ.ಎನ್

http://thejeshgn.com
GPG ID :  0xBFFC8DD3C06DD6B0


On Sun, Nov 4, 2012 at 10:46 AM, L. Shyamal <lshy...@gmail.com> wrote:
Shyamal

Reply all
Reply to author
Forward
0 new messages