2017 © Pedro Peláez
 

library offline-country-reverse-geocoder

Determine which country a lat/long point falls in

image

daveross/offline-country-reverse-geocoder

Determine which country a lat/long point falls in

  • Wednesday, February 8, 2017
  • by daveross
  • Repository
  • 1 Watchers
  • 3 Stars
  • 1,890 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 3 Open issues
  • 7 Versions
  • 77 % Grown

The README.md

Offline Country Reverse Geocoder

Latest Stable Version License Build Status, (*1)

Determine which country a latitude/longitude point falls in, returning an ISO 3166-1 two letter country code. All processing is done locally using a dataset of country borders without needing to connect to an API., (*2)

Uses the data file from https://github.com/bencampion/reverse-country-code, (*3)

Installing

With Composer Total Downloads

composer require daveross/offline-country-reverse-geocoder:~1.0.0

or add the dependency to your composer.json file manually:, (*4)

"require": {
    "php": ">=5.3",
    "daveross/offline-country-reverse-geocoder": "~1.0.0"
}

Without Composer

Copy this library's files to wherever you put third-party libraries in your application. Include src/offline-country-reverse-geocoder.php from this library, and it'll load polygons.properties from the same directory., (*5)

Examples

echo 'Washington DC is in ' . \DaveRoss\OfflineCountryReverseGeocoder\get_country(-77.0164, 38.9047) . "\n";
echo 'Chicago is in ' . \DaveRoss\OfflineCountryReverseGeocoder\get_country(-87.6847, 41.8369) . "\n";
echo 'London is in ' . \DaveRoss\OfflineCountryReverseGeocoder\get_country( -0.12750, 51.50722 ) . "\n";
echo 'New Delhi is in ' . \DaveRoss\OfflineCountryReverseGeocoder\get_country( 77.12, 28.38 ) . "\n";
echo 'Sydney is in ' . \DaveRoss\OfflineCountryReverseGeocoder\get_country( 151.2073200, -33.8678500 ) . "\n";

Dataset

This library uses the world borders dataset from thematicmapping.org. The data is stored in a properties file within the project that maps country codes to Well Known Text format polygons and multi-polygons. The dataset was converted to Well Known Text format by GIS Stack Exchange user, elrobis., (*6)

License

All code is MIT licensed, (*7)

See why I contribute to open source software., (*8)

The data file src/polygons.properties is available under a Creative Commons Attribution-Share Alike License in accordance with the license from https://github.com/bencampion/reverse-country-code, (*9)

The Versions

08/02 2017

dev-master

9999999-dev

Determine which country a lat/long point falls in

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

01/06 2015

1.1.1

1.1.1.0

Determine which country a lat/long point falls in

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

01/06 2015

1.1.0

1.1.0.0

Determine which country a lat/long point falls in

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

01/06 2015

1.0.0

1.0.0.0

Determine which country a lat/long point falls in

  Sources   Download

Creative Commons Attribution-Share Alike License

The Requires

  • php >=5.3

 

The Development Requires

01/06 2015

0.1.2

0.1.2.0

Determine which country a lat/long point falls in

  Sources   Download

Creative Commons Attribution-Share Alike License

The Requires

  • php >=5.3

 

The Development Requires

01/06 2015

0.1.1

0.1.1.0

Determine which country a lat/long point falls in

  Sources   Download

Creative Commons Attribution-Share Alike License

The Requires

  • php >=5.3

 

The Development Requires

01/06 2015

0.1.0

0.1.0.0

Determine which country a lat/long point falls in

  Sources   Download

Creative Commons Attribution-Share Alike License

The Requires

  • php >=5.3

 

The Development Requires