Android geocoder API - android

I'm trying to create an autocomplete textview to search for addresses and display them on my map, but i'm having some problems with the suggestion fetching.
For this i'm using the geocoder function getFromLocationName.
In order to get a response (and sometimes a pretty bad one) i have to input into the search a whole word plus a number, and for it to suggest something even close, the string has to be almost the same as the google name for that street.
Is there any other way yo make a street suggestion text field? So far i've solved the need for a number by adding " 1" to the input string if it didn't have any numbers in it, but it's still pretty far off of the way the suggestions work on google maps.
Thanks in advance for any tips you can give me.

The Geocoder APis aren't designed for this type of request. Usually you feed the full name of the street/city/etc to it and it will translate it into coordinates.
Use the Google Places Autocomplete instead. It will respones some suggestions for your input, which can be anything between one letter and the full address.
Note that you need to have a valid key to use this API.

Related

Android: Search location by Name without using Google Places or Maps SDK

I'm looking for a way to search a location using name. The location being an object with longitude and latitude data.
I want to achieve this without using Places SDK or Maps SDK, as they are paid services in the long run (if I'm not mistaken)
I've tried using Geocoder, but it seems like it only works if you are searching for a country. Ideally, I would like to be able to search for city as well. GeoCoder returns an empty list for this usecase. Using LocationManager only allows me to get the last known location of the user, so that's not it either.
Is there such a way to achieve this?
I tried Geocoder again, and it seems my first take wasn't accurate. The requirement for Geocoder seems to be that you need to provide an actual name that matches any entry, otherwise it's gonna be null.
For the meantime, I think this should work for me. But if there's any other way that allows me to search for any location without complete name would be better
You can use a few open-source maps for achieving this like OpenStreetMaps or HereMaps.

Geocode Autocomplete mobile

I am trying to set up autocomplete with geocoding. If the user is typing in a name of a city, I want him get a few cities as a result. Vice versa with postal codes.
The new policy from google seems way too expensive (70.000 autocomplete requests = 200$ ?? )
I tried to solve it with the Xamarin.Forms.Maps.Geocoding implementation, but this does not seem to work at all... at least not under iOs. The result of GetPositionsForAddressAsync or GetAddressesForPositionAsync does return a List, but no matter what input I provides, it only contains just one value.
So in your opinion: What ist the best and cheapest way to accomplish a geocoding autocomplete solution? I have no problem spending money for it... I am just looking for the best solution.
You can take a look at OpenStreetMap based geocoders with autocompletion support, e.g. Photon. It's open-source as well.

What is the easiest way to hint localizations while typing?

I think I could use MultiAutoCompleteTextView to show hints. But how can I get some hints from Geocode API while typing it (e.g. where there are at least 3 letters typed)
Any idea?
On Android you can use Places API for Android.
Please look at this web site:
https://developers.google.com/places/android-api/
Places API for Android provides Place autocomplete and Place picker.

Getting the nearest results in Geocoder and show them and some other questions about Geocoder

I am working on an application which will have a textview/searchview or a more preferrable way to take a String, make a search of that string and show some results. And whenever the user clicks one of the result it will take user to the another Intent which have a map that points to the clicked results.
I am searching this for days, I read many articles in here, or in Google Developer pages, I know that I need to use Geocoder, and for this I think the best one for my app is this Google API
http://maps.googleapis.com/maps/api/geocode/json?address="+geocodingSearch+"&components=country:TR&sensor=false";
geocodingSearch will be the String that written by user.
*My first question is does sensor=true makes a big difference? Do you prefer to use it? Or do you prefer something else?
*In Google's example it uses region=es in one of them and components=country:ES in another of them. What are the differences between them? Also does it works perfectly, or using borders is better?
*I don't have any problem of parsing JSON answer, but I am not sure about how to show the results. I want it to be seen as the way that search results as in the bottom. It doesn't need to make a search as the user types, but the result part will be better like this. Do I need to use a SearchView or something else?
*And the final question is written in the title. Is it possible to get the nearest results at top in Google API part (I am able to get the Location), I don't want to limit by borders, but getting the nearest results will be better. If this is not possible I will try to sort them by making calculations with LatLong values.
Thanks in advance, and I will be greatful by your helps.

Using Google Maps to display Search Results

I've been searching all up and down google trying to find this as well as SO. I just want a simple url that will display 1) The person's current location and 2) All search results in that area pertaining to the search string that I supply. So it would look something like this preferably.
http://maps.google.com/maps?location=currentlocation&radius=500&keyword=food
Where the keyword food is any search string that I would like placed in there. I need this to be a url that can be opened in both iPhone and Android (at the very least iPhone). I plan on opening it in a webview or the maps app.
Also yes I have tried plugging in long/lat in place of current location as well and still couldn't get it working. And I know that I will probably end up having to get their long/lat in code and using that, I just want the area search portion to work. If you have any ideas on how to get what I'm trying to accomplish I would appreciate it.
This is the link I get from Google Maps when I search food.
http://maps.google.com/maps?q=food&hl=en&sll=40.796934,-73.949232&sspn=0.018924,0.023174&hq=food&t=m&z=16
It seems to break down like this:
Base URL
http://maps.google.com/maps?
Search Term
q=food
Position
sll=40.796934,-73.949232
Span
sspn=0.018924,0.023174
Zoom Level
z=16

Categories

Resources