We need to pass the api key of the active plugins as per geocoder latest update. See readme.txt .
$addressCollection = \Drupal::service('geocoder')->geocode($address, $plugins, $options);

Options contains api key and other required configuration. Without api key you will get an error Daily quota exceeded, sometimes it successfully geocode the address even if you don't pass any api key. Google might allow only 2-3 times without an api key. Check here http://maps.googleapis.com/maps/api/geocode/json?address=Hogansville%2C%... and refresh 2-3 times. You will get an error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dbjpanda created an issue. See original summary.

dbjpanda’s picture

Status: Active » Needs review
FileSize
2.15 KB

Fixed the error and adjusted some coding standard issue.

nicrodgers’s picture

Ran in to exactly the same problem, spent ages debugging it, came to the same conclusion as you, wrote a patch, came here to upload it... then found this patch was already here :-D

thanks, applies cleanly and solves the problem.

RTBC but leaving it as needs review until the tests have run/passed.

dbjpanda’s picture

@nicrodgers Test fails due to some issue in Recursive prefix data type and a part of rpt_map_widget module. We may open another issue for this.

dbjpanda’s picture

Status: Needs review » Reviewed & tested by the community
borisson_’s picture

Status: Reviewed & tested by the community » Needs work

The coding standards in the patch are not following the drupal coding standards, everything seems to be intented with 4 spaces instead of 2. We should fix that.

ankitjain28may’s picture

Status: Needs work » Needs review
FileSize
6.88 KB
7.08 KB

Fix Coding standard for the above patch and for other files too, Added interdiff. Please review.

nicrodgers’s picture

Status: Needs review » Needs work

To keep things simple, I'd suggest the patch for this issue should only address the issue described in the summary. Raise follow-ups for any coding standard issues instead of trying to fix them here.

dbjpanda’s picture

Search_api_location.Drupal\Tests\search_api_location_geocoder\Kernel\GeocodeTest error should be addressed in the patch.

ankitjain28may’s picture

@nicrodgers Sure, I will make another patch. Thanks.

ankitjain28may’s picture

Status: Needs work » Needs review
FileSize
1.65 KB
1.86 KB

Interdiff and patch for the above stated issue.

Status: Needs review » Needs work

The last submitted patch, 11: api-key-2954999-11.patch, failed testing. View results

ankitjain28may’s picture

I am getting this error while running Kernel tests, I tried installing packages using composer but still getting the same error.
Even other plugins like 'geoId' is also not found.
Do i need to install any other packages ?

ReflectionException: Class \Geocoder\Provider\ArcGISOnline does not exist
mollux’s picture

Status: Needs work » Needs review
FileSize
3.02 KB
3.48 KB

@ankitjain28may, not sure what the issue with the tests is, I was able to run them without problem.

I rerolled the patch and used dependency injection to load the geocoder config.
It is also not necessary to filter the config for the active plugin, the Geocoder module doesn't do that either, see e.g. GeocodeFormatterBase::viewElements

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Changes here look very solid.

GeorgeBC’s picture

Tested this and works exactly as designed. Thank you!

jigarius’s picture

I was about to submit a patch but I found this one. Works for me. Thanks!

However, I believe this is more of an issue with the Geocoder module. It should be aware of its configuration.

  • mollux authored 8cf12af on 8.x-1.x
    Issue #2954999 by ankitjain28may, mollux, dbjpanda, nicrodgers,...
mollux’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Amsterdam2019

Thanks for the feedback.
Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.