how to start the map with origin and destination instead of longitude and latitude

26 views
Skip to first unread message

eduardo12fox

unread,
Jan 2, 2012, 5:38:19 AM1/2/12
to Google Maps JavaScript API v3
guys I need to start the google maps with a edereço, but do not want
to use the longitude and latitude, I need to use the source address
and destination

function initialize() {
var myOptions = {
zoom: 13,
center: new google.maps.LatLng(-33.879,151.235),
mapTypeId: google.maps.MapTypeId.ROADMAP
}

geoco...@gmail.com

unread,
Jan 2, 2012, 10:23:10 AM1/2/12
to Google Maps JavaScript API v3
I don't know what a "edereço" is. But, if you want to show a route
between an origin and a destination, the directions service works
without using longitude and latitude coordinates, and can be used to
initialize your map.

If you have an address, the geocoder (which is part of the Google Maps
JavaScript API v3) will take and address and return the coordinates
you need.

-- Larry

Carlos Eduardo de Figueiredo

unread,
Jan 2, 2012, 10:26:25 AM1/2/12
to google-map...@googlegroups.com




Ok! but how could I enter the address directly in the initialize () for all examples of the Internet is used center: new google.maps.LatLng but I want to use the direct addressfor when you open the map as the address passed directly upload is complete there















--
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 google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


geoco...@gmail.com

unread,
Jan 2, 2012, 11:03:53 AM1/2/12
to Google Maps JavaScript API v3
On Jan 2, 7:26 am, Carlos Eduardo de Figueiredo
<eduardo12...@gmail.com> wrote:
> Ok! but how could I enter the address directly in the initialize () for all
> examples of the Internet is used center: new google.maps.LatLng but I want
> to use the direct addressfor when you open the map as the address passed
> directly upload is complete there

Either:
1. read the documentation on the geocoder and use its result to center
the map.
or
2. set an arbitrary center for the map, (0.0,0.0 would work), read the
documentation on the geocoder and use its result to center the map,
like this:

http://www.geocodezip.com/GMapsExampleV3b.html

-- Larry

>
> 2012/1/2 geocode...@gmail.com <geocode...@gmail.com>
Reply all
Reply to author
Forward
0 new messages