Geeks With Blogs

News



Add to Google

Tim Hibbard CEO for EnGraph software

I'm trying to get Google Maps and Yahoo Maps to play well together with Where's Tim. Not quite there yet, but getting close.

http://www.timhibbard.com/wherestim2.aspx

Trying to work in URL query strings too:
http://www.timhibbard.com/wherestim2.aspx?google
http://www.timhibbard.com/wherestim2.aspx?yahoo

Technorati Tags: Yahoo Maps, Google Maps, Where's Tim

Posted on Monday, November 7, 2005 6:05 PM Mapping , Where's Tim | Back to top


Comments on this post: Playing with Yahoo maps API

# re: Playing with Yahoo maps API
Requesting Gravatar...
Hi Tim,

I am trying to use the Yahoo Map API do display the image, it works find if I hardcode the value in this function

var myPoint = new YGeoPoint(37.4041960114344,-122.008194923401);

This is what I want now the user enter their address, I will get the X and Y coordinate from my database for that address, but I am not sure how do I can pass those values to the client side so that it can display the correct place.

I am trying to using the Ajax:

Server Side:
Ajax.AjaxMethod()]
public string MapCoord(Not Sure what to put in here)
{
//Get X and Y coordinate from database
return x and Y coordinate;

}

//Client Side

<head>
script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&amp;appid=MyID">
</script>

<style type="text/css"> #mapContainer { height: 600px; width: 600px; }
</style>
</HEAD>

<body>
<form name="Form1" method="post" id="Form1">

<enter address here>
<input type="submit" name="buttonname" value="Submit" onclick="Load();">
<div id="mapContainer"></div>
</form>

function Load()
{
WebForm1.MapCoord(Load_callback);
}

function Load_callback(response)
{
var av = response.value;
var myPoint = new YGeoPoint(Put X and Y coordinate in here);
}
Left by Tom Lee on May 03, 2006 11:16 AM

# re: Playing with Yahoo maps API
Requesting Gravatar...
I see what you are trying to do.

Maybe this will help and I'm doing this outside an editor so forgive any syntax errors:

.NET code
Public class ajaxPage
Private sub page_load()
ajax.utility.registertypeforajax(gettype(ajaxPage))
End sub

<serializable()> _
Public structure latlngPoint
public lat as double
public lng as double
End structure

<ajax.ajaxmethod()> _
Public function GetData() as latlngPoint
dim rv as new latlngPoint
rv.lat = 38.5
rv.lng = -95.5
return rv

End function

End class


Javascript code

function Load()
{
getAjaxData();
}


Function getAjaxData(){
ajaxPage.GetData(getAjaxData_callback);
}

Function getAjaxData_callback(response){
var av = response.value;
var myPoint = new YGeoPoint(av.lat, av.lng);
}


I just created a structure and made it serializable so that AJAX could pass it between server and client and then called it from javascript...bang!!

Tim Hibbard
Left by Tim Hibbard on May 03, 2006 11:59 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Hibbard | Powered by: GeeksWithBlogs.net