I try to do it by Geocoder. First I generate polyline by GDirections.
Than I get all vertex(LatLng) and by Geocoder getCountry in callback
function try to find out all cities. But problem is that it returns me
only half of all of them. Please help. This is my code

public void onSuccess(DirectionResults result) {

                                GWT.log("Successfully loaded directions.", 
null);
                                Polyline line = result.getPolyline();
                                final List<String> cities = new 
ArrayList<String>();
                                for (int i = 0; i < line.getVertexCount(); i 
++) {
                                        Geocoder geo = new Geocoder();
                                        geo.getLocations(line.getVertex(i), new 
LocationCallback() {

                                                @Override
                                                public void 
onSuccess(JsArray<Placemark> locations) {
                                                        for (int j = 0; j < 
locations.length(); j++) {
                                                                String city = 
locations.get(j).getCounty();
                                                                if ((city != 
null) && (!cities.contains(city))) {
                                                                        
cities.add(city);
                                                                         
System.out.println(city);
                                                                }

                                                        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to