Rectangle

28 views
Skip to first unread message

James Carroll

unread,
Dec 29, 2011, 12:07:12 AM12/29/11
to google-map...@googlegroups.com
Hi Folk

I am an absolute beginner. My needs are very simple. I just want to open a google map and draw a rectangle on it.
In trying to learn this I have been able to open the map, plot a couple of markers and add a polygon but the rectangle simply eludes me!!

The map is a small area

    var mylatlng = new google.maps.LatLng(54.716952, -5.809269);
    var myOptions = {
      zoom: 10,
      center: mylatlng,
      mapTypeId: google.maps.MapTypeId.TERRAIN
    };

I then want to mark the rectangle bounded by these latlongs (54.68808, -5.88342) (54.68808, -5.88342)
I don't need it to be user adjustable, clickable or anything else.

Please help

James

MymsMan

unread,
Dec 29, 2011, 8:27:07 AM12/29/11
to google-map...@googlegroups.com
http://code.google.com/apis/maps/documentation/javascript/reference.html#Rectangle
You need to specify a LatLngBounds object in the rectangle options.
http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds

Your two bounds are the same resulting in a very small rectangle!
Reply all
Reply to author
Forward
0 new messages