Tag Info

New answers tagged

2

The actual answer is a mixture of the other answers/comments you've already received. MySQL is limited I see from the tags you're using MySQL, the problem is, it can only do bounding boxes until 5.6, not the actual geometries. http://dev.mysql.com/doc/refman/5.0/en/spatial-relation-functions.html If you want to use the bounding box: SELECT * FROM `test` ...


2

From the longitude and latitude coordinates, you can create spatial structures (Points) in your (spatial) database, like PostGIS. (see ST_GeomFromText) Instead of your bussId | longitude | latitude, you would have a bussId, Point database called BussSpatial. You can then just query the following var request = 'SELECT bussID FROM BussSpatial ...


1

The bounding box query for SQL is(Using PDO) $sql ="SELECT bussid FROM tablename WHERE(latitude BETWEEN ? AND ? )AND (longitude BETWEEN ? AND ?)"; $stmt = $dbh->prepare($sql); // Assign parameters $stmt->bindParam(1,$minLat); $stmt->bindParam(2,$maxLat); $stmt->bindParam(3,$minLng); $stmt->bindParam(4,$maxLng); WHERE parameters come from ...



Top 50 recent answers are included