wood burning stoves 2.0*
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
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
Author

how to put a pin in a google maps location

Jeff Ballie
Greenhorn

Joined: Jul 02, 2007
Posts: 12
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
Bartender

Joined: Oct 14, 2005
Posts: 18134
    
    8

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

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.

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

Joined: Jan 10, 2002
Posts: 60057
    
  65

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
 
Similar Threads
Java script in The "Hello, World" of Google Maps
Having issues reRendering a map when a rich:tree node is clicked on(SOLVED)
Display simple address on google maps
Can arrays in Javascript contain functions
Javascript call bean setter