Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to put a pin in a google maps location

 
Jeff Ballie
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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)

http://code.google.com/apis/maps/documentation/javascript/tutorial.html

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
Sheriff
Posts: 21319
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

http://www.svennerberg.com/2009/07/google-maps-api-3-markers/

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
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using BB Code tags, be sure to use them correctly. I fixed your post for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic