Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get political locations near by a point - Google Maps API V3

I need to get cities, Towns, neighborhoods, etc near by a point on Google maps. I used Google Places Service but I only get hotels, stores, etc. no political locations.

For an example, try to get all political places on Paris (100, rue de la Parcheminerie, 75005 PARIS) in a 10000 meters Radius.

And you get only one result: Paris [locality, political] type.

No info about other neighborhoods, towns, cities, etc.

Then, try with a 100000 meters radius and zero results.

Example Code:

 //vars map, centerPoint, radius was previously set  
 function getPlacesOnRadius() {

        var request = {
            location: centerPoint,
            radius: radius * 1000,
            types: ['political']
        };

        var service = new google.maps.places.PlacesService(map);
        service.search(request, callback);
    }

    function callback(results, status) {
        if (status == google.maps.places.PlacesServiceStatus.OK) {
            for (var i = 0; i < results.length; i++) {
                var place = results[i];
                //createMarker(results[i]);
            }
        }
    }

BTW, I already set political types.

like image 797
Rinaldo Sassaroli Avatar asked Dec 14 '25 14:12

Rinaldo Sassaroli


1 Answers

Without having tried it myself, but after reading the documentation I would assume that if you don't specify what types of places you want it will only return major cities. Could you try to set types=whateveryouwantreturned and tell us if it still doesn't work? :)

Either that or try posting the code you use to call the webservice and traverse the resulting data so we could see if something could be done there.

like image 109
Kasper Vesth Avatar answered Dec 17 '25 13:12

Kasper Vesth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!