On Mar 18, 7:45 pm, Daniel <[email protected]> wrote:
> http://motionsharing.com/geocoder/
>
> On Mar 18, 6:53 pm, Daniel <[email protected]> wrote:
>
> > Hi, currently I have a page setup with ajax that sends a request to a
> > file called getmap.php with a GET request called postal.
>
> > My code gets the coordinates from google, in xml, then passes it on to
> > the next page.
>
> > in my javascript code:
>
> > it gets the xml from the php file correctly, but the coordinates where
> > switched the first set of numbers was supposed to be the second and
> > the second set of numbers would be the first.
>
> > I used split() a couple times until i could reverse the two sets of
> > numbers, then put that in a variable.
>
> > I then used:
>
> > var map = new GMap2(div);
> > map.setCenter(new GLatLng(doc), 13);
>
> > to display the map. doc is the variable with the cleaned up
> > coordinates.
>
> > but for reason it displays :

The GLatLng constructor takes 2 floats as arguments:
http://code.google.com/apis/maps/documentation/reference.html#GLatLng.GLatLng

Not whatever doc is...

BTW, you need to make it easier to help you.  The link you provided:
http://motionsharing.com/geocoder/

Goes to a page that redirects to:
http://motionsharing/geocoder/start.php
Which doesn't exist...

Once I made it to your page, I can see that you are creating doc like
this:
var doc = data[1][0][1] + " , " + data[1][0][0];

Don't do that.

Use new
map.setCenter(GLatLng(parseFloat(data[1][0][1]),
                      parseFloat(data[1][0][0])));

Better, yet parse the xml with GXml.parse and get the data out in a
browser independent way.

Examples in the documentation and Mike Williams' tutorial.

  -- Larry

>
> > We are sorry, but we don't have maps at your zoom level ....
>
> > But when i alert the variable and get the coordinates I replace 'doc'
> > with these numbers and everything works fine.
>
> > Thanks,
> > Daniel

-- 
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