0

My database has a list of coordinates and I need to build an API for a mobile app, one of the methods the app will send me the current lat/long and I have to retrieve the nearby locations based on my database.

The thing is, how can I do this? I only find methods with MySQL, but it's good for performance.

I'm using PHP with Symfony2 framework.

EDIT:

I'm using MySQL, but I'll have thousands of records and I did some perfomance tests that were very slow.

MaltMaster
  • 758
  • 1
  • 10
  • 25
  • If you can find methods for MySQL but they aren't suitable, then presumably you are using a database other than MySQL … it would help if you told us which one. – Quentin Oct 04 '12 at 13:15
  • I'm using MySQL, but I'll have thousands of records there and I did some performance tests, it's not good for what I need. – MaltMaster Oct 04 '12 at 13:16

2 Answers2

1

Would it be feasible to change to use PostgreSQL instead?

I only mention it because it has the functionality that you're looking for, so would probably be far more efficient for this use case. See: geocodable behaviour for Doctrine2 (or the Propel equivalent)

RobMasters
  • 4,108
  • 2
  • 27
  • 34
  • Unfortunately I can't, the application is already running on MySQL and there is other services connecting in this database. I'm just building an API to expose these lat/long to a mobile app. – MaltMaster Oct 04 '12 at 13:36
0

If this is an option, you could use Solr and geo-spatial search. Check out http://wiki.apache.org/solr/SpatialSearch

It might seem a little bit of an overhead to setup solr and index your location database, but the performance increase of using solr instead of mysql for search operations is immense.

room13
  • 1,922
  • 1
  • 15
  • 28