2017 © Pedro Peláez
 

symfony-bundle geolocation-bundle

Provides an abstraction layer for geocoding services.

image

1001pharmacies/geolocation-bundle

Provides an abstraction layer for geocoding services.

  • Thursday, November 2, 2017
  • by methylbro
  • Repository
  • 11 Watchers
  • 13 Stars
  • 2,498 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 1 Open issues
  • 10 Versions
  • 5 % Grown

The README.md

GeoLocation Bundle

Build Status Total Downloads Latest Stable Version, (*1)

Provides an abstraction layer for geocoding services. This bundle can be also used to split geocoding's calculation between a set of external geocoding service., (*2)

Supported providers

The following services are included to this bundle :, (*3)

The the complete documentation to add you own provider., (*4)

Example

Spatial coordinates and postal address correspondence

Coordinates by Address

$address = $container
    ->get('meup_geo_location.address_factory')
    ->create()
    ->setFullAddress('360 rue du thor, 34000 Montpellier')
;

$coordinates = $container
    ->get('meup_geo_location.locator')
    ->locate($address)
;

printf(
    "%s,%s\n",
    $coordinates->getLatitude(),
    $coordinates->getLongitude()
);
// output : 43.6190815,3.9162419

The geolocation-bundle only provides library ands services. But you can easily integrate it in your applications., (*5)

Address by Coordinates

$coordinates = $container
    ->get('meup_geo_location.coordinates_factory')
    ->create()
    ->setLatitude(43.6190815)
    ->setLongitude(3.9162419)
;

$address = $container
    ->get('meup_geo_location.locator')
    ->locate($coordinates)
;

print $address->getFullAddress();
// output : 640 Rue du Mas de Verchant, 34000 Montpellier

Distance calculation

When you found two location's coordinates you can also calculate their distance with the distance calculator., (*6)

$factory = $container
    ->get('meup_geo_location.coordinates_factory')
;

$paris = $factory
    ->create()
    ->setLatitude(48.856667)
    ->setLongitude(2.350987)
;
$lyon = $factory
    ->create()
    ->setLatitude(45.767299)
    ->setLongitude(4.834329)
;

$distance_paris_lyon = $container
    ->get('meup_geo_location.distance_calculator')
    ->getDistance($paris, $lyon)
;

printf('%d km', $distance_paris_lyon); # 391.613 km

Installation

Install the package with Composer :, (*7)

composer require 1001pharmacies/geolocation-bundle

Or update the composer.json file :, (*8)

"require": {
    "1001pharmacies/geolocation-bundle": "~1.0"
}

Update app/AppKernel.php :, (*9)

$bundles = array(
    // ...
    new Meup\Bundle\GeoLocationBundle\MeupGeoLocationBundle(),
);

Setup your app/config/parameters.yml with your api keys :, (*10)

parameters:
    # ...
    geo_location_google_api_key:     your_google_api_key
    geo_location_bing_api_key:       your_bing_api_key
    geo_location_nominatim_api_key:  null
    geo_location_mapquest_api_key:   your_mapquest_api_key
    geo_location_yandex_api_key:     null
    geo_location_heredotcom_api_key: your_heredotcom_api_key

See detailed Google and Bing documentation to know how to retrieve api keys., (*11)

Customization

The Versions

02/11 2017

dev-master

9999999-dev

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing nokia here

02/11 2017

v1.1.1

1.1.1.0

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing nokia here

30/10 2017

v1.1.0

1.1.0.0

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing nokia here

24/10 2017

v1.0.5

1.0.5.0

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing nokia here

05/11 2015

v1.0.4

1.0.4.0

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing nokia here

18/12 2014

v1.0.3

1.0.3.0

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing

17/12 2014

v1.0.2

1.0.2.0

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing

16/12 2014

v1.0.1

1.0.1.0

Provides an abstraction layer for geocoding services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar methylbro

gps geocoding address geolocation google maps coordinates latitude longitude microsoft bing

11/12 2014

v1.0.0

1.0.0.0

Provides an abstraction layer for geocoding services.

  Sources   Download

The Requires

 

The Development Requires

by Avatar methylbro

11/12 2014

v1.0.0-beta

1.0.0.0-beta

  Sources   Download

The Requires

 

The Development Requires

by Avatar methylbro