Monday, February 25, 2013

Display .gif Images marker in google maps V3

       Showing .gif images in maps V3 is simple, but in default it is disabled. The only thing you need to do is set markeroptions optimized to false. The coding example will help you to use MarkerOptions, MarkerImage, Anchor Positions and using Animated Images.
 
Sample Code for displaying .gif Image:
VerticalPanel vp = new VerticalPanel();
  vp.setSize("1200", "800");
  LatLng myLatLng = LatLng.create(13.029603, 80.271800);
  MapOptions myOptions = MapOptions.create();
  myOptions.setZoom(8.0);
  myOptions.setCenter(myLatLng);
  myOptions.setScaleControl(true);
  myOptions.setMapTypeId(MapTypeId.ROADMAP);
  GoogleMap mapWidget = GoogleMap.create(vp.getElement(), myOptions);
  add(panel);
 
  MarkerOptions markerOptions = MarkerOptions.create();
  markerOptions.setDraggable(true);
  markerOptions.setOptimized(false);
  MarkerImage image = MarkerImage.create(Flower.gif);
  image.setAnchor(Point.create(23, 65));
  Marker marker = Marker.create(markerOptions);
  marker.setPosition(myLatLng);
  marker.setMap(mapWidget);