Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Does anybody know where I can find open source world city database that includes:
city names in different languages
region / state / province
country
IP address range
longitude / latitude
For everywhere except the US, try the National Geospatial Intelligence Agency's GNS Country Files dataset and for the USA, use the USGS Domestic Names Database. This data is copyright free and relatively easy to import into MySQL.
These do not include IP address ranges, that sort of data is commercially available from folks like MaxMind
MaxMind's GeoLite City database is free:
http://www.maxmind.com/app/geolitecity
The website has instructions for inserting the contents into a database table.
It contains city, region/state/province, country, IP address range, latitude, longitude and a bunch more info.
http://www.rocky.nu/software/mysql-world-locations-database
This one contains world cities and Latitude / Longitude
You can also get a world database at geonames org
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Now I am developing a small website about Cricket News in php. My plan is to present every day cricket news as posts and my goal is to show viewers their home country's news top most according to their country..! Currently I have ordered only a .com domain name and planning to order some country coded domains (like .lk, .in, .au, .gb, .sa etc) according to your answers. So my question is this.
I have seen a lot of major websites have their own bunch of cc domains and sometimes I cannot go their general .com site even I typed it on the browser's address bar. (I am in Sri Lanka and some websites only show .lk site even I googled or typed their .com names on my address bar..!) I like to include this technique to my website also, but I don't know how. So please help my following questions.
How do I detect visitor's CORRECT COUNTRY?
Do I need any third-party service or add-ons and are there expensive?
How do I change web content according to visitor's country?
Should I buy all cc domain names or can I use following technique?
https://www.sample.com/in/index.php
https://www.sample.com/sa/index.php
Finally, If I can use mentioned technique, how I do that?
You need user IP Address and IP 2 Location API. Try the following example with complete solution to detect User's country.
Try
$userip = $_SERVER["HTTP_CLIENT_IP"];
$ip_data = json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$userip));
echo $ip_data->geoplugin_countryCode;
Output
US
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a database of national park names (Alcatraz Island, Death Valley, Biscayne, etc.) which all have coordinates.
What's the simplest way for me to match the closest park in my database to their current location whether on a mobile device or on a desktop?
You can definitely use Google's Geolocation API to get the user's current location, then with some Javascript, you can determine the closest park.
Don't know what database you're using, but you might look into PostGIS, an extension to Postgres designed to handle geographical data. You would be able to query the database for the closest locations to a certain point. The algorithms for doing so are built in to PostGIS. Otherwise, you might need an external library to do the calculations.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to find research or information as to whether searching for a location by postcode in a web system is more accurate that longitude and latitude values. I am trying to justify why I have chosen the postcode method instead of the longitude and latitude values, or research/information backing up that statement.
I can't seem to find a lot of information regarding it.
Latitude and longitude, with enough precision, can point to any place on Earth, including places outside national boundaries that have no postal codes. Postal codes, on the other hand, are arbitrary boundaries that are unlikely to be available in, say, Antarctica or the Indian Ocean. You use postal codes because most people are familiar with their local postal codes and can fill them into a form, where they probably can't tell you what their local lat/long coordinates are without tools - and those tools may require them to be able to read a map, which some people can't do very well.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Where can I found the list of all the states of world with their country code (ISO2 or ISO3).
I have to insert all these states in my database. If the list is available in the .sql will be great.
I need state list of world with country-code not the country list.
Do you know where can I found?
Thanks in Advance.
http://www.timdavis.com.au/data/
There is a link to a excel spreadsheet of all the country and state information.
Wikipedia has the full list of both 2-letter and 3-letter country codes:
http://en.wikipedia.org/wiki/ISO_3166-1
With regards to having it in a local DB table, note that this list does occasionally change as nations are created, renamed or merged, so although it's not very frequent, you do need to keep it up-to-date, and also importantly, know what you're going to do with codes which become obsolete (ie if you've got cross-references to it from other tables, you can't just delete a record without making the cross-references invalid)
[EDIT]
You comment that you're looking for a state list.
This phrase "state list" is confusing. Are you using the word "state" as its used in the US. Other countries would refer to those as provinces, regions, counties, cantons, or a range of other terms.
More importantly, very few countries have codes for their individual regions.
For example, the UK is broken into counties such as Yorkshire, Hampshire and Surrey, but there aren't any codes that map to these names. There are short abbreviated versions of some of the names (ie 'Hants'=='Hampshire'), but they're colloquial abbreviations; certainly not official. There are also UK postcodes which do provide codes for areas, but these do not map to named counties. And other countries don't even have that.
This has annoyed me too. My issue is I can never find states to match countries. I created this for people to use. Its in YAML format, I generated python and javascript versions. I also generated an alternate array.
https://github.com/niall-oc/minimax
Search google for: php country abbreviations list
Here's the first link: http://27.org/isocountrylist/
http://www.timdavis.com.au/data/
Interesting data for Country & states.
Download excel from here correct the state names and import into your database and use.
You can get the SQL Scripts from this post:
SQL Scripts
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am currently working on a PHP application that puts me in the desperate need of all the Countries, States and Cities in the world.
In the application, when you select a Country from the drop down menu, it loads up all the States in the selected Country into another drop down menu. When you then select a State from the newly generated drop down menu, it then loads up all the cities in the selected State into another drop down menu.
The challenge now is getting all the Countries, States and Cities. I have tried searching Google without results.
Am wondering if there is any PHP library or application that has all Countries, States and cities in it, so i can download and extend.
Thanks very much for your time.
A good place to start would be MaxMind PHP library which uses the freely available MaxMind.com database
there is GeoDataSource World Cities Database (Gold Edition) March.2010. This contains:
city database
latitude longitude
city latitude
cities database
world cities
global cities
world countries
distance calculator
state list
gazetteer
place names
populated places
GPS
and more, there is even a basic and premium package.
** EDIT
May not be worthwhile if your looking for something free however because the free package only offers city names. The basic package is
One Month - $149.95
One Year - $449.95
and the packages only get more expensive.