Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GPS location and automatic location detection along with accuracy #29

Merged
merged 2 commits into from
Aug 16, 2018

Conversation

irshadshalu
Copy link

This PR adds automatic GPS location fetching for devices with GPS support and stores it in the database.

Also added is a "Open in maps" button for request list which directly opens the location in google maps

model fields added -

  • latlng - GPS location as comma seperated field
  • latlng_accuracy - accuracy of the GPS location.

view edited -

  • Added latlng and latlng_accuracy to forms

html changes -

  • Set GPS fields as readonly.
  • Fetch GPS location using javascript.

@joicemjoseph
Copy link

it seems working. better to display accurate place name instead of latlong

@irshadshalu
Copy link
Author

irshadshalu commented Aug 16, 2018

Can be easily done using
http://maps.googleapis.com/maps/api/geocode/json?latlng=8.5581139,76.8814559&sensor=false

But not sure if there is a daily API limit (As google maps APIs went rigorous with pricing

@sidharthv96
Copy link

sidharthv96 commented Aug 16, 2018

Can't you request the google api from client side?
As long as the API works without a key, you can send an ajax when you get the lat lng, and then add the place to the form.

@irshadshalu
Copy link
Author

Yeah, already tried that and here is the result
screen shot 2018-08-16 at 12 51 42 pm

@sidharthv96
Copy link

That will mostly be IP based or cookie based. So if you request from client side, they won't hit the limit.

@irshadshalu
Copy link
Author

No. I still can access the URL:
http://maps.googleapis.com/maps/api/geocode/json?latlng=8.5581139,76.8814559&sensor=false

And get the correct response, but not when running from localhost.

So it is probably domain based and not client IP or Cookie based.

@sadu
Copy link

sadu commented Aug 16, 2018

GoogleMaps APIs no longer work without a key, we would need one to call their geo-coding APIs.
ref: https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding

@irshadshalu
Copy link
Author

Added this using Nominatim API which uses OpenStreetMap,

Seems to be working fine, do check the new commit.

@biswaz
Copy link

biswaz commented Aug 16, 2018

Require testing before merge @vigneshhari

@irshadshalu
Copy link
Author

I think we need to increase the timeout and maximum age.

@biswaz
Copy link

biswaz commented Aug 16, 2018

Merged and deployed to production

@biswaz
Copy link

biswaz commented Aug 16, 2018

2700 meters accuracy for me

@irshadshalu
Copy link
Author

Are you trying from mobile or desktop?

I have removed the timeout and maximumAge in #89 . Do merge that as well, otherwise Accurate GPS will not be fetched before timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants