This is a task to track the progress of the Upgrade of the Geocoder module to Drupal 8.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bforchhammer’s picture

I have been working on a fork of the D8 version, which focuses on integrating the geocoder php library with the geofield module... My code is currently on github only.

I am not quite ready to post a patch yet, just posting this here so we don't duplicate efforts. Most of my changes are in a submodule geocoder_geofield, so it should be relatively easy to merge with the current 8.x-1.x branch. :)

bforchhammer’s picture

Status: Active » Needs review
FileSize
14.68 KB

Here's a patch which provides service-side geocoding for geofield values. The patch adds an option to all geofield widgets to enable geocoding. Source fields for the geocoding searchstring can be text fields and addressfields (I only tested with webflo's D8 fork). The code considers all widgets which inherit from one of the common geofield widgets, which means that it can also be used with my geofield leaflet widget... :-)

brathbone’s picture

I tried out this patch. To get it to work I had to change some of the naming in the widget code, as well as renaming the widget code file. I also added the basic ability to geocode from an Address field.

brathbone’s picture

I've made an edit to the previous patch. I've removed the unnecessary change it made to geofield.info.yml, which causes a complaint when applying the patch. Applying the patch now works without issue.

brathbone’s picture

FileSize
24.97 KB

Realized the last patch made my previous namespace change unnecessary. Fixed in this patch.

balagan’s picture

Why are you using the guzzle library, when it is deprecated in favor of guzzlehttp, which in turn is included with drupal 8?

samuel.mortenson’s picture

Taking a crack at this, should have a new incremental patch today/tomorrow.

samuel.mortenson’s picture

Actually it looks like https://github.com/bforchhammer/geocoder is ahead of the patches here, so maybe we just need to pull a new patch based on that?

Luckily I didn't spend too long making my own patch. :-)

Pol’s picture

Hi all,

I'm working on the version 2.x of Geocoder, it's now based on Geocoder PHP library.
You can find the repository here: https://github.com/drupol/geocoder

It's still in heavy development but it's getting along pretty nicely.

The Drupal 8 version could also be based on the same code, as I'm using Service Container for the 2.x.

Let me know what you think.

Thanks.

samuel.mortenson’s picture

This is getting sticky, to summarize we now have:

  1. A Github port that is ahead of the patches in this issue.
  2. The most recent patch in this issue, which while based on the Github port contains code that is not in that repository (Address support, for example).
  3. A 7.x-2.x development repository for Geocoder, which if we concurrently port to Drupal 8 could be confusing for new users.

Not sure what the best path forward is here, unfortunately.

Pol’s picture

Hi,

Sorry I should have explained a bit more.

You're right, I'm just posting this here so you're aware that there's a new branch of the module and that you can use exactly the same basecode in Drupal 8 if you want.
Of course, right now, only the two api functions are implemented, there's still a lot of work to do to include the formatter and stuff... but we'll getting there very quickly now that the API is rock solid.

Pol’s picture

Hi all,

Here's the version 2.x of the module: https://github.com/drupol/geocoder/tree/8.x-2.x
Please, test it and let me know what you think.

Have a nice day.

mv1st’s picture

I'm assuming the patches above are for alpha 3 but I can't get them to apply to that or the dev. Is there anyone willing to share their working files. Using this on a few older sites and really want to test it out on 8 but keep getting 500 error.

Thanks.

geekygnr’s picture

@mv1st I think those patches are for the 8.x-1.x branch. That is where I have been applying #5 and it solves some problems but the module still doesn't work.

With #5 applied to 8.x-1.x I have run into this problem, which I haven't solved yet.

At this stage I don't know if 8.x-1.x or 8.x-2.x is closer to being completed but I don't think either are complete solutions when using this module for fields.

geekygnr’s picture

I have worked more with 8.x-2.0-alpha3 and found that it requires PHP 5.6 to work.

If you remove the third function parameter from the array_filter calls and the second parameter from the call backs in those functions it seems to work for PHP 5.5.

geekygnr’s picture

I have gotten things working with PHP 5.6

One big issue I have is there is no configuration area to declare a google API key which I have already put into a separate issue: https://www.drupal.org/node/2699861

I am having another issue where some of the addresses can't get a result but I can't figure out what is causing that problem until I figure out how to put in an API key.

geekygnr’s picture

I have managed to track down the second issue in #16.

It is now recorded here https://www.drupal.org/node/2701493

Pol’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev

I've updated the 8.x-2.x version with a lot of changes.

Props at @Claudiu Cristea who rewrote most of the module using best Drupal and coding practices.

Let me know what you think.

zerolab’s picture

With an alpha5, does this issue still need to be open?
If so, could it be repurposed into a roadmap meta issue for the stable 8.x-2.0 release?

itamair’s picture

Status: Needs review » Closed (outdated)