Here is what I am thinking. I want to get user location using GPS. Instead of sending current position I want to calculate square km or meter.
Update
In above image the red dot is my position and I need to get the whole area in red rectangle. Get that store that in database. I looked into the Polygon area formulas but that requires several vertices, with geolocation I only get longitude and latitude just two coordinates. How am I gonna do that using these two points?
UPDATE
I found a solution here but this solution is keep tracking user's current location and in
This works perfectly fine for my second scenario but first I do not want to track user's location at first. First I simple get current user location(longitude and latitude), calculate the area from that and send it to server. Now I am not sure how am I going to achieve that. Any help?
from How to get square meter or square km using in html5 / ionic
----------------------------------
| |
| |
| |
| |
| . |
| ^ |
| My current position |
| |
| |
| |
----------------------------------
As you can see in figure above, my current position but I want to calculate the whole area around that in HTML5 or Ionic would be more preferred.Update
In above image the red dot is my position and I need to get the whole area in red rectangle. Get that store that in database. I looked into the Polygon area formulas but that requires several vertices, with geolocation I only get longitude and latitude just two coordinates. How am I gonna do that using these two points?
UPDATE
I found a solution here but this solution is keep tracking user's current location and in
calculateDistance
function the formula uses both current location (longitude and latitude) and tracking location(longitude and latitude) i.e. Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * Math.sin(dLon/2) * Math.sin(dLon/2);
This works perfectly fine for my second scenario but first I do not want to track user's location at first. First I simple get current user location(longitude and latitude), calculate the area from that and send it to server. Now I am not sure how am I going to achieve that. Any help?
from How to get square meter or square km using in html5 / ionic
No comments:
Post a Comment