How to get object GMSPlace by longitude and lattitude and without GooglePlacePicker? - ios

I have coordinates for the place on map. Is it possible to get GMSPlace object using some method (without GooglePlacePicker) like currentPlaceWithCallback with custom longitude and lattitude?

with out GooglePlacePicker, you can use CLGeocoder!.

Related

Get GMSPlace from longitude/latitude coordinates?

I looked at the API here, but it only mentions that you can get the GMSPlace for the user's current location. Is there any way to create my own custom GMSPlace object or get the GMSPlace for the lat/long I want? I looked at previous solutions but didn't find anything.
As per Google's docs:
Represents a particular physical place. A GMSPlace encapsulates
information about a physical location, including its name,
location, and any other information we might have about it. This
class is immutable.
Apparently there is no way to make your own GMSPlace object from the coordinates, nor there' a method that Google's SDK provide.
What I did before, I search for places, the one that Ajay user above discussed.
So the process is:
Get coordinates.
Reversegeocode to get the string address.
Search the string address using the GooglePlaces autocomplete.
From the first result in #3, the placeId is used to get the GMSPlace object using the lookUpPlaceID method.
Beware though that sometimes it returns a wrong address. I've tried it.
GMSPlace is a class provided by Places SDK which provides information about a specific place. You can not create your own custom object.
EDIT: To find a place other than your current location it provides Autocomplete api which automatically return location suggestions while users type.

Google Places API get coordinates

I have a city place ID, but I need to get latitude and longitude from it.
My method was to let the user search for a place name, hit the API to get a list of suggestions, and when the user selects a single choice, hit the API again to get latitude and longitude.
I can get the place ID, but I can't find anywhere in the API to grab the longitude and latitude from it.
Developing for iOS, if that matters.
You need to call the lookupPlaceId method of GMSPlacesClient. See Get Place By Id for more details.

What's the best way to get an address from an annotation?

I'm trying to have a user click an annotation and in the next view some information such as an address is represented in a UITextField. However when trying to get annotation.subtitle I get an error regarding the return value of MKAnnotation.subtitle to be String?? instead of what I want, String. Should I be using reverseGeocodeLocation ?
Yes, use it you will get a CLPlacemark Object, that contain, name, address...
Reference: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLPlacemark_class/index.html#//apple_ref/swift/cl/c:objc(cs)CLPlacemark

Convert coordinates to address

I want to know how you convert geo coordinates into an address. I have already tried the CLGeocoder class but I have no idea how to convert my data.
Thanks
You need to use the CLGeocoder Class to get a coordinate to physical address lookup. The command you are looking for is reverseGeocodeLocation:completionHandler:. You pass your CLLocation location object containing the coordinate data to look up.
Read more about it in Apple's CLGeocoder Class Reference.

How to show multiple route IOS Mapview

I am creating IOS Application map based application in my app I like to show the route/path between source and destination and also I have done that but I will show only one route/path. I like to show all the possible path between the source and the destination like google map. To illustrate my idea I have added the screenshot I like to show path like this. Is there is any sample for this?
Thanks in advance
Follow these simple steps :
Get Two Input locations.
Use the method -geocodeAddressString: completionHandler: of Geo Coder class (from Core Location Framework) for getting the coordinates for the given location string.
Use MkPointAnnotation object for creating annotation on the locations in map.
Send request to the google API for getting the Direction between two locations.
As of the google API Response (Available in both JSON & XML) You would have overview_polyline object, which has the array of location coordinates. But they were encoded, you have to use the correct decoding module to get the latitude and longitude.
With the decoded location coordinates you can create the poly lines using MKPolyline instance method. MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:coordinates count:[overlayPoints count]]; [mapView addOverlay:polyLine];
Now the polyline have been drawn over the map still it will not be visible as the final go we have to override the -viewForOverlay method for displaying the poly line view.
If you still have any confusions then you can always check some Tutorials.

Resources