Отображая geoip на карте Google, вы можете использовать бесплатный сервис geoip на http://freegeoip.net/json/ и наносить на карту точки, как показано ниже:
var geoLocations = getLocations();
var center = getCenter();
var map = new google.maps.Map(document.getElementById('googlemap'),
{
zoom: 1,
center: new google.maps.LatLng(center[0], center[1]),
mapTypeId: google.maps.MapTypeId.SATELLITE
});
var markerInfo = new google.maps.InfoWindow();
var pointMarker, i;
// Go through the location array...
for (i = 0; i < geoLocations.length; i++)
{
// Add the marker.
pointMarker = new google.maps.Marker(
{
position: new google.maps.LatLng(geoLocations[i][1], geoLocations[i][2]),
map: map
});
// Add the information window when clicking the marker
google.maps.event.addListener(pointMarker, 'click', (function(pointMarker, i)
{
return function()
{
markerInfo.setContent(geoLocations[i][0] + ' -> ' + geoLocations[i][3]);
markerInfo.open(map, pointMarker);
}
})(pointMarker, i));
// Zoom on double click
google.maps.event.addListener(pointMarker, 'dblclick', (function(pointMarker, i)
{
return function()
{
map.setZoom(17);
}
})(pointMarker, i));
}
Пример кода для вызова бесплатного сервиса geoip с использованием pythonВы можете найти здесь: https://github.com/jamesrep/geoipard