GithubHelp home page GithubHelp logo

geocoder-php / geocoderlaravel Goto Github PK

View Code? Open in Web Editor NEW
689.0 24.0 103.0 28.91 MB

Geocoder service provider for Laravel

Home Page: http://geocoder-php.org/GeocoderLaravel/

License: MIT License

PHP 100.00%
geocoding laravel-package

geocoderlaravel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geocoderlaravel's Issues

ReflectionException: Class Chain does not exist

General Information

GeocoderLaravel Version: 1.0.1
Laravel Version: 7.4
PHP Version: 7.1
Operating System and Version: Ubuntu 16

Issue Description

Can't reverse geocode because of Chain error.

Steps to Replicate

Function calling the package:

  public function reverse_geocode($lat, $lon) {
    try {
      $result = Geocoder::reverse($lat, $lon);
      $data = $result->toArray();

      \DB::table('geocoded')->insert([
        'type'        => 'reverse',
        'q'           => $lat.','.$lon,
        'lat'         => $data['latitude'],
        'lon'         => $data['longitude'],
        'coords'      => \DB::raw("GeomFromText('POINT(".$data['longitude']." ".$data['latitude'].")')"),
        'bounds'      => json_encode($data['bounds']),
        'street'      => $data['streetNumber'] .' '.$data['streetName'],
        'zip'         => $data['zipcode'],
        'city'        => $data['city'],
        'district'    => $data['cityDistrict'],
        'county'      => $data['county'],
        'region'      => $data['region'],
        'state'       => $data['regionCode'],
        'country'     => $data['countryCode'],
        'created_at'  => new \Carbon\Carbon,
        'updated_at'  => new \Carbon\Carbon
      ]);

      return $result;

    } catch( \Exception $e ) {
      \Log::error($e);
      return false;
    }
  }

Stack Trace

Development.ERROR: ReflectionException: Class Chain does not exist in /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php:71
Stack trace:
#0 /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php(71): ReflectionClass->__construct('Chain')
#1 [internal function]: Geocoder\Laravel\Providers\GeocoderService->Geocoder\Laravel\Providers{closure}(Array, 'Chain')
#2 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Collection.php(684): array_map(Object(Closure), Array, Array)
#3 /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php(78): Illuminate\Support\Collection->map(Object(Closure))
#4 /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php(54): Geocoder\Laravel\Providers\GeocoderService->getProviders(Object(Illuminate\Support\Collection))
#5 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(716): Geocoder\Laravel\Providers\GeocoderService->Geocoder\Laravel\Providers{closure}(Object(Illuminate\Foundation\Application), Array)
#6 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(598): Illuminate\Container\Container->build(Object(Closure))
#7 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(567): Illuminate\Container\Container->resolve('geocoder')
#8 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): Illuminate\Container\Container->make('geocoder')
#9 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(1139): Illuminate\Foundation\Application->make('geocoder')
#10 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(159): Illuminate\Container\Container->offsetGet('geocoder')
#11 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(128): Illuminate\Support\Facades\Facade::resolveFacadeInstance('geocoder')
#12 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(215): Illuminate\Support\Facades\Facade::getFacadeRoot()
#13 /srv/Demo.com/dev/app/Http/Controllers/Front/BaseController.php(264): Illuminate\Support\Facades\Facade::__callStatic('reverse', Array)
#14 /srv/Demo.com/dev/app/Traits/GeoSearchHelper.php(364): Demo\Http\Controllers\Front\BaseController->reverse_geocode(43.6861, -79.4025)

Using Dumpers

Have you considered adding the dumpers feature? Any idea how to implement this?

Umlaut in the default region breaks results (?)

For

    $geocode = \Toin0u\Geocoder\Facade\Geocoder::geocode('Obere Donaustrasse 22, Wien, Österreich');
    // The GoogleMapsProvider will return a result
    var_dump($geocode);

The configuration

'Geocoder\Provider\GoogleMapsProvider' => ['de-DE', null, true, 'myAPIKey'],

will return a result. For the configuration

'Geocoder\Provider\GoogleMapsProvider' => ['de-DE', 'Wien', true, 'myAPIKey'],

