samirpdl / countries_center_box

List of countries with their latitude and longitude center and fitting bounds for google maps displaying

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repo contains a list of countries containing center, south west and north east latitude and longitude. The list can be used for centering on a country in google maps.

Here is a code example:

 function initialize() {
     $.getJSON('countries.json', function (countries) {
         var index_country = 40;
         var myOptions = {
             center: new google.maps.LatLng(countries[index_country].center_lat,countries[index_country].center_lng),
         }
         var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
         var bounds = new google.maps.LatLngBounds(
             new google.maps.LatLng(countries[index_country].sw_lat, countries[index_country].sw_lng),
             new google.maps.LatLng(countries[index_country].ne_lat, countries[index_country].ne_lng) );
         map.fitBounds(bounds);
     });
 }

About

List of countries with their latitude and longitude center and fitting bounds for google maps displaying

License:GNU General Public License v2.0