Whcih API should I use to auto complete cities , streets and suburbs? - google-maps

I tried to find a big database of Cities , Streets and Suburbs of my country to make an autocomplete search input but I couldn't find any good source of such database...
I was thinking to use Google autocomplete API for that purpose but I couldn't understand how to get the data I need with that,
What api should I use?

The API you want to use is Places API,
https://developers.google.com/places/web-service/intro
From the Places API, the request you want to use is Place Autocomplete Requests,
https://developers.google.com/places/web-service/autocomplete
In case you're using Maps JS API there is no need to use the web services endpoints.
Autocomplete for Addresses and Search Terms is available in the JS API
https://developers.google.com/maps/documentation/javascript/places-autocomplete
Example,
https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/javascript/examples/places-autocomplete-addressform

Related

Get all geolocations by partial name using google maps api

I have signed up with the Google Maps API. I can geolocate locations using the following query
url = f"https://maps.googleapis.com/maps/api/geocode/json?address={city}&key={api_key}"
I need to do a search for towns by partial name.
For example 'MyTown' is a town , but there are also towns with names which include 'MyTown' in the title, such as MyTown-By-Sea, MyTown-SomethingElse and even NiceMyTown
The above query using the API returns just the city MyTown, not the others
Is there some option I have missed to get the Google Maps API to be less specific in the response returned ?
You can use Places Autocomplete API web service. This API will return places suggestions or predictions, based on your given input.
https://maps.googleapis.com/maps/api/place/autocomplete/json
?input=MyTown (based on your example)
&location=latitude,longitude
&key=YOUR_API_KEY

How to legally add fake places on Google Map for Application Testing

We have an application that detects nearby business of a particular genre. To test the app I want to add few fake business in the locality.
Does google provide any sandbox type of stuff for google maps?
Can i add places via Javascript test my app and then remove them?
What should be the best way ?
did you want to find business places with google maps javascript api without any databases in your backend script?
i think you must add places in your database and use it with google maps api to show/find places for your users.

Google Places autocomplete, any way to restrict the location and categories?

Is there any way to filter the Google Places Autocomplete for a specific location and also filter based on categories (like restaurants, malls etc)
Yes, Google Places Autocomplete has type and location parameters.
As of right now, it looks like the AutoComplete API only accepts "establishment" for all non-address places and "geocode" for geographic entities. You might be able to write some JS that makes an additional Google Places API call for each possibility and returns a new array of full Google Places API details.

Get latitude / longitude / Reverse Geocoding without displaying maps

Using a website, I am trying to capture user's latitude / longitude point and based on that grab his current address.
I am able to do this using Google Maps API: geolocation and Reverse GeoCoding. But, my requirement is to get this information without displaying the map. As far as I have read, Google Maps Term of Use prohibits such thing.
Can anyone let me know if there is any other service which can serve my purpose without displaying maps or does Google Maps allow such thing? I am not sure about Bing, Yahoo.
EDIT: On page load, I need to grab user's latitude and longitude and based on that get address information. I am planning to use this address information for displaying nearby locations/places to visit. I have to achieve this without displaying any map.
Yahoo PlaceFinder does it. If you pass through the latitude and longitude in the location parameter and gflags=R, it should return address data.
You'll have to get a Yahoo APP id, but its free and pretty easy to set up.
EDIT: I see you want to do geolocation too, if you can't use google I would investigate html5 geolocation and or use freegeoip.net to geolocate by ip address.
I don't know if Im mistaken this post, but if you read this:
(viii) store or allow end users to store map imagery, map data or geocoded location information from the Yahoo! Maps APIs for any future use;
(ix) use the stand-alone geocoder for any use other than displaying Yahoo! Maps or displaying points on Yahoo! Maps;
It's mean that you can't store the information, or make use of it, without maps.
So the google api and the yahoo api need to have a map...
note- I take that lines from the terms of yahoo: http://info.yahoo.com/legal/us/yahoo/maps/mapsapi/mapsapi-2141.html
EDIT - Now I'm trying to use http://www.geonames.org/export/reverse-geocoding.html It's easy, and works fine for me. I just need the city and maybe a postal code.
I don't think Yahoo requires you to show a map and it also has a higher quota.
http://developer.yahoo.com/geo/placefinder/
There are a number of geolocation APIs - here is a really good one:
https://geoip.nekudo.com/
You merely make a GET request to
http://geoip.nekudo.com/api/{ip}/{language}/{type}
where ip, language and type are optional.
E.g. in Angular 5, using HttpClient:
this.http.get('http://geoip.nekudo.com/api/')
.subscribe(
data => { console.log('SUCCESS! Your coords are lat:', data.location.latitude, 'long:', data.location.longitude); },
error => { console.log('ERROR!', error); }
);
Also, note that the geoip service is written in PHP and open source (https://github.com/nekudo/shiny_geoip) so you can house your own implementation to reduce third party dependencies.

Using C++ with Google Maps API. Only text info required

Is it possible to call Google Maps API using a C++ code to retrieve text info about nearby locations.
I am trying to make a simple application (C++) which gives the information about Nearby places on entering longitude and latitude info. Only data I am looking for is the Name of Nearby place and its distance from mentioned location.
Is it possible?
I think your best option would be to use the Google Places API with the JSON format for request.
I don't know about any library that would perform the thing automatically, but there is a thread on StackOverflow about JSON parsing in C++ . Even it does not provide an answer it as good votes scores.
I guess the web call could be made with something like curl.