How to capture city name - geolocation

Is there an accurate way to capture the city/town/village of a user without having them mention it.The gps co ordinates only give you the distance from a specific spot.

According you have a database (from geoname or whatever open or private sources you can easily find on internet) or use an api (like api.geoname.org), you can locate in which village is the coordinate and then find the town, then the country ...

Related

Looking up timezone from region / coordinates

I would like to look up a timezone based on an ISO region code or coordinates.
I have a collection of data points with coordinates, county and region codes, eg:
33.942501,-118.407997,"US","US-CA"
I want to find the IANA timezone identifier, eg. America/Los_Angeles, based on the above info.
Is it possible to do that with NodaTime? I cannot see a way to look up DateTimeZone or timezone identifier from a region code or location.
The GeoTimeZone NuGet package can provide a lookup by lat/long to IANA ID, and then you can use DateTimeZoneProviders.Tzdb[id] to get the DateTimeZone from that. See the project home page for more details.
Within Noda Time itself, you can use TzdbDateTimeZoneSource.Default (or one that you've loaded) and then the ZoneLocations or Zone1970Locations properties to find zones for specific ISO-3166 countries... but they doesn't go below the "country" level (although they do have exemplar lat/long values). They're based on zone.tab and zone1970.tab - so any information not in that file isn't present in Noda Time either.
It sounds like GeoTimeZone is probably your best option here.

how to get geojson of mainly cities of all of country of the world

I'm making a map use echarts with geojson mapdata,but i need a geojson resource that contain main cities of all of country of the world,i had looked for everywhere on website ,but the mostly resource is just have border of country not has cities border data. and i also checked the highcharts mapdata resource but the crs option is ESPG type .i need the Longitude latitude coordinates
depends on how many city do you want?
If you want 36430 city with only city name, go here
https://github.com/drei01/geojson-world-cities
If you want 1240 city with lots of details info go here: (choose populated-place)
http://geojson.xyz
if you only need major 120 city with only city name go here: (choose world city)
https://github.com/mapbox/mapping
Go to http://geojson.xyz and look for "populated places" and "populated places simple"
You can also take GeoJSON from website NaturalEarhData.com available at Github e.g ne_10m_populated_places.geojson and ne_10m_populated_places_simple.geojson
In fact, GeoJSON.xyz takes the data from NaturalEarthData.
Here you have geojson of continents, countries, country groupings, regions and states of all the world:
https://github.com/rapomon/geojson-places

iOS: Getting Cities/Counties between Start Location and End Destination Using Google Map or Directions API

Hi Experts and Friends,
I have been searching for a solution for this seemingly simple task for days already, but I don't seem to have come across any useful approach.
Here is what I want:
Get my current location using CLLocation (ok here)
Get the final destination I enter (also ok here)
What I would like to accomplish is: get a list of cities in between these two points.
If the start location lies within the same city limit of the end destination, then simply show only that city in which the start location is.
EX: Current Location SF
Destination: Cupertino
Cities in between: Daly City, San Bruno, etc etc ....Santa Clara....Cupertino.
Is it possible to grab these from Google APIs? And am not talking about the "steps", because many steps can lie within a city limit, am only interested in cities (or county).
If so, which (v2.? v.3?) one? Or from Directions API? How are they different by the way? Am asking because different people seem to have different answers.
Thanks in advance. Regards.

How to determine which city a given long and latitude points represent?

I'm currently using a very large geo-ip database that i've built as a mixture from many freeware sites.
The problem is - the mapping of all those database is : map: (ip) -> (latitude,long)
I'm looking for a way that will deduce the location of those latitude and long points by resolution of a city and if possible - offline.
thanks
You may want to try Google Geocoding http://code.google.com/intl/en/apis/maps/documentation/geocoding/
to do it offline, you'll need a database of long/lat coordinates, such as this: http://www.maxmind.com/app/worldcities
then to match the long/lat to the cities, you'll have to build an algorithm which narrows it down to within a margin of error.
a brute-force method might be to measure the distance by using pythagoras' theorem, but that would rapidly kill your CPU. a better way may be to start by excluding results that are 1 or more above or below your target lat/long, then do your measurements on the remaining results.
you can get city and region lat/lon information from citycsv.com if you really need your info offline. It would be easy to query the data for lat/lon and get a city or region back. However as stated google would be able to take a lot of overhead off your hands with their online geocoding tools.
you could run google's geocode in burst-mode (2.500 max per day) through a cron job and fill up your offline database over the course of ....

Lookup telephone area code by latitude and longitude

Looking for a way to get a list of telephone area codes for a given latitude and longitude (and if necessary a given intl. code.) Note, I'm not talking about international dialing prefixes but the area codes within them.
For example, Denver Colorado is covered by the area codes 303 and 720. It's at 39.739 -104.985 and is in NANP 1. So given 39.739,-104.985,1 I'd like to get back [303,720].
Libraries, web services, DB's, or raw data that needs to be parsed into a DB, e.g., a web page of shape points, are all fine and the more global coverage the better, but just NANP 1 would be a great help.
Note I already use MaxMind and could turn the lat-lng into a fake IP and use that as the lookup key, but MaxMind claims only U.S. area codes (whether they truly mean U.S. or actually NANP I haven't tested) and seemingly only 1 per location (e.g. just 303 for Denver.) So it's a possibility, just not a great one.
UPDATE: I found some more relevant information, but no definitive solutions so I'm listing it here rather than in an answer:
I was able to find two U.S. databases http://www.area-codes.com/area-code-database.asp and http://www.nationalnanpa.com/area_codes/index.html (50% down the page, MS Access file.) The former includes lat/lng for $450 and the latter would require nearest-neighbor matching as KeithS talks about (it's probably the same DB underlying the NANPA City Query he found.)
Additionally I found information that implies Teleatlas has area code boundary maps and that ESRI includes area code shape files with copies of ArcGIS. Maponics seems to have data available: there's a Google Maps implementation of Maponics' data at http://www.usnaviguide.com/areacode.htm.
Wow. You'll definitely need some sort of pre-existing database of points. My first thought was ZIPList5 Geocode. It includes lat-long data for each active U.S. ZIP code, so you can throw this data in a DB table, index the hell out of it, and search by just about any geographic info you'd have access to. You can buy one copy for $40, with enterprise-level use for $100. Only problem is that this DB has only the "primary" area code for each ZIP code, so metro areas that have more than one (Dallas, Chicago, NYC) aren't going to show all of them.
You could try a two-pronged approach with some free data I found: for a given latitude and longitude, do a nearest-neighbors search of the data in the USGS Geographic Names Information System; it includes information on every human habitation center, and every named landmark feature, with lat/long coordinates of their centers. You now have your lat/long point mapped to the nearest town/city, ZIP code, county, and state. Now, you can compare that against this list of U.S. Area Codes, to find area codes matching any or all of the identifying information from the USGS. This is all free, and will eventually get you what you need, but you'll probably have to do some work to "massage" the two sets of data into something you can efficiently cross-reference, and/or you'll need to implement a good "search engine" that will accurately find nearest-neighbor named points, and then find area codes for locations matching the names.
One more thing to look at is NANPA, which administers area code assignment to begin with. I'm sure they have a more comprehensive downloadable DB, but the only free public access I could find was this search page, which will find area codes for any city with >20k people. You could turn your lat/long data into a city and state, and then hit this search page: NANPA City Query
Here is an option:
http://geocoder.ca/39.739,-104.985?geoit=xml
<TimeZone>America/Denver</TimeZone>
<AreaCode>720,303</AreaCode

Resources