Neseek77 / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
1 stars 1 forks source link

TypeError PlacesService.create(map); #505

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There is an TypeError if I use the PlacesService.create(map);

com.google.gwt.core.client.JavaScriptException: (TypeError) 
@com.google.maps.gwt.client.places.PlacesService::create(Lcom/google/maps/gwt/cl
ient/GoogleMap;)([JavaScript object(12)]): Cannot read property 'PlacesService' 
of undefined

LatLng myLatLng = LatLng.create(49.690731711357216, 10.98129278048873);
        MapOptions myOptions = MapOptions.create();
        myOptions.setZoom(7.0);
        myOptions.setCenter(myLatLng);
        // myOptions.setPanControl(true);
        // myOptions.setZoomControl(true);
        // myOptions.setScaleControl(true);
        myOptions.setMapMaker(true);
        myOptions.setMapTypeId(MapTypeId.ROADMAP);
        map = GoogleMap.create(Document.get().getElementById("map_canvas"),
                myOptions);

PlacesService places = PlacesService.create(map);
         PlaceSearchRequest request = PlaceSearchRequest.create();
         request.setKeyword("restaurant");
         request.setRadius(20);
         Callback callback = new Callback() {

         @Override
         public void handle(JsArray<PlaceResult> a, PlacesServiceStatus b) {
         for (int i = 0; i < a.length(); i++) {
         System.out.println(a.get(i).getName());
         }
         }
         };
         places.search(request, callback);

Original issue reported on code.google.com by developw...@gmail.com on 4 Nov 2012 at 9:02