Dear all,

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 using Geocoder module, 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()

In the Geofield field options, I can select several plugins for Geocoder, 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.

Regards,

Remi.

Comments

khalimero created an issue. See original summary.

f0ns’s picture

Hello, I have the same issue as described above. Did you find a way to solve this already?

I have checked the following file geocoder/src/Geocoder/Provider/File.php

And it looks like it just isn't made to read out a GPX file since it uses the exif_read_data() function. When I check the PHP docs it states that this function is used to Read the EXIF headers from JPEG or TIFF files.

The only way to make this work is to code my own Provider to handle reading out GPX files.

jeffschuler’s picture

bloomt’s picture

It appears that the module is just not ready for KML files yet

itamair’s picture

Last releases of the module implement FILE Exif GPS, GPX, KML and Geojson geocode and formatting capabilities on uploaded images/files.