Laravel Geocoding

Laravel Geocoding

Geocod.io the geocoding service created by Mathias Hansen has just released a PHP and Laravel library for integrating with the service. It includes geocoding, reverse geocoding, and data matching for US and Canadian addresses.

Here is an example:

$response = Geocodio::geocode('1109 N Highland St, Arlington, VA');

/*
{
  "input": {
    "address_components": {
      "number": "1109"                                                       
      "predirectional": "N"                                                   
      "street": "Highland"                                                   
      "suffix": "St"                                                    
      "formatted_street": "N Highland St"                                     
      "city": "Arlington"                                                     
      "state": "VA"                                                           
      "country": "US"                                                         
    }                                                                        
    "formatted_address": "1109 N Highland St, Arlington, VA"                
  }             
  "results": array:2 [                                                         
    0 => {
      "address_components": {
        "number": "1109"                                                       
        "predirectional": "N"
        "street": "Highland"   
        "suffix": "St"
        "formatted_street": "N Highland St"
        "city": "Arlington"
        "county": "Arlington County"
        "state": "VA"
        "zip": "22201"
        "country": "US"
      }
      "formatted_address": "1109 N Highland St, Arlington, VA 22201"
      "location": {
        "lat": 38.886672
        "lng": -77.094735
      }
      "accuracy": 1
      "accuracy_type": "rooftop"
      "source": "Arlington"
    }
    1 => {
      "address_components": {
        "number": "1109"
        "predirectional": "N"
        "street": "Highland"
        "suffix": "St"
        "formatted_street": "N Highland St"
        "city": "Arlington"
        "county": "Arlington County"
        "state": "VA"
        "zip": "22201"
        "country": "US"
      }
      "formatted_address": "1109 N Highland St, Arlington, VA 22201"
      "location": {
        "lat": 38.886665
        "lng": -77.094733
      }
      "accuracy": 1
      "accuracy_type": "rooftop"
      "source": "Virginia Geographic Information Network (VGIN)"
    }
  ]
}
*/

Of course, this is just the basics and geocoding can be useful for a myriad of things while we are building applications. This could be everything from finding latitude/longitude, addresses, proper zip codes, timezones, or even Congressional information.

You can find out more details and try out the package from their Github repo and the first 2,500 lookups per day are free.


Filed in: News / packages


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Laravel Engineer
Remote okay (must already live in USA)
Hawthorne Effect
Senior Software Engineer (Remote - Contract)
Remote
Koodi Systems
PHP Developer
Pittsburgh / Remote
Sequoia Waste Solutions
Software Developer
Eindhoven
Simac IDS
Application Developer Level II (CakePHP / MySql / Vue.js)
Lancaster, PA
Harbor Compliance
FULL STACK LARAVEL DEVELOPER
LONDON - WEST END
AMPERSAND HEATLH
Mid/Senior Laravel Developer - U.S. Only
Kenner, Louisiana
Profit Miner Technologies