1

I would like to create a form where a user enters an address of a place and it will be stored in a database in latitude / longitude. I did a little research on google and I am lost. One knows either a class or service (php, Symfony) to convert an address into latitude / longitude

Need help please, thanks in advance

Nirina-aj
  • 192
  • 1
  • 3
  • 18
  • You could use [Google Places with some JS](https://stackoverflow.com/questions/20916221/getting-latitude-and-longitude-from-google-places-search-api-using-javascript), then put the Lat/Lon in hidden fields and no additional PHP code required – kero May 24 '17 at 14:16
  • This article would help with the first step in that process, which is validating your incoming data with Symfony's form constraints: http://www.technoburgh.com/php/latitude-longitude-validation-symfony-3/ – DanielGaffey Jun 27 '17 at 23:30

1 Answers1

1

You can probably use BazingaGeocoderBundle to implement it, just add it to your composer. Is probably one of the best tools for this purpose...

https://github.com/geocoder-php/BazingaGeocoderBundle

Documentation:

https://github.com/geocoder-php/BazingaGeocoderBundle/blob/master/Resources/doc/index.md

Installation:

https://github.com/geocoder-php/BazingaGeocoderBundle/blob/master/Resources/doc/index.md#installation

it uses Geocoder

http://geocoder-php.org/Geocoder/

Community
  • 1
  • 1