I can not apply the intersection operation in mongo from php7

1

this is my code:

<?php
try {
    $manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");

    $condition = [
            'unidad'=>['$geoIntersects' => [
                    '$geometry' => [
                        'type' => 'Polygon',
                        'coordinates' => [[[
[-98.27142678510961, 19.065411169759553],[-98.27401243459997, 19.058515609136986],
[-98.26613746893224, 19.05861701651765],[-98.26611601126012, 19.066404918088853],
[-98.27142678510961, 19.065411169759553]
                                         ]]]


                       ]
                    ]
                ]
           ] ;

$option=['_id'=>'1'];
        $query = new MongoDB\Driver\Query($condition,$option);  
    $cursor = $manager->executeQuery("geom.Taxis", $query);

  if(!empty($cursor)){
    foreach($cursor as $document) {
        echo "id_Taxi: $document->id_Taxi name: $document->name<br>";
    }
     }
  else{
  echo"no hay ninguna ruta dentro de la zona de seguridad";
   }

} catch (MongoDB\Driver\Exception\Exception $e) {

    $filename = basename(__FILE__);

    echo "The $filename script has experienced an error.\n"; 
    echo "It failed with the following exception:\n";

    echo "Exception:", $e->getMessage(), "\n";
    echo "In file:", $e->getFile(), "\n";
    echo "On line:", $e->getLine(), "\n";       
}


?>

and it gives me the following error:

  

The Interseccion_Mongo.php script has experienced an error. It failed   with the following exception: Exception: Point must only contain   numeric elements In file: /var/www/html/Mongo/Interseccion_Mongo.php On   line: 23

    
asked by Fernando Betanzos 24.10.2018 в 05:22
source

0 answers