Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Drupal 7: How to add multiple location to a single node with gmap and location?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 205
    Comment on it

    For this you have to install these modules :-

    •     views
    •     geophp
    •     geocoder
    •     geofield
    •     addressfield
    •     libraries
    •     leaflet
    •     ip_geoloc

     

    Then Run these two Drush command :

    drush dl views geophp geocoder geofield addressfield libraries leaflet ip_geoloc

     

    drush en views geophp geocoder geofield addressfield libraries leaflet ip_geoloc


        
    LIBRARY :-
     First you have to install the Leaflet library. Download the latest version of the library "http://leafletjs.com/download.html". Extract it into "sites/all/libraries/leaflet/dist". Then create the libraries, leaflet and dist directories if they not exist. Verify leaflet.js file, whether it located in "sites/all/libraries/leaflet/dist/leaflet.js".

    CONTENT TYPE :-
       Then create a map that displays your locations.

       Create a content type called <Content Type Name>. For mapping we have to add few fields.
            => Add a field 'Location <Field Name>'.
            => Input address as the field type.
            => Dynamic address form is the only choice for widget.
            => No need to change the default settings.
            => Add another field called Geofield.
            => Select Geofield as the field type.
            => Select Geocode from another field as the widget.
            => Set storage backend to default.
            => Set this field required.
            => Set geocode from field as the Location field created in the last step.
            => Select Google Geocoder in the geocoder list.
            => The rest of the options should be fine as default.
            
    Now our content type will take an address and geocode it into coordinates that can be mapped. Now we use leaflet and views to display multiple location. Add a few locations in your newly created content type before proceeding.
        
    VIEW :-
        Create a view.
            => Name it.
            => Show content of type you have just created.
            => Check Create a page option.
            => Display format: Map (Leaflet API, via IPGV&M).
            => Remove whatever is in the item to display text field.
            => Uncheck pager.
            => Click "Continue and edit" button.
            => Add the Geofield field you have created in your content type.
            => Formatter: Well Known Text (WKT).
            => Data options: Use full geometry.
            => Edit format setting: Map (Leaflet API, via IPGV&M).
            => Map: Only one option out of the box. Use leaflet_more_maps module to have more options.
            => Set your map height according to your need.
            => Name of the latitude field in views query: Content: Geofield.
            => Name of longitude field in views query:
            => Save your view.
        
    Check your newly created page type view. Now you can see the content you created earlier displayed. When you click on the pins you will see whatever fields you have set up in the view. If you want to see more information then add the relevent fields to your newly created view.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: