I am using Drupal 8 and I am trying to display a map of a Geofield field, using Leaflet. This part works as expected when I manually enter coordinates into the Geofield.

But problem comes with the geocoding part : I set up a File field to store a KML file. When the Geofield is told to geocode from the KML file field, each time I create or modify a content, two messages are shown :

  • a warning about the fact the file "cannot be geocoded",
  • an error saying that Drupal "could not find geo data in file" xxx.

Checking the Drupal log adds an interesting information : there is a php warning with a huge message starting with :

Warning : exif_read_data(test.kml): File not supported in Drupal\geocoder\Geocoder\Provider\File->geocode()

The problem may come from the Geocoder plugin I use for the Geofield geocoding : I can select several plugins in the field management section, all of them apparently dealing with address geocoding, except a "File" plugin. I tried to check only this latter, or all, with the same failing result.

I thought the 'File" Geocoder plugin would be able to deal with KML, GPX... but it may be only for pictures shot containing exif data. Is there a specific plugin for KML files ? And what is the way to make it appear in the Geofield management ?

Anyway, I have tried for hours to find a solution, without any success for any file types (KML, GPX...).

Any help would be greatly appreciated.




I had a similar problem but not with leaflet. It seems the geocoder could not parse kml files with polygons, only points. I had some railroad routes that worked fine on google earth but not in drupal 8. I redrew the routes that were "single lines" and it worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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