Google MAP APIv3 with ADF

James Taylor wrote nice sample code for integrating Google Map with ADF. Unfortunately, As Google Map API has been upgraded to v3, we need to make a little bit of changes to get it working. Here is the sample code.

     <f:facet name="metaContainer">

        <af:resource type="javascript" source="https://www.google.com/jsapi?key=[API  Key]"/> 

          <af:resource type="javascript">

  google.load("maps", "3",  {other_params:"sensor=false"});

  var map;

  var marker;

  function initialize() {

    var myLatlng = new google.maps.LatLng(-34.397, 150.644);

    var myOptions = {

      zoom: 8,

      center: myLatlng,

      mapTypeId: google.maps.MapTypeId.ROADMAP

    }

    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  }

  google.setOnLoadCallback(initialize);

          </af:resource>

        <af:resource type="javascript"> 

                          function doNavigate(evt) 

                          { long = evt.getSource().getProperty("long"); 

                            lat = evt.getSource().getProperty("lat");

                            var center = new google.maps.LatLng(lat, long);

                            map.setZoom(15);

                            map.setCenter(center);

                            marker = new google.maps.Marker({position: center,map: map});

                            marker.setMap(map);

                          } 

        </af:resource> 

        </f:facet>

Comments:

Hi,
i have a problem with this source, i must reload the page for get this <af:resource type="javascript" source="https://www.google.com/jsapi?key=[API Key]"/>
i dont know why but later all work fine :S
can you help me?
thx

Posted by guest on April 11, 2013 at 08:45 AM PDT #

dear Sir
I am a beginner in adf , I use "Integrating Google Maps with ADF" and it work but when I change my code to v3 according to your explanation and sample code , I can not see any thing . when I run my project I can see loading circle but after loading page is white!!!
please help me
thanks
Golriz

Posted by guest on August 30, 2013 at 11:07 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Solution & Technology Architect, Asia Pacific

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today