Nevermind! Wow - talk about a brainfart - lol! setCenter requires an
argument, not to be set to a value! Changing it to
map.setCenter(results[0].geometry.location); works great. Can't
believe I spent so long and didn't see this.

Thanks for your effort.

Jenn

On Jul 21, 12:33 pm, Jenn <[email protected]> wrote:
> Here - I stuck it on an outside server so you can test it.
>
> http://www.forsalebytxt.com/dev/housetest.php
>
> If you put in another city/state (like "Royal Oak, MI") in the
> location box then click off the box (click into the textarea - or
> anything except clicking "submit query" right now) you'll see the
> alert box showing the map center has not changed and you will see the
> map itself with the same center on South Lyon, MI.
>
> Why do you not expect this to do what I am thinking it will? Is there
> a different method for changing the center of a map once it has been
> initiated/loaded?
>
> Thanks,
> Jenn
>
> On Jul 21, 12:20 pm, "[email protected]" <[email protected]>
> wrote:
>
>
>
> > On Jul 21, 9:04 am, Jenn <[email protected]> wrote:
>
> > > I have a text input box that you can type in an address, city, state,
> > > whatever. When you click off the box this function (changeLoc) is
> > > called to recenter the map on this new location. Very simple. But the
> > > "map.setCenter" doesn't work. The map reloads but stays at the old
> > > center (you can see it both on the map and in the popup - getCenter
> > > shows the old center still. Anyone see anything wrong? If it matters,
> > > there are markers on the map that after I recenter I delete and redraw
> > > - maybe I need to delete all markers before moving centers?
>
> > > ** Also, I notice people on these boards suggesting set_center. How is
> > > set_center any different than setCenter? I can't find any
> > > documentation on set_center but it doesn't throw an error.
>
> > The original name for the function was set_center in v3, it was
> > changes to setCenter.
>
> > > function changeLoc() {
> > >         location_input = document.getElementById("location_input").value;
> > >         if (location_input != "") {
> > >                 // Geocode new location
> > >                 geocoder.geocode( { 'address': location_input}, 
> > > function(results,
> > > status) {
> > >                         if (status == google.maps.GeocoderStatus.OK) {
> > >                                 //alert("Setting center to: " + 
> > > results[0].geometry.location);
> > >                                 map.setCenter = 
> > > results[0].geometry.location;
> > >                                 alert("Wanted Center: " +  
> > > results[0].geometry.location + " -
> > > Current Center: " + map.getCenter());
> > >                                 //redrawMarkers();
> > >                         } else {
> > >                           alert("Invalid location entered.");
> > >                         }
> > >       });
> > >   }
>
> > > }
>
> > > Sorry for the code - my dev site is behind a firewall and don't really
> > > want to move it to a production machine until its more stable.
>
> > Can't test it then.
> > But I would expect this to not do what you expect:
> > map.setCenter = results[0].geometry.location;
>
> >   -- Larry
>
> > > Thanks,
> > > Jenn

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to