Followup to SharePoint Contacts List on a Map from Google 

Tags: SharePoint Designer, Web 2.0, Maps

In the Mapping Part 2 Comments, I received two questions I've been meaning to get back to.

  1. Can you do this if your list has latitude and longitude?
  2. How do you add the name to the popup?

Latitude and Longitude

The first step in modifying my example for latitude and longitude is adding the fields.

First I go to List Settings:

Then I create the latitude column:

Repeat for Longitude.

After creating a Collection on maps.live.com with my contact cities, I exported it to KML to find the latitude and longitude. View Collection.kml.

The HTML for the Content Editor Webpart is very similar to Part 1. Download GoogleMapsLatLonCEWP.html and open in SharePoint Designer to view the difference. Instead of a call to the Geocoder Object, we just pass the latitude and longitude fields straight in to new GLatLng as the point for the Marker. Feel free to drag the file from your download folder into a folder in SharePoint Designer to apply to your Content Editor Web Part.

Add Name

The XSLT from Part 2 received two changes for this update. In the showLocation call, I replaced Company with FirstName. I also repaced City and State with Latitude and Longitude in the same part of the stylesheet.

View GoogleMapsListMarkersLatLon.xml. Download to apply to your Data View Web Part.

Live Demo

View the Live Demo, Map Contacts No Geocode.aspx!

 

 

 
Posted by Tom Resing on 23-Dec-08
7 Comments  |  Trackback Url  |  Link to this post | Bookmark this post with:        
 

Comments


Hans commented on Tuesday, 17-Feb-2009
Thanx Tom. What would your approach be for displaying fields from records in the contactlist into Google Map's infowindow? For example, I'd like to display the @Notes field in the window when clicking a marker.


Thomas Resing commented on Friday, 20-Feb-2009
Hans, You can accomplish this in two steps. Modify the xslt to include @Notes after the @Longitude and modify the CEWP html to accept the Notes parameter and show it in the popup. Email me at tresingmicrolinkllc@resing.net if you want more detail. Tom


Bj Price commented on Friday, 6-Mar-2009
Thanks so much for posting this. My feedback is that if there are more than 10 items in the list, numbers 11+ don't appear and the "View next" button isn't available for the data view part of the page (in the XSLT, if I'm right) How do I modify the XSLT to give users the ability to page through the sets of records, and sort on the headers?


Mike commented on Wednesday, 3-Jun-2009
I am also having the same issue with only the first 10 records showing, other than that, everything is working fine with both addresses and lat/long. What is really frustrating me is that it was showing all the records earlier, and I can't figure out what I changed that it is not only showing 10 under both scenarios.


Thomas Resing commented on Wednesday, 17-Jun-2009
Hans, BJ, the 10 item limit has to do with the paging settings. Try playing around with a simple data view web part, changing the paging settings and look at the resulting XSLT changes. I will post a more detailed explanation as a new post when I get a chance. -Tom


Praful Udade commented on Thursday, 11-Mar-2010
It's really sop cool. I am trying to implement it in SharePOint 2010, but AddMarkers() function is not working there and due to this pin points is not displaying. Last time I implemented it succesfully on MOSS2007. Please suggest something!!


Tom Resing commented on Monday, 15-Mar-2010
Praful, Thanks for reading and commenting. Can you share any more detail on what behavior you're seeing including SharePoint Version number? I haven't tried this in SharePoint 2010 yet, but I can't think of any reason it wouldn't work the same. AddMarkers is called in the initialize function which in turn should be called when the page loads by the following line:_spBodyOnLoadFunctionNames.push("initialize"); As far as I know, that should all work the same. Tom

Name:
URL:
Email:
Comments: