- coords 추가 이유 : 가장 가까운 정류소를 찾기 위해 ST_DISTANCE_SPHERE() 함수를 이용하는데, 이 함수는 공간좌표 point(x,y) 로만 작동 가능함.
라이센스 : 상업적 이용, 콘텐츠 변경 허용
위도, 경도 줬을때 제일 가까운 5정류장 반환하는 api (JSON)
쿼리문
$sql = "SELECT *, ST_DISTANCE_SPHERE(POINT({$now_lng},{$now_lat}), coords) AS dist from bus_stop order by dist limit 5;";
api 문서
명지대학교 위도, 경도 입력했을 때(37.2217444,127.184463)의 예시 결과값
사용자 정보, 정류장 정보 받아서 대기열에 등록/제거하는 api
쿼리문
if($do_what==1){
echo $stop_id, $do_what, $username, $ko_name, $with_wheel;
$sql="INSERT INTO utilizing(stop_id,user_id,ko_name,with_wheel) VALUES ($stop_id,'$username','$ko_name',$with_wheel);";
}
else if($do_what==0){
$sql="DELETE FROM utilizing WHERE user_id=\"".$username."\";";
}
api 문서
다음 정류장 stop_id 입력 시 그 정류장의 일반인, 장애인 명수를 반환하는 api (JSON)
쿼리문
$sql = "SELECT count(*) as cnt, count(with_wheel) as wheel from utilizing where stop_id=".$stop_id.";";
api 문서
사용 예시(http://ec2-52-193-213-157.ap-northeast-1.compute.amazonaws.com/driver/index.php?stop_id=888888999)
db 확인 ( dummy 값 생성 )