Showing posts with label pushpin. Show all posts
Showing posts with label pushpin. Show all posts

Wednesday, March 28, 2012

Very rich data to be presented in pushpin popup - how to?

Hello,

suppose we have a list of objects retrieved from a webservice which we want to present in Virtual Earth Map as a set of pushpins. And one of fields of the object (presented in one pushpin) is another list. For example consider object of the following class:

1public class Point2{3string city;4string lat;5string lon;6 List<Person> list;7}
 wherePerson is another class like:
 1public class Person2{3string firstname;4string lastname;5string about;6}  

Now, I need to make a pushpin from every Point object of the list retrieved from the webservice. That's the easy part. :)

My problem is how to present the list of - let say - lastnames from List<Person> list in pushpin popup. Any ideas how to do it in a declarative way?

I'm still using the Atlas, not ASP.NET AJAX.

Please! Any help! I'm so confused :)

Hi,

check the mashup in my signature, it performs something similar, but with a list of images. You can download the source code.


Wow. This is a very nice application. :)I'm studying it hard.

Maybe you know some good sources of information about xml-script?


Just wondering, is your demo updated for the Beta release?

Hi,

no, at the moment it works only with the July CTP.


So, any clues where to find information about programming Atlas in a declarative way (by XML-script)?

Your demo is excellent example, but still example and I would love to learn all of it :) The old Atlas documentation is not available. Maybe someone has it?

Virtual Earth - Pushpin Layer not Updated

i'm trying to implement geotagging on my website that allow my blog reader to add themselves to the map using pushpin.under my map i've several field for the users to key in their details then upon clicking the "add" button... their details will be appended to a georss xml file... and this step works fine as the details can be appended without problem... but when the page refreshes after my user hav clicked the "add" button... the details added are not shown... and even click "refresh" on IE wont help... all i got to do to get the newly added details shown is to close the current IE and re-request the page in a new IE... then all the pushpins(including the last pushpin added) can be shown... y is this problem occuring? am i doing anything wrong??Thanks,Any chance you can post the code so I can see if you are doing anything wrong?

Thanks for your fast reply...well... here's my code:

to load the map:

1 var map = null;2 var layerid = 1;34 function AddMyLayer()5 {6 var veLayerSpec = new VELayerSpecification();7 veLayerSpec.Type = VELayerType.GeoRSS;8 veLayerSpec.ID = layerid;9 veLayerSpec.LayerSource = 'Location.xml';10 veLayerSpec.Method = 'get';11 map.AddLayer(veLayerSpec);12 }
to add pushpin and get the position:
1 function AddPin()2 {3 var pin = new VEPushpin(4 pinID,5 map.GetCenter(),6 null,7 null,8 null9 );10 map.AddPushpin(pin);1112 if (pinID != 1)13 {14 var intpin = pinID - 1;15 map.DeletePushpin(intpin);16 }1718 document.getElementById('<%=lblPosition.ClientID%>').innerText = map.GetCenter();19 pinID++;20 }
asp.net code to store position and details to XML
1Protected Sub btnAdd_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)2Dim xmldocAs New XmlDocument3 xmldoc.Load(Server.MapPath("Location.xml"))4Dim eleItemAs XmlElement = xmldoc.CreateElement("item")5Dim eleTitleAs XmlElement = xmldoc.CreateElement("title")6Dim textTitleAs XmlText = xmldoc.CreateTextNode(txtName.Text)7Dim eleBlogAs XmlElement = xmldoc.CreateElement("link")8Dim textBlogAs XmlText = xmldoc.CreateTextNode(txtBlog.Text)9Dim elePositionAs XmlElement = xmldoc.CreateNode(XmlNodeType.Element,"georss","point","http://www.georss.org/georss")10Dim strPositionAs String = Request.Form("lblPosition") // to get position11Dim textPositionAs XmlText = xmldoc.CreateTextNode(strPosition)12Dim eleDescAs XmlElement = xmldoc.CreateElement("description")13Dim textDescAs XmlText = xmldoc.CreateTextNode(txtDesc.Text)1415 eleItem.AppendChild(eleTitle)16 eleTitle.AppendChild(textTitle)17 eleItem.AppendChild(eleBlog)18 eleBlog.AppendChild(textBlog)19 eleItem.AppendChild(elePosition)20 elePosition.AppendChild(textPosition)21 eleItem.AppendChild(eleDesc)22 eleDesc.AppendChild(textDesc)2324Dim rootAs XmlElement = xmldoc.Item("feed")25 root.AppendChild(eleItem)2627 xmldoc.Save(Server.MapPath("Location.xml"))2829 Response.Redirect("Map.aspx?Session=" + DateTime.Now.Millisecond.ToString + DateTime.Now.Second.ToString + DateTime.Now.Minute.ToString)3031End Sub
so what do you think? is that the XML is being cache by Virtual Earth? so even the XML is updated... but VE is still refering to the cache data?
thanks... 

Actually I do not see anything wrong as far as I can tell. What do you get on this line?:
document.getElementById('').innerText = map.GetCenter();My only guess is you don't get the right Client ID? Otherwise I'm lost sorry

document.getElementById('').innerText = map.GetCenter();
this line is to get the position of the pushpin to be stored in the XML file...

actually as you said... the code has no problem and is working fine... it can add pushpin on the map... and after clicking "Add" button... all the information such as Name, position etc. can be appended to the XML file...

but now the problem is... even all the information are appended correctly... but the appended information cannot be shown...

let say i've one set of information in my XML file... then when the first time i start my page... the pushpin can be shown on the map... then i add another pushpin... and click "Add"... the page refreshes... appending the XML file... but the map(or the pushpin layer) is not updated...

i have to close my IE and restart it to get my second pushpin to be shown... refreshing wont help... neither does CTRL + F5... that is the only problem which i think is VE's problem... haha...

any clue? haha...