I have a text field(named as address) in my content type and I will store the address in that text field. Here I don't want to store the address in geolocation field so I have to use text field to store address.

I just created the View with page and have set Format as "Geolocation Google Maps API - CommonMap". In that Format settings I have to set Geolocation source field to display the Map. But I can't able to set Content type Text field as Geolocation source field.

Is there any way to set Content type Text field as Geolocation source field?


Map formatters usually only take geolocation data in order to display them (latitude and longitude for example). There is a way to "convert" a textual address into geolocation data with the help of a Geocoding service.

So you do have to create a geolocation field. You can set it to automatically take the address and convert it to points on a map, and you can hide this field from users. It's a problem though if the address someone enters isn't correct in some way.

With the geodata ready in that field you can set your views map to use that field as the source for geo points on a map.

Here's a comparison of modules that can help you with this: Comparison of Mapping modules.

It seems your best bet is Geofield Well Known Text and Geocoder.

  • So, Do I need to store the address in Geofield instead of Text field? Can you please explain in detail or let me know how to convert Text field address into Geolocation source field?
    – Drupal Dev
    Nov 17 '18 at 2:24
  • You need both fields, the usual text address for humans to enter information, and the other geofield that can be configured to automatically "read" the address and save the geo numbers, so users dont have to do anything except type the address. I'm not sure if you'll need to replace your text field with WKT field to make it work. WKT gives you suggestions as you type so it minimizes errors.
    – prkos
    Nov 17 '18 at 2:56
  • You can find configuration steps on Geocoder documentation page drupal.org/node/1355780
    – prkos
    Nov 17 '18 at 3:00
  • Actually users will not enters the address in that content type fields. The text address mapped with Salesforce field when cron run. Now I am getting the text address values. But getting the address in Text field in drupal instead of Geofield. So let me how to convert this to geofield source to display map in view.
    – Drupal Dev
    Nov 17 '18 at 3:08
  • Follow the steps from Geocoder doc to create a geofield with geocoder and configure it to use your text address as source. It should work if your Salesforce has correct addresses.
    – prkos
    Nov 17 '18 at 3:13

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.