function replacev(point:string):string;
begin
Result:=StringReplace(point,',','.',[rfReplaceAll, rfIgnoreCase]);
end;
procedure GeoDZ(ip,ip2:string;zoom : string ='5');
var
GeoIP: TGeoIP;
GeoIPCity,GeoIPCity2: TGeoIPCity ;
begin
GeoIP := TGeoIP.Create('GeoLiteCity.dat');
try
with Form1 do begin
mmo1.Clear;
if GeoIP.GetCity(ip, GeoIPCity) = GEOIP_SUCCESS then begin
mmo1.Lines.Add('Latitude: '+ FloatToStr(GeoIPCity.Latitude)) ;
mmo1.Lines.Add('Longitude: '+ FloatToStr(GeoIPCity.Longitude));
mmo1.Lines.Add('DmaCode: '+ FloatToStr(GeoIPCity.DmaCode)) ;
mmo1.Lines.Add('AreaCode :'+ FloatToStr(GeoIPCity.AreaCode)) ;
mmo1.Lines.Add('CountryCode :'+ GeoIPCity.CountryCode);
mmo1.Lines.Add('CountryName :'+ GeoIPCity.CountryName);
mmo1.Lines.Add('Region :'+ GeoIPCity.Region);
mmo1.Lines.Add('City :'+ GeoIPCity.City);
mmo1.Lines.Add('PostalCode :'+ GeoIPCity.PostalCode);
if GeoIP.GetCity(ip2, GeoIPCity2) = GEOIP_SUCCESS then
wb1.Navigate('http://maps.google.com/maps/api/staticmap?center='+floattostr(GeoIPCity.Latitude)+','+floattostr(GeoIPCity.Longitude)+'&zoom='+zoom+'&size=400x278&sensor=true&&markers=color:green|label:S|'+replacev(floattostr(GeoIPCity.Latitude))+','+replacev(floattostr(GeoIPCity.Longitude))+'&markers=color:red|label:|'+replacev(floattostr(GeoIPCity2.Latitude))+','+replacev(floattostr(GeoIPCity2.Longitude))) else
wb1.Navigate('http://maps.google.com/maps/api/staticmap?center='+floattostr(GeoIPCity.Latitude)+','+floattostr(GeoIPCity.Longitude)+'&zoom='+zoom+'&size=400x278&sensor=true&&markers=color:blue|label:S|'+replacev(floattostr(GeoIPCity.Latitude))+','+replacev(floattostr(GeoIPCity.Longitude)));
end
else
mmo1.Text := 'ERROR';
end;
finally
GeoIP.Free;
end;
end;