wood burning stoves
The moose likes HTML, CSS and JavaScript and the fly likes how to put a pin in a google maps location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to put a pin in a google maps location" Watch "how to put a pin in a google maps location" New topic

how to put a pin in a google maps location

Jeff Ballie

Joined: Jul 02, 2007
Posts: 12

This seems like such an obvious question that I feel I should preface by promising everyone that I really did try to google for the answer...

I was going through the google maps API tutorial (the javascript one)


The example was very simple to use... all you have to do is pass in some coordinates and bingo, you have a map (I'm not going to repost the code here, it's in the "Hello World" example).

Here's my problem - the map centers on the coordinates, but there's no "pin" on the coordinates like you usually get with google maps. I searched around, and I couldn't find any documentation on how to add a pin... it seems like the sort of thing that would be a simple property in the map options


If anyone has managed to do this, please let me know! Thanks.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19751

I've done that. The code I used is at home so I can't quote it here, but I'm sure I learned how to do it from one of the tutorials. You've found them, haven't you? Displaying a pin was in one of the very first examples if I recall right (it was a few years ago).

Edit: I did my 30 seconds of googling and found a tutorial: Creating Your First Map. It's in there.
Jeff Ballie

Joined: Jul 02, 2007
Posts: 12
Thanks Paul - that helped. I read the tutorial, and it looks like these are called markers rather than pins, which probably explains why my googling was so unsuccessful.. anyway, once I searched on maker, I turned up a tutorial for V3 of maps pretty quickly.


Just in case anyone else is following this thread and wants to know how it worked...

The only difference between this and the hello world sample on the Google Maps tutorial link is that the addition of the var marker stuff (also, I changed the zoom and pointed the map at sproul plaza in berkeley)...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63351

When using BB Code tags, be sure to use them correctly. I fixed your post for you.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: how to put a pin in a google maps location
It's not a secret anymore!