I have a content type "Houses".

I added 3 nodes as follows.

  • Node 1 for county X and state A
  • Node 2 for county X and state A
  • Node 3 for county Y and state B.

I like to create a google map block which will show 2 in County X in google map and 1 in County Y section in google map.

Below is an example

Google doc

Update 1



Use Geofield_map module:

Geofield Map is an advanced, complete and easy-to-use Geo Mapping solution for Drupal 8, based on and fully compatible with the Geofield module, that lets you manage the Geofield with an interactive Map both in back-end and in the front-end.

It represents the perfect solution to:

geolocate (with one or more Locations / Geofields) any fieldable Drupal entity throughout an Interactive Geofield Map widget; render each Content's Locations throughout a fully customizable Interactive Geofield Map Formatter; expose and query Contents throughout fully customizable Map Views Integration; implement advanced front-end Google Maps with Marker Icon & Infowindow advanced customizations, custom Google Map Styles and Marker Clustering capabilities; customize Map Geometries properties (Lines & Polylines, Polygons, Multipolygons, etc.), based on Google Maps Polygons APIs;

Take a look at Demo.

So, in summary, you need to install this module and add it to your content type. then with creating a custom view, you can achieve what you want.

  • Thanks! I will try it. I heard that I need to have paid google cloud account in order to have that type of google map. I will search on it. – GreenTree Feb 23 '20 at 4:44
  • @GreenTree no problem. for a specified amount requests per day, it's free but in high requests, you should pay. let me know who it goes with you. because question is about the solution. – Yuseferi Feb 26 '20 at 5:29
  • Thanks again! I have an example map. I am trying to follow the steps. It seems to me I am stuck. I am still researching. If we could chat in a chat group, it will help. Please see the google drive link above. Thanks! – GreenTree Mar 24 '20 at 19:30
  • I got the API from this page. developers.google.com/maps/documentation/geocoding/get-api-key. I get error when I use the API "This API project is not authorized to use this API.". I guess this API is not allowed to get the geocoding coordinates? Is there any free google API to get the geocoding coordinates? – GreenTree Apr 3 '20 at 16:59
  • @GreenTree, I guess you can create a google API key, but there will be some limitation on number of requests per day for that in free mode usage. – Yuseferi Apr 4 '20 at 9:44

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.