0

I have installed the Geofield module, created a new content type, and added a geofield field.

When I start to add nodes with latitude and longitude, those values aren't saved. Editing again the same node doesn't show any value for latitude and longitude.

What I'm trying to do is to install the Leaflet module, so I need to save the values first with the Geofield module.

screenshot

5
  • How did you install the module, which version, GeoPHP library? Did you check Status Report for any errors? What exactly are you entering into the Lat. and Long. fields?
    – prkos
    Commented Aug 27, 2020 at 23:46
  • I installed the new version 8.x-1.15 released 7 June 2020, it says I don't need to install geoPHP because it's mentioned this module is not depending on GeoPHP module anymore. this what show me in log reports ( Warning: call_user_func_array() expects parameter 1 to be a valid callback, class '\geoPHP' not found in Drupal\geofield\GeoPHP\GeoPHPWrapper->load() (line 21 of /home/xsxcjnwgpjl6/public_html/modules/geofield/src/GeoPHP/GeoPHPWrapper.php)
    – Ella
    Commented Aug 27, 2020 at 23:52
  • 1
    Correct, it doesn't depend on the GeoPHP module any more, because they switched it to depend directly on the GeoPHP library, which is why they recommend use of Composer to install it. Are you using Composer? It is possible to install it manually, Composer simplifies the process, but you're stuck with maintaining it too.
    – prkos
    Commented Aug 27, 2020 at 23:58
  • Is there another way to use the composer than manually, I don't have experience with this, and actually I have the drupal on Cpanel , so I don't know how to use composer in this case?
    – Ella
    Commented Aug 28, 2020 at 0:39
  • In my case, I used to have Geofield installed manually and facing the same issue of not saving Lat and Lon values. Upon reading the latest note "Since 8.x-1.0-alpha2 version, this module is not depending on GeoPHP module anymore. The Drupal 8 version of Geofield module needs to be installed using Composer...", I re-installed module via composer, and issue solved. Commented Nov 10, 2020 at 20:19

1 Answer 1

1

Geofield module doesn't work without the GeoPHP library. You need to download both the module and the library and place them in the correct locations in order for the module to work.

When using Composer to install Drupal and modules the library is automatically downloaded to the correct place.

If you're not using Composer you can do that process manually. You probably already downloaded and installed the module Geofield in the common location /web/modules/contrib.

Now you have to download the GeoPHP library, you probably want the latest stable version, from the page noted on the Geofield documentation: https://github.com/phayes/geoPHP

The library is compressed, so you need to extract the archive file to get the folder with the library files. Then place that folder in your Drupal installation, usually in /vendor folder that is within Drupal root folder, so you end up with something like /vendor/geophp/ (I haven't checked the exact path and name).

Check the Status Report that the library is available and read properly by Drupal. Sometimes you need to adjust the library file permissions or ownership so Drupal can use it but I don't expect problems in cPanel.

Not using a Composer makes maintaining your site more difficult. You'll have to do updates manually and check for all dependencies yourself.

If you can invest a bit of time and use your computer for development you should install Composer and use it to build your Drupal site. Then just upload the resulting files to cPanel to host your site, but always keep a local copy with Composer to do the updates and maintenance.

4
  • Thank you so much for your help, I have one more question when I extract the library folder for the geophp , it showing me 2 other folders (adapters , and geometry ) which one I need to upload to vender folder?
    – Ella
    Commented Aug 31, 2020 at 16:03
  • You have to upload the entire "geophp" folder, not only the "lib" subfolder that contains the "adapters" and "geometry". So you should upload the entire contents of "geophp" folder with all its subfolders.
    – prkos
    Commented Aug 31, 2020 at 17:45
  • I did upload all the files for the geophp folder with all subfolder inside ( public_html/core/assets/vendor) still can't save the lat-long ?
    – Ella
    Commented Aug 31, 2020 at 21:09
  • To be honest I have tried this solution but never worked for me. The reason I tried the manual way is because composer was getting the memory exhausted. Common issue with composer which I hope will be solved in the next versions. Anyhow, I added some more memory to my cloud server and installed Geofield normally through composer (composer require 'drupal/geofield') and that was that.
    – pierostz
    Commented Sep 2, 2020 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.