Skip to content

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

License

Notifications You must be signed in to change notification settings

mihai-craita/countries_center_box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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:

    fetch('./countries.json')
        .then(response => response.json())
        .then(countries => {
            const INDIA = countries.find(country => country.long_name === 'India')
            console.log(INDIA)
            const FRANCE = countries.find(country => country.short_name === 'FR')
            console.log(FRANCE)
            /* // for google maps
            var myOptions = {center: new google.maps.LatLng(FRANCE.center_lat, FRANCE.center_lng)}
            var map = new google.maps.Map(document.getElementById("myMap"), myOptions);
            var bounds = new google.maps.LatLngBounds(
                        new google.maps.LatLng(FRANCE.sw_lat, FRANCE.sw_lng),
                        new google.maps.LatLng(FRANCE.ne_lat, FRANCE.ne_lng) );
            map.fitBounds(bounds); 
            */
        });

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published