In the Mapping Part 2 Comments, I received two questions I’ve been meaning to get back to.
- Can you do this if your list has latitude and longitude?
- 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.
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.
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.
You can see what it looks like live in the screenshot below.