p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Beginning Ajax ISBN: 978-0-470-10675-4 (http://p2p.wrox.com/book-beginning-ajax-isbn-978-0-470-10675-4-312/)
-   -   Google Map API Example question (cht 7, p203) (http://p2p.wrox.com/book-beginning-ajax-isbn-978-0-470-10675-4/72477-google-map-api-example-question-cht-7-p203.html)

pinetree January 29th, 2009 07:59 PM

Google Map API Example question (cht 7, p203)
 
Hello Chris/Licinda
I study your book "Beginng Ajax.
I got stuck in chapter 7, p203 - Google Map API example.

My question is in JavaScript portion.
Below is the part.

function load(e)
{
if (GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("map"));
geocoder = new GClientGeocoder();
placeMarkers(document.getElementById("address").va lue, e);

GDownloadUrl("data.xml", function(data, responseCode) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker") ;

if (markers.length > 0)
{
point2 = new GLatLng(parseFloat(markers[0].getAttribute("lat")), parseFloat(markers[0].getAttribute("lng")));
map.setCenter(point2, 13);
}
else
{

geocoder.getLatLng("Paris", function(point){map.setCenter(point, 13)});
}
});
}
}

My question is in load function.
It has one argument but at the end, it refers to "point" (in red color) but it is not defined.
That is a part, which bugs me now.

I will appreciate if you can clarify me about this.

pinetree January 30th, 2009 07:33 PM

Answer to the Google Map API question
 
I serfed googlemap api help section for getLatLng.

The answer to my question was there.
The following is the defintion for the function and description.

getLatLng (addr:string, callback:function)
return: returns nothing
description: Sends a request to Google servers to geocode the specified
address. If the address was successfully located, the
user-specified callback function is invoked with a GLatLng
point. Otherwise, the callback function is given a null point.
In case of ambiguous addresses, only the point for the best
match is passed to the callback function.

So in summary, it is defined by getLatLng function. I hate black box notation but in this case, that is what it is.

Thanks Chris/Lucinda anyway.

masiya April 21st, 2010 08:50 PM

Hi Everyone
 
I would like to know if is it possible to call a javascript fuction from the server side. I want to pass the map coordiantes into the google map on the web browser. I am writing my server side code in VB.net. I would like to know if there is any method that I can use to pass the coordinates from the database to the map.

Your assistance will be highly appreciatable.

Thanx


All times are GMT -4. The time now is 05:32 PM.

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.