Meanwhile we solved it by coding this procedure directly in php/mysql working now without problems.
But we now have some issues when we try to work with the values of the database 'events' which contains a list of events and the geo-position of the event-location. The goal is to show all events which are closer than 10 km/miles from users hometown which users can type into a form on our site:
$db= $modx->getCollection('events', array('date:>=' => $datetoday));
foreach($db as $single) {
$latitude = $einzeldaten->get('latitude');
$longitude = $einzeldaten->get('longitude');
[...] check if the location of the event is less than 10 km/miles away from the users hometown which was entered before by a form on our site. If yes put the event to a variable [...]
}
return;
The problem: Just this line takes about 7 seconds for processing:
$db= $modx->getCollection('events', array('date:>=' => $datetoday));
('events' is a database of about 980 rows and 670 kb)
I also tried to make it faster by altering the getCollection-tag into:
$db= $modx->getCollection('events');
But it was not faster and also took ~7 seconds.
Is there maybe a better way to process row by row of the whole database to find out all events which are closer than 10 km/miles to a user´s hometown?
Does anybody know this? Would be great!
Letti