Page 1 of 1

Querying a DB for geopoint data

Posted: Mon Jan 19, 2015 5:00 pm
by Ben Walker

What I am trying to do, broadly, is delete geopoint A from a DB collection of geopoints if the app user is at geopoint A.

My approach:
Use geolocation service to store user's lat and lng in local storage
Use lat and lng from local storage to feed a query of the DB and return the _id of the geopoint they are at (if it matches one in the DB)
Use the _id to delete the geopoint via a delete service.

My problem is with the DB query service. I can query the DB for strings, but I don't know how to query using geopoint data.

Anyone have any pointers please?
Thanks


Querying a DB for geopoint data

Posted: Mon Jan 19, 2015 5:34 pm
by Evgene Karachevtsev

Hello Ben,

Could you please look at these links, hope the info there will be useful for you:
https://getsatisfaction.com/apperyio/...
https://getsatisfaction.com/apperyio/...
https://getsatisfaction.com/apperyio/...


Querying a DB for geopoint data

Posted: Mon Jan 19, 2015 8:04 pm
by Ben Walker

Hi thanks but I think those are too advanced - I just want to know if it's possible to query a DB, searching for gepoint data and returning corresponding data.

I know how to search for a string and return other data, but using the same approach doesn't seem to work for gepoints?


Querying a DB for geopoint data

Posted: Wed Jan 21, 2015 11:44 am
by Ihor Didevych

Hi Ben,

You can search for geopoint with query service parameter same as other.
Your problem based on passing value to compare and search.
Sometimes geoservice can send value like 42.23314133333 , where the last four '3' are not used in the targeting, but this number can be different to 42.223141 , so try to use at least sphere with value 1 or other small value to recognize your user's position.