0

I'm building a web application for a University project which requires the use of PHP and MySql. I'm planning on using HTML5 Geolocation to ask access to a logged in users location on a form. Once they have accepted and submitted the form I would like the location information to be stored in a MySql database and then recalled on another page in the form of a Google Map with a pin in the area where the form was submitted.

I've had a search around but can't find any conclusive evidence to suggest that this would be a viable way of doing it. So my question is is this (relatively) simple to do and more importantly is it a reliable way of capturing data about a users location?

The idea is that a user would use the application in order to report problems in their area, for example a pothole. A user can log in and report the problem and the location by allowing the use of Geolocation. The problem is then recorded on a 'problem' page, where the council can look and see where it was reported from.

Any tips would be great!

2 Answers 2

1

Well its accuracy varies greatly. Sometimes it can be pinpointed to a few meters and other times be off a couple of kilometers. This detection is based on networks and trace routing for the most part, and as such you can never guarantee complete accuracy.

I would recommend using addresses for your project. Google can easily project pins on addresses, plus that's likely what the city will be using internally.

Sign up to request clarification or add additional context in comments.

4 Comments

So if I were to use addresses, how would I go about producing a Google Map with the user inputted form data?
From my understanding, to use the address you first geocode the address to get a latlon object that you can then use to create the marker. This adds several steps. First you would have to know your current address, type it in, then the server needs to correctly geocode it (Google geocoding isn't perfect), then you need to serv the latlon back to the client to render the marker. Alternately, you could use the GPS in the mobile device (if available)
The original idea was that the application would use Geolocation so that a user could report a problem even if they were in an unfamiliar place where they didn't know the roads/town etc, but as you say it's not always accurate so this would be useless even if the user did know the area. I'll have a look into geocoding addresses. Thanks for your help.
Yes, the Google Maps api provides a very to use geocoding API. Check out the documentation.
1

This is a very reasonable way to do it. Check out the google maps example: https://google-developers.appspot.com/maps/documentation/javascript/examples/map-geolocation

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.