too. But for

'Geocoder\Provider\GoogleMapsProvider' => ['de-DE', 'Wien, Österreich', true, 'myAPIKey'],

it will fail:

ChainNoResultException in ChainProvider.php line 63: No provider could provide the address "Obere Donaustrasse 22, Wien, Österreich"

I gues it is the umlaut (Ö?)

Thanks
Andreas

Update geocode

In short: GeocoderLaravel v0.6 uses an obsolete GuzzleHttp v3 library.
Details:
The latest stable "toin0u/geocoder-laravel": "^0.6.0" requires years-old "willdurand/geocoder" : "~2.4"
This old version of geocoder has an old Geocoder/HttpAdapter/GuzzleHttpAdapter.php that calls
use Guzzle\Service\Client;
This is old Guzzle 3.0 code
http://mtdowling.com/blog/2012/10/16/guzzle-3-dot-0-better-service-descriptions-and-more-modular/
Which, as explained in the current v6.x README.md is End Of Life.
This conflicts with other code, that runs a maintained version of GuzzleHttp lib.

Also note that the composer.json description field for "toin0u/geocoder-laravel": "^0.6.0" confusingly mentions Laravel v4, even though it requires
"illuminate/support" : "~5.0"

This looks like it has been fixed in feature/update-for-laravel-5-3
If you could rename this branch with a dev- prefix, it would be accessible via Composer:
https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository

Installation issue

Hi,

I found an issue
error

when I execute the installation command "composer require toin0u/geocoder-laravel:1.0.0-RC1@dev"

I already upgrade my Laravel to 5.3.26. Could you please solve my issue?

What is the vendor::publish command?

php artisan vendor:publish --provider="Geocoder\Laravel\GeocoderServiceProvider" --tags="config"

[Symfony\Component\Console\Exception\RuntimeException]
  The "--tags" option does not exist.
php artisan vendor:publish --provider="Geocoder\Laravel\GeocoderServiceProvider" --tag="config"

Nothing to publish for tag [config].
php artisan vendor:publish --provider="Toin0u\Geocoder\GeocoderServiceProvider"

Nothing to publish for tag [].

tried a few different ones. I assume i just need to copy paste the config/geocoder.php to my app

Requires illuminate/support error

Hi!

On adding the package and running composer update I'm getting the following error in the console.

