The SitePoint PHP blog has a new tutorial posted by Arno Slatius showing you how to use geocoding in PHP to find the latitude and longitude of a point given its address or name. He makes use of the geocoder-php library to make things a bit simpler.
The beauty of SitePoint, to me, is that you can get inspired to try something or be told about some cool project out there. The internet is simply too big for one person to scout out on their own. Geocoder was one of those for me. I had never heard about it and came across it on the authors Trello board. I love working with maps and geographic information and I use (reverse) geocoding heavily for a project I did for a client; CableTracks. [...] I found out that Geocoder PHP actually is what I was missing for the integration of various services that we use.
He starts by helping you get the library installed (either via Composer or manually) and the creation of a simple Google Maps goecode request for a location. He includes an example of the results and mentions how the library handles locales in both the input and output. He also shows how the tool lets you do reverse geocoding - given a latitude and longitude, it can provide you address and location information. It also includes lookup support for IP addresses and output formatting and examples using both are also included.
Link: http://www.sitepoint.com/implementing-geolocation-geocoder-php/
没有评论:
发表评论