On Nov 5, 5:14 pm, Sawyer <[email protected]> wrote:
>
> I have given a button named as pushpin for the marker,
>
> I want plot the marker for every mouse click and log the coordinates
> of every marker, but the functions are not working.
When you click the button, you call function AddPushpin(). That in
turn calls a function called getColor(), which does not exist; and
even if it did, you would attempt to add a marker at "latlng" which
has not been defined, using an icon created by getIcon() which also
does not exist. I stopped analysing at that point.
So: at the very least, you need to provide the functions getColor()
and getIcon(), and provide a location for the marker.
It may be that I have misunderstood how the map and buttons are
supposed to operate. What is supposed to happen when the "Pushpin"
button is pressed?
If all you want to do in addition to what happens now is add a marker
to the map when it's clicked (as you already log the clicks) then just
add code to create a marker inside the function mapClick(). In fact,
that's probably as simple as
54 function AddPushpin(latlng) // accept a parameter
78 function mapClick(marker, clickedPoint) {
>> AddPushpin(clickedPoint); // add this line
79 markerArray.push(clickedPoint);
80 polyPoints.push(clickedPoint);
81 drawCoordinates();
82 }
but you will still have to write getColor and getIcon, or provide stub
functions like
function getColor() { return 0 };
function getIcon() { return null };
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.