I have given query for node and want to extend search by miles,
$query = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'event')
->range(0, 10);
Location coming in array format using following query (installed geolocation module) and want to record using custom query not using internal search feature
$locationInArray = $node->get('location')->getValue();
Array value are like:
lat (latitude), lng (longitude), lat_sin (precalculated latitude sine), lat_cos (precalculated latitude cosine), lng_rad (precalculated radian longitude).
I am facing problem on lat long coming from another table so how to extend above query
I need distance wise search like 2 km/miles without help of drupal module because i have already implemented that but not fulfill my all needs so want to make custom search module.
here is given distance query but i am new in drupal so please help me to integrate given query in drupal my code.
SELECT id, ( 3959 * acos ( cos ( radians(78.3232) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(65.3234) ) + sin ( radians(78.3232) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 30 ORDER BY distance LIMIT 0 , 20;
$locationInArray = $node->get('location')->getValue();
is not$locationInArray = $node->get('field_location')->getValue();
:) – zanvidmar