I have two content types

  1. Location that geocodes an addressfield to place markers on the map
  2. Boundary that uses a geojson field to create complex shapes on the map

I need to use views to show both content types on the same map. It appears that I can only do one or the other.

For an example, think about a map that shows constituency boundaries and voting stations.

3 Answers 3


Nigel Waters has it correct. Here are the details. I did this for cities and states. I used points for cities and polygons for states. Here are the steps.


  • Geofield module
  • Leaflet module
  • Leaflet Views module (a submodule of Leaflet)


  • Create the two content types: City and State.
  • Create a field of type Geofield, call it "Location"
  • Choose GeoJSON as the field widget
  • Add the Location field to both content types
  • Create a city. For location enter GeoJSON Point data
  • Create a state. For location enter a GeoJSON Polygon data
  • Create a view with a Page display
  • Add the Location field to the view
  • Filter the view by State and City content types
  • Set the Format of the view to Leaflet Map
  • Your view should now look like pic 1
  • Click on View Page
  • You should see a map like pic 2

View enter image description here


To answer my own question is to use the same field on both content types. I used a geojson (geofield) field which accepts both points and polygons to merge into a single leaflet map in views.

  • mmm... it would be very interesting to get a more deep explanation about did you do that... thanks in advance Commented Aug 7, 2014 at 16:07
  • I am not going to write out an entire tutorial as I don't have the time. Just add a geofield of type "geojson", then just add your points and polygons using geojson. I found the following site very helpful to draw out what i needed and then I just pasted the json directly into the field of my content type. geojson.io Commented Aug 8, 2014 at 17:13
  • No need to write a tutorial. I see your geojson is not dynamic (I need create map based on views) so its not useful for me. Thanks in any case. Commented Aug 11, 2014 at 8:44
  • It is dynamic. I use views to place the markers on the map and a proximity search function. Commented Aug 14, 2014 at 14:36

To show multiple content types in the same View:

  • Edit your view
  • Under "Filter Criteria" click "Content: Type"
  • Select both content types under the "Content types" section
  • Click Apply
  • Could you add 2 screenshots? One that shows configuration needed, and other that shows both points and polygons actually displayed in the same Leaflet map?
    – Mołot
    Commented May 5, 2014 at 8:49
  • @Molot It doesn't matter. This doesn't answer the question. The question is not how to add two content types to a view. The question is how to add to content types to a leaflet map. THe leaflet map settings in a view only allow for one field from one content type. Commented May 6, 2014 at 16:05
  • @NigelWaters if module clearly disallows what you are trying to do, it is a feature request and should be posted in module's issue queue rather than here. Unless you are trying to code a fix - in that case, show the code you are using, or the part of code that is relevant to the question.
    – Mołot
    Commented May 7, 2014 at 6:25
  • The module does not "clearly" disallow what I am trying to do. The Leaflet API definitely allows this and there are also several Drupal examples of combining these features into one map. I was hoping that one with experience could point me in the right direction. Commented May 7, 2014 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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