How to get nearby places using the geonames API? - geonames

we are trying to get nearby locations using the geonames API, we have used /findNearbyPostalCodes and /findNearbyPlaceName and /findNearby for example but we are getting some locations like parks and hotels, instead we want to get cities and populated locations, is there any way to do this ? Thanks.

Related

Google Maps - Get cities by country

I want to list all cities by country, also get latitude and longitude of the city.
How can I do this by google maps?
how about using a data source instead? something like http://www.geonames.org/ ?

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

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.

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

Finding nearby addreses by geo location in rails

I have stored users - including their addresses - and need to find all users who live within a certain distance of a specific location.
I am using geocoder and have stored longitude and latitude in the Users table.
How do I find these user?
To do a query based on lat/lon, do this:
User.near([39.41, 90.23], 10)
That will find users within 10 miles of the lat/lon pair.
Here are the docs: https://github.com/alexreisner/geocoder

Rails Finding towns within a 10 mile radius of postcode. Google maps API

I'm using the geocoder gem and was wondering if there is a way to get all cities within a radius (with center coordinates).
Something like
city = location.cities(100) #all cities within 100km
There seems to be a PHP solution, but I'm not sure how it can be used in my case.
Thanks!
I don't believe GoogleMap API offers spatial search. Geonames.org site publishes such a Web service -- the associated Geonames gem doc has a specific example for finding places near a lat/long point:
places_nearby = Geonames::WebService.find_nearby_place_name 43.900120387, -78.882869834

Resources