tags:

views:

1020

answers:

1

When I do not use GIcon(), the location point is displayed correctly. However, when i use GIcon(), the location is displayed at an incorrect place. Here is my code:

<script language="javascript">
  var Icon = new GIcon();
  Icon.image = "images/myicon.png";
  Icon.iconSize = new GSize(10, 10);
  Icon.iconAnchor = new GPoint(5, 34);
  Icon.infoWindowAnchor = new GPoint(5, 2);
  var markers = [{'latitude': 169.132892, 'longitude': -44.698667, 'name': 'dsfsdfljsldk' }]; var map;
  var centerLatitude = 18.17;
  var centerLongitude = 127.57;
  var startZoom = 2;
</script>
+2  A: 

The size of your icon is 10x10 pixels, but you've set it to be anchored 10x34 pixels away from the top left corner of the icon.

You'll probably want your icon to be anchored to the map within the 10x10 size of the icon. If you want the anchor to be in the center of the icon, set iconAnchor to (5,5).

Chris B
Thank you so much Chris. It worked.