API for viewing places on the map

Asked

Viewed 743 times

1

I am in need of an API that works like HERE Maps, which enables an easy query through a REST service. With it, for example, I can identify stores within a certain range. But I came across the problem that it doesn’t provide this information when for example, the stores are inside a mall.

Bing Maps has this information when accessed by the browser. But I haven’t been able to identify how to do this through the API.

Someone knows how to fix this?

1 answer

1


The Google Places has REST Services to query places, as well as other Apis, such as Javascript.

It is possible to consult by points (latitude and longitude), address and as you mentioned, to search for shops in determining radius (ie for specific types of establishments). Various types of places are supported and you can see the list of types in this link: types of places.

For example, follow a query by stores (store) consuming the WS REST of Google Places and returning JSON. I will use the central point of Florianopolis (lat=-27.6142358;lng=-48.4828247) returned by Google Maps and a radius of 200 meters.

The parameters will be:

location: -27.6142358,-48.4828247
radius: 200
language: pt-BR
type: store
key: {sua_api_key}

For information about the API key, see this link: Google API Key

With these parameters the resulting URL will be as follows:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-27.6142358,-48.4828247&radius=200&language=pt-BR&type=store&key={sua_api_key}

For this search the result was this:

{
   "html_attributions" : [],
   "results" : [
      {
         "geometry" : {
            "location" : {
               "lat" : -27.615584,
               "lng" : -48.484707
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/wine-71.png",
         "id" : "d4068353334ad7655800b0e4a7908e15b882a404",
         "name" : "ALE BEBIDAS",
         "opening_hours" : {
            "open_now" : true,
            "weekday_text" : []
         },
         "place_id" : "ChIJBxuO5lE5J5UR9u9xCVWhfEg",
         "reference" : "CmReAAAAOVtoo1S_NPy2AcKW4FcXqXVlCmUIuTIIccZP0F6qt8KDKqDHfRm7Ng8SeXRqsGPmo8e_846R-PRCe1KZyLkl9VZVsfIIMdoaIxG86BWH0KNLR8gzvUiUhdFxgbUHYB1pEhBzTzPE0vAr4w6uolz7dKSBGhRbzJls4F2xRH83i7ypdcvdRtXdvA",
         "scope" : "GOOGLE",
         "types" : [ "liquor_store", "store", "establishment" ],
         "vicinity" : "Rua Laurindo Januário da Silveira, 2452 - Lagoa da Conceição, Florianópolis"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : -27.615853,
               "lng" : -48.484668
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/wine-71.png",
         "id" : "cdb56aaa10f3a9458d66db2cef5cc883ee197195",
         "name" : "Central de Bebidas Canto da Lagoa",
         "opening_hours" : {
            "open_now" : false,
            "weekday_text" : []
         },
         "place_id" : "ChIJJ2Ot6FE5J5URtqcR1cfFqFc",
         "reference" : "CoQBdAAAAEoaG4QA0oGjWHBMjj7OGoiP8SEtfZbDb8eKe1O-2csV3Kpx-zqZ83RdBvgZwvCj66_0_XDuNUmMMfEbjP2nDcM9FR5MxcUhVSKjc4b26N5hd3057Wf40B2uhE56l14QWo3RhfTnGxEs0KU_dWtlCE2xGaUyo0zW0EaG3NspmVNyEhA5iHD9_3ABWqupiCGDcciKGhS7bVKHoO1Im47kbn7yWyR0f_-c4g",
         "scope" : "GOOGLE",
         "types" : [ "liquor_store", "store", "establishment" ],
         "vicinity" : "Rua Laurindo Januário da Silveira, 2.460 - Lagoa da Conceição, Florianópolis"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : -27.615299,
               "lng" : -48.484732
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "2e4c65a1d61c72d0b64b6044645c58f1a3f3e13d",
         "name" : "Hiper Bom",
         "place_id" : "ChIJa0_q4VE5J5UR3kiEd-J2FL4",
         "reference" : "CmRdAAAAKQgXto7LtfDAb7RbkWybZ5djSo_4hdr7Y5waV7uF3EuGPt1vE-n3pvFKhkeJAPy2WPoK-TMSGqQSw9oJ3sCCUGF4aQgA85BsBZup3qz10O7ack30cay0imQx7FCr02ITEhDuG3WwOOPnEhBCUMx2rlo6GhSkxbL6YMVwdmqOFLhMzs6PztikHA",
         "scope" : "GOOGLE",
         "types" : [ "grocery_or_supermarket", "food", "store", "establishment" ],
         "vicinity" : "Rua Laurindo Januário da Silveira, 2420 - Lagoa da Conceição, Florianópolis"
      }
   ],
   "status" : "OK"
}

Behold in this link the meaning of each attribute returned, in addition to what it can return.

I don’t know Bing Maps very well, it is possible that it also has this service. I know that there are public data for consultation by Bing Spatial Data Services. as for North America, through the NAVTEQNA and Europe, through the NAVTEQEU. I do not know if there is something in Brazil or other regions.

There are other services as well, such as the Foursquare which may offer lightning search as well, you can find other references easily on the internet. These two are cited and the example of Google Places that I believe is the most used.

  • Thanks for your reply Bruno. I’m using Google Place, because it fits within what I need. I just wanted another alternative, with all the crap that goes on every now and then between Google and Microsoft, I have a hard time using it. But that’s fine. I even used Bing, but I don’t think it works. I’m going to look at Foursquare too, I didn’t know I could use it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.