On Nov 30, 1:02 pm, Emre Avsar <[email protected]> wrote:

>
> thats the whole thing i know, and now i don't have the POINT! Can
> anyone tell me how to get the point (GLatLng) from the adress( street,
> postal-code, cityname)?
> if i have that, i could make this:
> var marker = createMarker(point, html);
>
> you understand what i mean?

Do the geocoding first, and then create the marker and add it to the
map inside the geocoder's callback function:

var geocoder=new GClientGeocoder();
var address = "10 Downing Street, London UK";
geocoder.getLatLng(address, function(point) {
    var marker = createMarker(point);
    map.addOverlay(marker);
    }

If you need to pass other parameters, you need a helper function for
the geocoder to get function closure on those parameters too. This
keeps each "html" tied to its own "address":

var geocoder=new GClientGeocoder();
var address = "10 Downing Street, London UK";
var html = "Prime Minister & First Lord of the Treasury";
geocodeAndCreateMarker(address,html);
...
function geocodeAndCreateMarker(address,html) {
  geocoder.getLatLng(address, function(point) {
      var marker = createMarker(point,html);
      map.addOverlay(marker);
      }
  }

You may need to use .getLocations() instead of .getLatLng(), depending
on error handling or data requirements.

Andrew

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.


Reply via email to