Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Where are you? Implementing geolocation with Geocoder PHP
Oct 23, 2014 @ 16:45:17

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.

tagged: geolocation geocoder tutorial library introduction geocoderphp

Link: http://www.sitepoint.com/implementing-geolocation-geocoder-php/

PHPMaster.com:
Mapping with Geocoder PHP and Leaflet.js
Nov 06, 2013 @ 16:49:43

On PHPMaster.com a new tutorial has been posted showing how to combine Geocoder PHP with Leaflet.js to create interactive maps. The Leaflet.js library lets you easily create mobile-friendly maps with simplicity and usability in mind.

Interactive maps inside a web application have a lot of great uses. From visualizing data to highlighting points of interest, maps are expected to communicate ideas within the context of location easily. The hardest part, however, is converting that data into coordinates that the map can understand. Luckily, Geocoder PHP allows us to connect to different geo-coding providers. Combined with Leaflet.js, a simple Javascript library, creating maps is a breeze.

He starts by helping you get the Geocoder library installed via Composer and make a sample page (using Bootstrap and jQuery) with a container for the map. He helps you set up Geocoder with an adapter to connect to the service of your choice (like Google Maps, Bing Maps or Openstreatmap). With this configured and created, he inputs some sample data and coverts the addresses to latitude/longitude sets. He walks you through getting Leaflte.js added to the page and pulling in these results via individual generated Javascript variables. You can check out a demo of the end result to see how it all fits together too.

tagged: mapping geocoder leafletjs tutorial introduction interactive

Link: http://www.sitepoint.com/mapping-geocoder-php-leaflet-js/


Trending Topics: