The constructor call setMap for you if you pass in a map instance, as
a convience.
Marker.setMap can be used if you remove a marker and attach a bak
later without creating it again.

On Nov 11, 1:20 am, Shreerang Patwardhan
<[email protected]> wrote:
> Hello all,
>
>        I am unable to understand the need of the statement
> marker.setMap(map). This is because the fact that the following code also
> adds a marker to the map!
>
> var marker = new google.maps.Marker(
> {
>         position: new google.maps.LatLng(x,y),
>         map: map
>
> });
>
> Then what does setMap actually do?
> I am asking this because I wrote a code with the setMap statement and
> without it. The resultant output for both was exactly same, visually at
> least!
>
> Thank you in advance.
>
> --
> Regards,
> Shreerang Patwardhan.
> Trainee Developer (GIS)
> DSK Digital Technologies Pvt. Ltd. <http://www.dskdigital.com/>
> LinkedIn Profile 
> <http://in.linkedin.com/in/shreerangmohanpatwardhan/>https://sites.google.com/site/shreerangmohanpatwardhan/

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