Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-j 51
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-j 51
22_23-j 51
Commits
2a241981
Commit
2a241981
authored
Apr 07, 2023
by
Hasith Yoman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distance calculation changes
parent
21c8ce93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
fuel-sliit-bakend-main/app/Http/Controllers/StationController.php
...it-bakend-main/app/Http/Controllers/StationController.php
+11
-0
No files found.
fuel-sliit-bakend-main/app/Http/Controllers/StationController.php
View file @
2a241981
...
...
@@ -31,6 +31,17 @@ class StationController extends Controller
}
return
response
()
->
json
([
'respond'
=>
$respond
,
'count'
=>
$queue
]);
}
public
function
getAPIDistance
(
$point1
,
$point2
){
$key
=
"AIzaSyAqCHZnyToOOkw4fiumXxC5oTEaEVAIISA"
;
$response
=
Http
::
get
(
'https://maps.googleapis.com/maps/api/directions/json?origin='
.
$point1
.
'&destination='
.
$point2
.
'&key='
.
$key
);
if
(
$response
->
ok
())
{
$data
=
$response
->
json
();
return
$data
[
'routes'
][
0
][
'legs'
][
0
][
'distance'
][
'text'
];
}
else
{
return
"not calculated"
;
}
}
// calculate distance
public
function
calculateDistance
(
$lat1
,
$lon1
,
$lat2
,
$lon2
)
{
$theta
=
$lon1
-
$lon2
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment