Google Maps SDK iOS Easy way of getting Capital Cities with Longitude and Latitude - ios

Is there an easy way to get a list of Capital Cites with their latitudes and longitudes?
I am just displaying a google map view and I would like to display markers for capital cities.

You can use google location api service, it is free up to 2,500 url calls per day, here is the link for further information.
And all capital cities latitudes and longitudes are listed in this website:
Edited:
You could use plist directly from this website:
How to parse dictionary object.

Related

Get random address/coordinates in a specified town

Is there any way to give Google Maps API or a similar API a town name and have it return a random address inside the town? I was hoping to be able to get the data as a JSON so I could parse it with SwiftyJSON in XCode and use it, but I can't seem to find any way to get the address in the first place. If coordinates would be easier to get, then those would work too, as long as its random and inside the town borders.
You can try to use Google Places API Web Service. It allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more. You can search for places either by proximity or a text string. A Place Search returns a list of places along with summary information about each place.
A Nearby Search lets you search for places within a specified area. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
A Nearby Search request is an HTTP URL of the following form:
https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters
where output may be either xml or JSON values.
And if you want either address or coordinates, you can use Geocoding for it. Here i found a tutorial on how to use Geocoding in IOS.

Example of apple maps url to find the directions to certain coordinates

https://developer.apple.com/library/mac/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
I'd like to create a url which will open the maps app on iphones and make it show the directions from the user's current location to the certain coordinates.
Could you show an example of such url?
Just use latitude and longitude values separated by a comma as the destination address:
http://maps.apple.com/?daddr=37.331778,-122.031375

Given longitude and latitude, how to find country

If I have a latitude and longitude, how do I find out the country of that location..
If found out about Google Reverse Geocoding, but unfortunately, it requires the service to be used along with Google Maps, which is not my case..
Is there a static database or something which I can refer to? It would be better if I have a static database as opposed to a service..
Without a service, it is a lot of work.
First, you need the country polygons with assigned country codes. One country will have on average approx 50.000 vertices.
Then it's a simple point-in-polygon search.
Use a spatial index to limit the country polygon to search.
It becomes a bit more difficult if you have to consider enclaves.
You can use Bing Maps Api, it doesn't require displaying maps as far as I know,
http://dev.virtualearth.net/services/v1/geocodeservice/geocodeservice.asmx/ReverseGeocode?latitude=22.98&longitude=35.43637&key=[YOU_KEY]&culture=%22en-us%22&format=json
You can use the geonames.org "Country code / reverse geocoding" webservice, for example:
http://api.geonames.org/countryCode?lat=47.03&lng=10.2&username=demo
-> AT

How to get nearby location on google maps give a lat and lng coordinates

I wish to know how to get nearby location over a certain range of radius.
For example I have location of stores data stored in the database, and I want to search for a coffee over a range of 25 radius or 40 radius or even more, from a given lat and lng coordinate and then display them with their various distance from this lat and lng coordinate. I saw an example on Google but it's not working.
I would do the requested app as follows , i realize there are other ways to do it, i try:
would first go to Google code playground and get sample for the geo location.
rewrite the java script function so that it takes the longitude and latitude as parameters.
include the html file in your project , then create a webbrowser control in your csharp app.
then call the navigate to local page which will launch the page with the given longitude and latitude
You may use iFreeTools Creator - an online database app builder over Google App Engine - to store and search the geo-location database.
For a step-by-step guide on how you can do this, refer to the following blog post..
Building a Store Locator type Google Maps app over GAE, using iFreeTools
// Disclosure : I wrote code for this web-app.

City By GPS Location Latitude/Longitude

I've got a latitude/longitude value.... How can I search and get the city?
If you're looking for free (as freedom) sources, you can use Geonames API findNearbyPlaceName.
For example the following returns nearest Placename:
http://api.geonames.org/findNearbyPlaceName?lat=47.3&lng=9&username=demo
More information is available here
http://www.geonames.org/export/web-services.html#findNearbyPlaceName
Another option is getting data from Freebase. Instead of single point it takes bounded box:
http://api.freebase.com/api/service/geosearch?location=[30.2,50.4,30.6,50.8]&location_type=/location/citytown&inside=true&indent=1
Using the google maps api, here is an example to get the address in XML format.
http://maps.google.com/maps/api/geocode/xml?latlng={latlng}&sensor={sensor}&region={region}
Where latlng = 0,0 sensor = false, and region = country code, so for my old address it would be
http://maps.google.com/maps/api/geocode/xml?latlng=-43.893792,171.7592620&sensor=false&region=nz
Then you can use that XML to get whatever details you need, including the City

Resources