how to get latitude and longitude of a place using objective-c? - iphone

how to get latitude and longitude values of a particular place using objective-c ? Do I need to get this using Google Geocoding API or Is there any other way to get this?

The iPhone only knows its current location (if using location-service). For getting the current location and for locations like: 10km east, 2km north from current location you can use the location-service (CoreLocation) but for any other location (which are identified via a name, street, text) you have to use a web-service like Google Geocoding API, Open Street Map Nominatum, YahooMaps-Geocoding (yes, they have one...), ...

Related

How can I search street or postal address on simplekml without using coordinates

I have a list of street addresses, weekly my database grows. For example 10 Hage Geingob Walvis Bay. I need to plot their positions on Google Mymaps (or alternatively Google Earth) using the kml file. I'm doing it via Python. I'll eventually have control over the labels, colors, titles, descriptions offering me some value.
However the code seems to only respond to coordinate (lat/long) input, using the "coords" command. When using "address" command it simply targets the 0,0 lat/long position in the ocean.
I would appreciate any help on how to use the a street address as the input directly into simplekml...as if I typed the street address directly into google maps or google earth.
As a workaround I have used geocode functions such as geopy and Nominatim ...to establish GPS coordinates and then feed that to simplekml ...but accuracy is terrible. Some addresses are accurate, some are miles off.
I'm not interested in setting up keys and API's in GoogleV3.
Code used as workaround
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="redacted")
location = geolocator.geocode(address)
print(location.address)
print((location.latitude, location.longitude))
import simplekml
kml = simplekml.Kml() # Create an instance of Kml
single_point = kml.newpoint(name=address, coords=[(location.longitude,location.latitude)])
kml.save("10 Hage Geingob.kml")```
When in my view it should be possible to do the following according to the simplkml documentation...
```street_address = '10 Hage Geingob Walvis Bay'
import simplekml
kml = simplekml.Kml()
kml.newpoint(name=street_address, address=street_address)
kml.save("10 Hage Geingob.kml")```
...but it doesn't work. Any help is much appreciated thank you. I am indeed a complete noob.
Thank you

In iOS cross launching Uber app when longitude and latitude not available

Is it possible to pass drop off location by cross launching Uber app when longitude and latitude are not available ?
For example, if I know location coordinates, my dropoff parameters are:
dropoff[latitude]
dropoff[longitude]
dropoff[nickname]
dropoff[formatted_address]
Sample URL:
uber://?client_id=<client_id>&action=setPickup&pickup=my_location&dropoff%5Blatitude%5D=37.621313&dropoff%5Blongitude%5D=-122.378955&dropoff%5Bnickname%5D=San%20Francisco%20Airport&dropoff%5Bformatted_address%5D=San%20Francisco,%20CA%2094128,%20United%20States
Everything works great. See attached screenshot:
Drop off Destination correctly populated
What if I dont have longitude and latitude ? My dropoff parameters is only nickname:
dropoff[nickname]
Sample URL:
uber://?client_id=<client_id>&action=setPickup&pickup=my_location&dropoff%5Bnickname%5D=300%20el%20Camino%20real,%20Sunnyvale,%20ca
I would expect in absence of coordinates the nickname is used as a query (same as what used when coordinates are available). But the destination is empty in this case.
Drop off Destination is emtpy
Is this an expected behavior ?
Including only the dropoff nickname does not set the dropoff location. The latitude and longitude are required for setting the location, while the nickname/address are used for visual purposes.
You can use Apple's CLGeocoder class to do geocoding on your nickname and get a location coordinate to pass in the deeplink.

What's wrong with this Last.fm geo.getEvents API query?

I'm attempting to use the geo.getEvents method in Last.fm's Web services, which you can read about here:
http://www.last.fm/api/show/geo.getEvents
I'm attempting to use it like this:
http://ws.audioscrobbler.com/2.0/?method=geo.getevents&lat=40.7903&long=73.9597&api_key=0382f639e72b14c9265d41993d28a110&format=json
Those are the Latitude and Longitude coordinates for New York City. However, I get back a responses saying there are not events there. Even if I add a distance parameter, it says the same thing. Also if I round those coordinates to integers.
Is there something wrong with my queries, or is the service just messed up?
Thanks.
New York is 73 deg. WEST, so you need to use a negative value for the longitude, and the URL should be:
http://ws.audioscrobbler.com/2.0/?method=geo.getevents&lat=40.7903&long=-73.9597&api_key=0382f639e72b14c9265d41993d28a110&format=json

Turning off reverse geocoding when opening "Maps" in iPhone through a URL with lat./long. parameter

I am trying to figure out how to use the Google Maps URL format for sharing locations as latitude/longitude in an app that I am developing for iPhone.
Example: http://maps.google.com/maps?q=40.77407,-73.96675
This is a point in Central Park, New York. When using this on an iPhone, "Maps" will open and reverse geocoding will be done, resulting in an address on the nearby 5th Ave.
But for sharing a meeting point in Central Park, this is quite useless!
Is it possible to specify any parameter in the query string that will turn off reverse geocoding, so that the exact lat/long position is shown in the "Maps" app on iPhone?
(Compare with the result one will get when entering this url on a desktop, where the exact location will always be pointed out by a green arrow.)
I found the answer myself: Adding "loc:" immediately after "q=" will turn off the reverse geocoding.
Example: http://maps.google.com/maps?q=loc:40.77407,-73.96675
Instead of a generic 'q', which according to specification is treated like a generic query
This parameter is treated as if it had been typed into the query box by the user on the maps.google.com page. q=* is not supported.
you could try ll or saddr.
ll The latitude and longitude points (in decimal format, comma separated, and in that order) for the map center point.
saddr The latitude and longitude points from which a business search should be performed.
The maps url scheme is specified here: http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html

Issues with google map api

Hi i am using goole map API for my application to get the path drawn for my app. But the issues is when i call the following API
http://maps.googleapis.com/maps/api/directions/json?origin=Chicago&destination=158%20Waterston%20Avenue,%20Wolliston,%20MA,%2002170,%20&waypoints=optimize:true%7C134%20Wimbleton%20Drive,%20Longmeadow,%20MA,%2001106,%20%7C&sensor=false&mode=driving
The path drawn as per the value in "points" tag (here we get instruction to path to follow as well as latitude and langitude) from the above API call is as below
Here my current location i am passing is chicago as my current location.
I am drawing the path with mkpolyline function with the lat lon i get from "points" key .
I dont whats the issue there .
Ya after putting some effort i found that we need to pass the parameter avoid = highway , bydefault if we do not pass anything it takes up avoid = tolls so this was the issue i was facinf , later passing avoid = highway gave me the output i needed.