Giter Club home page Giter Club logo

country-geolocation-data's Introduction

Country Geolocation Data

About

Here are three PHP files I used when creating my IP geolocator. These files contain arrays that map two-letter ISO 3166-1 alpha-2 country codes to the name of the country's continent and the name of the country's time zone.

Country to Continent Mapping

The CountryContinents.php file contains two arrays. The $CONTINENTS array maps two-letter continent codes onto the name of the continent.

$CONTINENTS = array(
    "AS" => "Asia",
    "AN" => "Antarctica",
    "AF" => "Africa",
    ...
);

The $COUNTRY_CONTINENTS array maps two-letter country codes onto the two-letter code of the country's continent.

$COUNTRY_CONTINENTS = array(
    "AF" => "AS",
    "AX" => "EU",
    "AL" => "EU",
    ...
);

Country Latitude and Longitude

The CountryLatLang.php file contains the $COUNTRY_LAT_LANG array, which maps two-letter country codes onto the latitude and longitude of the centre of the country.

$COUNTRY_LAT_LANG = array(
    "AD" => array(42.50, 1.50),
    "AE" => array(24.00, 54.00),
    "AF" => array(33.00, 65.00),
    ...
);

Country Time Zones

The CountryTimeZones.php file contains the $COUNTRY_TIME_ZONES array, which maps two-letter country codes onto the name of the country's time zone. Countries with multiple time-zones are represented by an array of time-zone name and time-zone longitude pairs.

$COUNTRY_TIME_ZONES = array(
    ...
    "AT" => "Europe/Vienna",
    "AU" => array(
            array("Australia/Adelaide", 138.583333),
            array("Australia/Brisbane", 153.033333),
            array("Australia/Broken_Hill", 141.45),
            ...
    ),
    "AW" => "America/Aruba",
    ...
);

Data Accuracy

I found these files useful for my geolocator. As far as I know, the data is accurate but I make no guarantees of accuracy or completeness. Use at your own risk.

country-geolocation-data's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.