I have used this module with great success with Google Maps, but we have a client currently who wants to use Mapbox instead of Google Maps.

Comments

mike.davis created an issue. See original summary.

derjochenmeyer’s picture

I'd like to add support for other geocoding and/or maps services. Any patches are very welcome ...

mike.davis’s picture

Version: 7.x-1.6 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new18.26 KB

I have looked at how the Google Maps submodule is built and I have built another submodule which provide support for Mapbox.

mike.davis’s picture

StatusFileSize
new19.29 KB

Hi @derjochenmeyer,

Here is an updated patch with adds the ability to set the default zoom level for the Mapbox map as well as adding the ability to set the marker by clicking on the map.

Please review as I feel that this would be map a nice addition to the geolocation module.

Thanks
Mike

Status: Needs review » Needs work

The last submitted patch, 4: add-support-for-mapbox-2632628-4.patch, failed testing.

The last submitted patch, 4: add-support-for-mapbox-2632628-4.patch, failed testing.

juliencarnot’s picture

Would love to use OSM or Mapbox with geolocation field in D8 someday, so I gave it a try on a Drupal 7 instance at ply.st with the latest patch (#4)!

I enabled the submodule, added a geolocation field, to the basic page content type. I could choose Mapbox from the Field tab as a widget, but could not see a Mapbox option in the Display tab.

When creating a node, the Mapbox widget doesn't load and the Locate search button doesn't work. No network errors. Didn't check if views style are included, as Views was not on that test instance.

mike.davis’s picture

Hi @juliencarnot, thanks for having a look at my patch.

Did you add your Mapbox access token in the Mapbox admin settings at all - Mapbox won't work unless this is set?

juliencarnot’s picture

Right, I knew I was missing something and skipped the config screen, seing no config shortcut in the Modules pages. Google Maps & Drupal 8 habits I guess! The input widget works well. I guess it could pretty easily include some nice features for mobile such as auto getCurrentPosition / radius accuracy and refinements in initial centering.

Do you plan to extend this submodule to a display formatter and a Common maps style for View? Any plans for D8 support down the line? Anyway, thanks for sharing your patch!

derjochenmeyer’s picture

Any idea why the last patch fails?

juliencarnot’s picture

FYI, seems like Leaflet for Drupal 8 could support displaying geolocation_field data soon, see this patch and the comments below.

Might be a good way to get support for mapbox and many more map sources!

christianadamski’s picture

Component: Geolocation field » Geolocation Field / Backend
Status: Needs work » Closed (won't fix)

Closing all 7.x issues. It's time.