Try our conversational search powered by Generative AI!

Google Maps and dynamic locations



I have a bunch of Office Cards that i'd like to display on a map interface (Google maps). These Office Cards has 2 properties each, Longitude and Latitude, and I've worked out the following before I completly blacked out. My code consists of a DummyPage where I run everything, a Google Map-webcontrol (with all the scripts set up properly) and so on. I also have a containerpage apart from my epitree-structure where I store the Contact Cards, and two help classes called PageHelper and Maphelper. What i'd like to do is to look at all the children of my container page for the Office Cards and grab the two properties Longitude and Latitude. Here's where im struggling, in Maphelper:


 public class MapHelper

public static Dictionary<string, List<MapPoint>> GetMapPoint()
Dictionary<string, List<MapPoint>> poiLists = new Dictionary<string, List<MapPoint>>();

PageData startpage = Utilities.PageHelper.GetPageWithAccessCheck(PageReference.StartPage);
PageDataCollection pdc = new PageDataCollection(poiLists);
if (startpage.IsValue("OfficePageContainer"))
PageReference pr = startpage["OfficePageContainer"] as PageReference;
if (pr != null)
pdc = DataFactory.Instance.GetChildren(pr);


foreach (PageData pd in pdc)
if (pd.IsValue("Longitude") && pd.IsValue("Latitude"))

//How do I select these and shove em into my map??


Any help or valuable links is greatly apprechiated. Thanks!



Feb 14, 2012 20:02

Also not using PageTypeBuilder :( 

Feb 14, 2012 20:03

Inside your last if statement, if you get this far you know that this PageData object has the requied properties. Not sure how your MapPoint class looks, but I guess it has two properties for Longitude and Latitude that you then can set and add to your collection.

Hard to tell without knowing what you plan to use poiLists for and what MapPoint looks like.



Feb 14, 2012 22:41

Hi Robin,


So if understand correctly you have managed to get the coordinates of the offices and you want to show them on your map?


One option could be to return the list of coordinates and insert them to your page type as inputs in the html:

<input type="hidden" value="longitude,latitude">

And on page load you collect the info from these inputs and outputs them with the google map javascript API.

Look at this example: (

function initialize() {
var myOptions = {
zoom: 4,
center: new google.maps.LatLng(-33, 151),
mapTypeId: google.maps.MapTypeId.ROADMAP
var map = new google.maps.Map(document.getElementById("map_canvas"),

var image = 'images/beachflag.png';
var myLatLng = new google.maps.LatLng(-33.890542, 151.274856);
//use document.getElementsByTagName and loop trough all inputs and create a new marker.

var beachMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image


 More info on the Google map api can be found here:



Made a quick gist to show what i meant:

Edited, Feb 15, 2012 13:22
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.