More in this section

Forums / General Discussions / Integrate google map in SF 4.4

Integrate google map in SF 4.4

3 posts, 0 answered
  1. Rakesh
    Rakesh avatar
    72 posts
    11 Jan 2011
    27 Feb 2012
    Link to this post

    how can I integrate Google map with multiple locations in my sitefinity 4.4 project.
    if anyone knows please help me..
    its urgent ....

    thanks in advance..
  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    18 Feb 2004
    27 Feb 2012
    Link to this post
    Hi Rakesh,

    You could for example built a custom module to store the locations (Title, Description, GeoLocation)

    Then you could create a custom widget that initializes a Google Map and the markers. You can do this all from javascript and the only thing you should take care of is to add a array of markers, based on your GeoLocations.

    Here is a sample code on how to build an array from code:
    private void BuildMarkersArray(IQueryable<ProjectItem> projects) {
               var sb = new StringBuilder();
               sb.Append("var markersArray = [];");
               sb.Append("markersArray = [");
               foreach (var item in projects) {
                   if (!string.IsNullOrEmpty(item.ProjectLocation)) {
                       // Construct the infowindow content
                       string content = BuildInfoWindowContent(item);
                       sb.Append("['" + item.ProjectLocation + "', '" + content + "'],");
               sb.Remove(sb.Length - 1, 1);
               // Get a ClientScriptManager reference from the Page class.
               ClientScriptManager cs = Page.ClientScript;
               Type cstype = this.GetType();
               string scriptImages = "ScriptImages";
               var sbImages = new StringBuilder();
               sbImages.Append("var imageIcon = '" + Page.ResolveUrl("~/Assets/Images/gmarker.png") + "';");
               sbImages.Append("var imageShadow = '" + Page.ResolveUrl("~/Assets/Images/gmarker-shw.png") + "';");
               if (!cs.IsStartupScriptRegistered(cstype, scriptImages))
                   cs.RegisterStartupScript(cstype, scriptImages, sbImages.ToString(), true);
               // Define the name and type of the client scripts on the page.
               string scriptName = "LocationList";
               // Check to see if the startup script is already registered.
               if (!cs.IsStartupScriptRegistered(cstype, scriptName))
                   cs.RegisterStartupScript(cstype, scriptName, sb.ToString(), true);

    You can find the documentation of the Google Maps API (javascript) here:

    If you need any more help, let me know.

  3. Rakesh
    Rakesh avatar
    72 posts
    11 Jan 2011
    27 Feb 2012
    Link to this post
    Hi Daniel,

    Thanks for your replay.Let me try it...
3 posts, 0 answered