[master] ⚡ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.0.26
    - Conclusion: don't install laravel/framework v5.0.26
    - Conclusion: don't install laravel/framework v5.0.25
    - Conclusion: don't install laravel/framework v5.0.24
    - Conclusion: don't install laravel/framework v5.0.23
    - Conclusion: don't install laravel/framework v5.0.22
    - Conclusion: don't install laravel/framework v5.0.21
    - Conclusion: don't install laravel/framework v5.0.20
    - Conclusion: don't install laravel/framework v5.0.19
    - Conclusion: don't install laravel/framework v5.0.18
    - Conclusion: don't install laravel/framework v5.0.17
    - Conclusion: don't install laravel/framework v5.0.16
    - Conclusion: don't install laravel/framework v5.0.15
    - Conclusion: don't install laravel/framework v5.0.14
    - Conclusion: don't install laravel/framework v5.0.13
    - Conclusion: don't install laravel/framework v5.0.12
    - Conclusion: don't install laravel/framework v5.0.11
    - Conclusion: don't install laravel/framework v5.0.10
    - Conclusion: don't install laravel/framework v5.0.9
    - Conclusion: don't install laravel/framework v5.0.8
    - Conclusion: don't install laravel/framework v5.0.7
    - Conclusion: don't install laravel/framework v5.0.6
    - Conclusion: don't install laravel/framework v5.0.5
    - Conclusion: don't install laravel/framework v5.0.4
    - Conclusion: don't install laravel/framework v5.0.3
    - Conclusion: don't install laravel/framework v5.0.2
    - Conclusion: don't install laravel/framework v5.0.1
    - toin0u/geocoder-laravel 0.4.0 requires illuminate/support ~4.0 -> satisfiable by illuminate/support[v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.13, v4.1.14, v4.1.15, v4.1.16, v4.1.17, v4.1.18, v4.1.19, v4.1.2, v4.1.20, v4.1.21, v4.1.22, v4.1.23, v4.1.24, v4.1.25, v4.1.26, v4.1.27, v4.1.28, v4.1.29, v4.1.3, v4.1.30, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.1, v4.2.12, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
    - toin0u/geocoder-laravel 0.4.1 requires illuminate/support ~4.0 -> satisfiable by illuminate/support[v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.13, v4.1.14, v4.1.15, v4.1.16, v4.1.17, v4.1.18, v4.1.19, v4.1.2, v4.1.20, v4.1.21, v4.1.22, v4.1.23, v4.1.24, v4.1.25, v4.1.26, v4.1.27, v4.1.28, v4.1.29, v4.1.3, v4.1.30, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.1, v4.2.12, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
    - don't install illuminate/support v4.0.0|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.1|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.10|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.2|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.3|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.4|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.5|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.6|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.7|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.8|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.0.9|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.0|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.1|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.10|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.11|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.12|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.13|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.14|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.15|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.16|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.17|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.18|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.19|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.2|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.20|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.21|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.22|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.23|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.24|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.25|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.26|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.27|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.28|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.29|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.3|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.30|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.4|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.5|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.6|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.7|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.8|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.1.9|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.1|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.12|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.16|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.17|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.2|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.3|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.4|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.5|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.6|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.7|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.8|don't install laravel/framework v5.0.0
    - don't install illuminate/support v4.2.9|don't install laravel/framework v5.0.0
    - Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[v5.0.0, v5.0.1, v5.0.10, v5.0.11, v5.0.12, v5.0.13, v5.0.14, v5.0.15, v5.0.16, v5.0.17, v5.0.18, v5.0.19, v5.0.2, v5.0.20, v5.0.21, v5.0.22, v5.0.23, v5.0.24, v5.0.25, v5.0.26, v5.0.3, v5.0.4, v5.0.5, v5.0.6, v5.0.7, v5.0.8, v5.0.9].
    - Installation request for toin0u/geocoder-laravel 0.4.* -> satisfiable by toin0u/geocoder-laravel[0.4.0, 0.4.1].

Does not work with Laravel 5.4

Version 0.6.0

Got this exception
FatalThrowableError: Call to undefined method Illuminate\Foundation\Application::share()

in that file /vendor/toin0u/geocoder-laravel/src/GeocoderServiceProvider.php:72

We need to refactor the Provider in order to use singleton instead of share as described in the upgrade documentation for Laravel 5.4

Use different geocoders

Sometimes I want to geocode IP addresses of my users and sometimes I want to geocode addresses. For the IP addresses I would like to use the FreeGeoIpProvider, for the addresses I would like to use the GoogleMapsProvider. Is there any way to switch between the configured providers in code?

I've seen there is a method called using in the Geocode facade. However, I couldn't get it working.

Stopped working locally

I'm sure it's a problem on my end, but I'm having problems debugging.

I have it using either a Google Maps API Key with a fallback of Bing Maps API. It was working on my local machine, but it stopped. However, it does work in a remote staging site.

$location = "boulder, co";
$address_collection = Geocoder::geocode($location)->dump('geojson');

I'm getting the message:

ChainNoResult in Chain.php line 56:
No provider could geocode address: "boulder, co".

When it was working, I had my local environment setup through XAMPP. Now I'm just using Homebrew to set up a new local environment. I mention this in case it might be something outside the package and my code.

Again, it's working on a staging site. Same code.

No provider could provide the coordinated

Hi,

I am using your GeoCoder with version "toin0u/geocoder-laravel" on laravel 5.2. I found an error: "No provider could provide the coordinated " when I want to obtain an address using this code.
try {
$geocode = \Geocoder::reverse($request->input('latitude'), $request->input('longitude'))->toArray();
} catch (\Exception $e) {
return $e->getMessage();
}
Am I missing something?

Thank you

Calling statically generating an error

Hi,

Not sure if this is the right place. I've been trying to update aon older Laravel project and at the same time upgrade GeoCoder.

Here's the error I'm getting:
"Non-static method Geocoder\Geocoder::geocode() should not be called statically, assuming $this from incompatible context"

And it's being called from

$geocode = Geocoder::geocode($fullAddy);
$coords = $geocode->getCoordinates();

Any idea what could be causing the error? All docs seem to indicate this is the proper way to call Geocoder.

MaxMindBinary config

Looked through the code but can't find the proper way of using the MaxMindBinary. Anyone know how to properly set this up?

bump egeloen/http-adapter version

Hi,

Problem 1
- Installation request for egeloen/http-adapter (locked at 1.0.2) -> satisfiable by egeloen/http-adapter[1.0.2].
- toin0u/geocoder-laravel 1.0.0 requires willdurand/geocoder ~3.3 -> satisfiable by willdurand/geocoder[v3.3.0].
- toin0u/geocoder-laravel 1.0.1 requires willdurand/geocoder ~3.3 -> satisfiable by willdurand/geocoder[v3.3.0].
- toin0u/geocoder-laravel 1.0.2 requires willdurand/geocoder ~3.3 -> satisfiable by willdurand/geocoder[v3.3.0].
- toin0u/geocoder-laravel 1.0.3 requires willdurand/geocoder ~3.3 -> satisfiable by willdurand/geocoder[v3.3.0].
- willdurand/geocoder v3.3.0 requires egeloen/http-adapter ~0.8 -> satisfiable by egeloen/http-adapter[0.8.0].
- Conclusion: don't install egeloen/http-adapter 0.8.0
- Installation request for toin0u/geocoder-laravel ^1.0 -> satisfiable by toin0u/geocoder-laravel[1.0.0, 1.0.1, 1.0.2, 1.0.3].

We're not able to install 0.8 cause of other updated libs, would it be possible to make the jump to ^1.0? Or even better jump on the new php-http/httplug train instead of the deprecated egeloen/http-adapter?

Implementation of Geocoder.ca seems to be wildly off

While it came back with many results, they were off by quite a bit. I called geocoder.ca and they passed the same string into their system and it came back accurately. For example http://geocoder.ca/?locate=630+University+Ave%2C+Palo+Alto%2C+CA%0994301-2019&geoit=GeoCode works in their system, but when I pass the string "630 University Ave, Palo Alto, CA 94301-2019" your system ( with 'provider' => 'Geocoder\Provider\GeocoderCaProvider') returns 38.3241329,-122.7146332, which is very off. All the results all over the country seem to be off by many many many miles. I am using what I believe to be the proper method (below). Am I doing this wrong?

$location = \Geocoder::geocode($geo_address);
$address_info['coords'] = $location->getLatitude().','.$location->getLongitude();

Issue in getting latitude and longitude using Bing Maps

After following all the steps written in github for implementing geo-coding, I got the output for google maps. Repeating the same steps for the bing maps I got the output (latitude and longitude) using correct API key.
Issue is:
1: The value got from both the maps are not exactly same after decimal.
2: Bing map is not reliable (When I tried using bing map again after some period of time I didn't get the output).

This is what I got when I fired get command second time ,

object(Geocoder\Result\Geocoded)[846]
protected 'latitude' => int 0
protected 'longitude' => int 0
protected 'bounds' => null
protected 'streetNumber' => null
protected 'streetName' => null
protected 'cityDistrict' => null
protected 'city' => null
protected 'zipcode' => null
protected 'county' => null
protected 'countyCode' => null
protected 'region' => null
protected 'regionCode' => null
protected 'country' => null
protected 'countryCode' => null
protected 'timezone' => null

Please reply soon if anyone knows about this issue.

Using Geocoder::geocode within a loop gets Server Time Out.

Hi I have this code:

foreach ($results as $result) {
$barangay = DB::table('rbrgy')->where('bgycode', $result->barangay)->first();
$loc = getBrgyName($barangay->bgycode) . ', '
. getCityName($barangay->citycode) . ', '
. getProvName($barangay->provcode) . ', '
. getRegion($barangay->regcode) . ', '
. 'Philippines';
$geocode = Geocoder::geocode($loc);
}

When the $results array is <= 10, it works fine but when $results is > 10, the I get a server timeout. Is there a way on how I can get multiple geocodes with one function call?

Please help. Tried searching the issues but there seems to be no issues related to this. Thanks in advance!

~May

It does not work with Laravel 5.1

Would you please update the dependencies to Laravel ~5.1? Thanks dude.

Getting:

toin0u/geocoder-laravel 0.5.0 requires illuminate/support 5.0.*

Error with Laravel 5.4

Hi,
I'm upgrading a L5.1 app with "toin0u/geocoder-laravel": "0.6.0"

Now, I use a fresh new Lavel 5.4.

The first composer update with "toin0u/geocoder-laravel": "^1.0", in composer.json is OK.

I also use Barryvdh ide-helper. So, I have in composer.json

"post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:meta",
            "php artisan optimize"
        ]

If I add in app.php Geocoder\Laravel\Providers\GeocoderService::class, I have this error during the next composer update

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan ide-helper:generate
  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Class 'Geocoder\HttpAdapter\CurlHttpAdapter' not found
Script php artisan ide-helper:generate handling the post-update-cmd event returned with error code 1

Last point, composer update works well if I remove the ide-helper steps in composer.json

"post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]

What do you think ?
Is it coming from Geocoder (maybe not validated with L5.4?) or does this comes from barryvdh/ide-helper ?

Thanks in advance,
Paguemaou

Some update documentation

For those that used the previous version it might not be clear how it works now. Could you add this to the readme? Sorry if it's not very clear, at least it's a start.

  • change your composer.json, use this : "toin0u/geocoder-laravel": "^1.0",
  • edit/redo your config/geocoder.php (take the config file https://github.com/geocoder-php/GeocoderLaravel/blob/master/config/geocoder.php as inspiration
  • change your config/app.php to Geocoder\Laravel\Providers\GeocoderService::class,
  • change your "use" statement everywhere it's needed to : use Geocoder\Laravel\Facades\Geocoder;

Now if you want to goecode some address and get the latitude for instance, use this :

$latitude = Geocoder::geocode('Brussels, Belgium')->get()->first()->getLatitude();

A geocoder object is returned, so you can use all the methods documented here : https://github.com/geocoder-php/Geocoder#usage

hth

No provider could geocode address

I've followed the steps outlined to get this package installed in a new project I am working on in Laravel 5.3.

My geocoder.php file is set up like so:

<?php

/**
 * This file is part of the GeocoderLaravel library.
 *
 * (c) Antoine Corcy <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use Ivory\HttpAdapter\CurlHttpAdapter;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
use Geocoder\Provider\Chain;
use Geocoder\Provider\BingMaps;
use Geocoder\Provider\FreeGeoIp;
use Geocoder\Provider\GoogleMaps;
use Geocoder\Provider\MaxMindBinary;

return [
    'providers' => [
        Chain::class => [
            GoogleMaps::class => [
                'en-AU',
                'Australia',
                true,
                env('GOOGLE_MAPS_API_KEY'),
            ],
            FreeGeoIp::class  => [],
        ],
        BingMaps::class => [
            'en-US',
            env('BING_MAPS_API_KEY'),
        ],
        GoogleMaps::class => [
            'en',
            'us',
            true,
            env('GOOGLE_MAPS_API_KEY'),
        ],
    ],
    'adapter'  => CurlHttpAdapter::class,
];

Yet when I run $geocode = app('geocoder')->geocode('Los Angeles, CA')->get(); or any other address I am always getting the error:

exception 'Geocoder\Exception\ChainNoResult' with message 'No provider could geocode address: "Los Angeles, CA".

Am I doing something wrong or is there a bug?

Chain Question

When using the chain method, is there anyway to determine which provider returned the result.

Ex:

$geocoder = new \Geocoder\Geocoder();
$adapter = new \Geocoder\HttpAdapter\CurlHttpAdapter();
$chain = new \Geocoder\Provider\ChainProvider(array(
new \Geocoder\Provider\FreeGeoIpProvider($adapter),
new \Geocoder\Provider\HostIpProvider($adapter),
new \Geocoder\Provider\GoogleMapsProvider($adapter),
new \Geocoder\Provider\BingMapsProvider($adapter, '<API_KEY>'),
new \Geocoder\Provider\OpenStreetMapProvider($adapter),
));
$geocoder->registerProvider($chain);

I want to know if google or bing returned the result set.

No provider could reverse coordinates

Hi @mikebronner ,

I found an error "No provider could reverse coordinates" when I do reverse using this code:
try {
$geocode = \Geocoder::reverse($request->input('latitude'), $request->input('longitude'))->toArray();
} catch (\Exception $e) {
return $e->getMessage();
}

I am already using "toin0u/geocoder-laravel": "1.0.0-RC1@dev" on Laravel 5.3. Do I need to config something else for reverse? Because currently I am using default config.

Regards

Irfan

No provider could provide the address Error

I edited my config file to

return array(
   'providers' => array(
       'Geocoder\Provider\GoogleMapsProvider' => array('en_EN', null),
       'Geocoder\Provider\FreeGeoIpProvider'  => null,
    ),
'adapter'  => 'Geocoder\HttpAdapter\CurlHttpAdapter'
);

On my local server it's working fine, but once I try it online I get the

No provider could provide the address "Moscow, Russia"

I also tried ('en_EN', 'English', $ssl = true, 'xxxxxxxxxxxxxx api-key xxxxxxx'), but that didn't work either.
Any ideas?

Using multiple providers

Having difficulty figuring out best way (or any way) to use multiple providers with the Laravel module. Could a few examples be given?

Thanks
Adam

Error: No provider could geocode address:

Hi,
On installing this package unto my laravel 5.2 project with php 5.5.9, I kept getting the error below:
No provider could geocode address:

I did some debugging including printing out the url path, and checking it from the browser.
https://maps.googleapis.com/maps/api/geocode/json?address=se186tl&language=en%C2%AEion=uk&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The absolute path return expected address from the browser.

However I notice that within the GoogleMap Class located in the Willdurand folder (package), this line: $content = (string) $this->getAdapter()->get($query)->getBody(); within the executeQuery($query) function does not return anything.

This seem to be the beginning of the issue, and I've not been able to work it out.

Can anyone help and is anyone getting the same problem ?

Maybe I am doing something wrong.

Many Thanks in advance

Nothing to publish

Going with the instructions, but when I get to this part:
php artisan vendor:publish --provider="toin0u/geocoder-laravel"

The cli just returns "Nothing to publish". No config file is written and nothing is written to config/services

Tried on both 0.5.0 and 0.5.x-dev.

Laravel 5.1 Support

Currently, the "illuminate/support" : "5.0.*", require statement makes this unable to install on Laravel 5.1, which needs laravel/support >= 5.1

How to set curl proxy in config ?

Hello,

In config/geocoder.php, how can I set the proxy?
I tried that :

return [
    // Providers get called in the chain order given here.
    // The first one to return a result will be used.
    'providers' => [
        'Geocoder\Provider\GoogleMapsProvider' => ['fr-FR', 'Île-de-France', true],
        'Geocoder\Provider\FreeGeoIpProvider'  => null,
    ],
    'adapter'  => new Geocoder\HttpAdapter\CurlHttpAdapter(['http_proxy' => 'myproxy.domain.name']),
];

But it doesn't work :-/

HTTP Auth keeps coder from working

We have a dev server with basic http auth on it. For some reasons, http auth breaks the GoogleMapsProvider (I am assuming others too). We're using the CurlHttpAdapter. With http auth off, it works fine.

Anyway, it might be nice to note that in the documentation or, if possible, work even with http auth on the server.

Laravel 4.1 Missing argument 2 for Geocoder\Provider\CloudMadeProvider::__construct()

Get the error below. I am not seeing where the API key is supposed to be set that should be getting to the CloudMade provider. Am I doing something wrong here? Thanks.

Missing argument 2 for Geocoder\Provider\CloudMadeProvider::__construct(), called in /var/www/vendor/toin0u/geocoder-laravel/src/Toin0u/Geocoder/GeocoderServiceProvider.php on line 57 and defined

Of API keys and large batches

  1. Not sure where to put the api keys in the Laravel version of geocoder. I do not see how in the config, so I am placing them in the willdurand provider files directly. That does not seem right. With the API keys in those files I am not getting anything back for MapQuest and CloudMade.

  2. I am trying to process about 300,000 addresses for a database. Which provider would be best for that?

Using a different http adapter

I was getting no results using the default httpclient. so i am trying guzzle.

use GuzzleHttp\Client as GuzzleClient;
use Geocoder\Provider\Chain;
use Geocoder\Provider\BingMaps;
use Geocoder\Provider\FreeGeoIp;
use Geocoder\Provider\GoogleMaps;
use Geocoder\Provider\MaxMindBinary;

return [
    'providers' => [
        /*
        Chain::class => [
            GoogleMaps::class => [
                'en',
                'us',
                true,
                env('GOOGLE_MAPS_API_KEY'),
            ],
            FreeGeoIp::class  => [],
        ],
        BingMaps::class => [
            'en-US',
            env('BING_MAPS_API_KEY'),
        ],
         */
        GoogleMaps::class => [
            'en-US',
            'us',
            true,
            env('GOOGLE_MAPS_API_KEY'),
        ],
    ],
    'adapter'  => GuzzleClient::class,
];

error response:

TypeError: Argument 1 passed to Geocoder\Provider\GoogleMaps::__construct() must be an instance of Ivory\HttpAdapter\HttpAdapterInterface, instance of GuzzleHttp\Client given

/Users/Scott/Code/IOTM/vendor/willdurand/geocoder/src/Geocoder/Provider/GoogleMaps.php:59

Get list of cities come under geometric rectangle bounds

In my app user will select specific area on google map with rectangle, circle or polygon. So from that selected area, i need to list down the cities.

For example user selected rectangle shape on google map with following bounds:

{South West : (37.37015718405753, -105.29296875), North East : (41.64007838467894, -95.80078125) }

So do we have any function for getting cities list using Geocode?

Cannot access private property when trying to access Google Maps results

I am using this to geocode an address and dump the results so I can see them:

$geocode = app('geocoder')->geocode('Los Angeles, CA')->get();
dd($geocode);

this works fine and I can see that it was successful as I can see all the geocoded results for LA.

When I try to begin accessing the results I get this error

Cannot access private property Geocoder\Model\AddressCollection::$addresses

This is using dd($geocode->addresses).

Ultimately I just want to get the latitude and longitude from my gecoded address - how do I do this?

Chain unable to geocode address - Laravel 5.4

I started with a fresh install of Laravel (5.4.12) then added Geocoder

composer require toin0u/geocoder-laravel 

and tested with a route

Route::get('/geocode', function(){
	dd(app('geocoder')->geocode('Los Angeles, CA')->get());
});

Result is ChainNoResult

No provider could geocode address: "Los Angeles, CA".

added guzzle4.0

composer require "guzzlehttp/guzzle" "~4.0"

and changed adapter to Guzzle4HttpAdapter in geocoder.php

'adapter'  => Guzzle4HttpAdapter::class,

Added

use Ivory\HttpAdapter\Guzzle4HttpAdapter;

to geocoder.php

Succesfully geocoded.

Are language and region working?

Good day, thanks you for the great plugin!

return array (
    'providers' => array (
        'Geocoder\Provider\GoogleMapsProvider' => ['fr-FR', 'Île-de-France', true]
    ),
    'adapter'   => 'Geocoder\HttpAdapter\CurlHttpAdapter'
);

return results in English only for me. So are language and region working?

Simple IP lookup generates error

I get the following error:

 Missing argument 2 for Alexpechkarev\GoogleGeocoder\GoogleGeocoder::geocode(), called in /home/vagrant/Projects/athliit/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 210 and defined

When I try to do:

Geocoder::geocode('my-ip-address');

With my config looking like so:

<?php

return [
    // Providers get called in the chain order given here.
    // The first one to return a result will be used.
    'providers' => [
        'Geocoder\Provider\FreeGeoIpProvider'  => null,
    ],
    'adapter'  => 'Geocoder\HttpAdapter\CurlHttpAdapter',
];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.