CharlesD



If you look at my map I have a GeoRSS layer and also a search box off to the left. What I would like to do is take that search box and put it inside the popup info bubbles, so I can get directions to my points. I would like some pointers on how to format the GeoRSS to accomplish this.

Thanks



Re: Georss HTML formating Question

Derek Chan


If you really need to put it into the XML data then you can fit it inside a tag. However I would advise against this as:
1) You can do it through the shapeLayer programatically which is easier than directly in the data
2) If you need it for all pins, you'll need to add it to all your XML entries (making your file extremely large)
3) The file will look really messy (because you need to escape special characters inside XML) and debugging it will be difficult

To demonstrate 3), take a look at this tag that is basically a link that when clicked alerts "hi" and redirects to helloworld.com

Code Snippet
<description>&lt;a href=&quot;http://www.helloworld.com&quot;onclick=alert(&quot;hi&quot;);&gt;&lt;a;&gt;click to go to helloworld site</description>



You can do something similar with encasing <div> tags too but I would something like re-drawing the pins in your layer and setting the <div> box inside the description before you plot them back on

Hope that helps,





Re: Georss HTML formating Question

CharlesD

Yes putting it all in the XML would be too much.

Basically I want to set up something like maps.live.com, where you have a point, you click on that point and it has an option "drive from" or "drive to". Then a box would appear and you could type in your address and then it would send you to a new map with the directions. Im just not that good with the java to figure that out... Any examples of this out there





Re: Georss HTML formating Question

Derek Chan

Sure what you could do is attach div tags inside your SetDescription() method. Inside each it fires a javascript along with the VELatLong's using the GetPoint method. These are passed to hidden div tags on the map which in turn are grabbed when say a button (in this case, btngenerateroute) is clicked.

Here's some rough javascript code to get you going:

Code Snippet
VEShape.SetDescription("<div onclick='SetOrigin(VEShape.GetPoint());'>Drive From</div><div onclick='SetDestination(VEShape.GetPoint());'>Drive To</div>");
function SetOrigin(ArrayLatLong)
{
document.GetElementByID('OriginLatitude').value = ArrayLatLong[0].Latitude;
document.GetElementByID('OriginLongitude').value = ArrayLatLong[0].Longitude;
}
function SetDestination(ArrayLatLong)
{
document.GetElementByID('DestinationLatitude').value = ArrayLatLong[0].Latitude;
document.GetElementByID('DestinationLongitude').value = ArrayLatLong[0].Longitude;
}

//You'll need a separate html button that triggers this function
function GenerateRoute()
{
VEMap.GetRoute(new VELatLong(document.GetElementByID('OriginLatitude').value, document.GetElementByID('OriginLongitude').value), new VELatLong(document.GetElementByID('DestinationLatitude').value, document.GetElementByID('DestinationLongitude').value));
}






Re: Georss HTML formating Question

CharlesD

Derek,
I played with to for a bit, couldn't get it to run. I will need to see it in action to make sense of it. Thanks