How are JAVASCRIPT-IP addresses converted to latitude coordinates?

Source: Internet
Author: User
Tags geoip geoip database
Recently, in making map-related applications.
There is a large number of user data is the IP address, if the user is marked on the map, the IP address needs to be converted to latitude and longitude coordinates.
Is there any feasible way to achieve this?

Reply content:

Recently, in making map-related applications.
There is a large number of user data is the IP address, if the user is marked on the map, the IP address needs to be converted to latitude and longitude coordinates.
Is there any feasible way to achieve this?

I have done a similar thing, using the scheme of comparison toss:

    • Nginx has GeoIP module, check whether the installed Nginx compiled this module.
Nginx-vnginx version:nginx/1.1.19tls SNI Support enabledconfigure arguments:--prefix=/etc/nginx--conf-path=/etc/ nginx/nginx.conf--error-log-path=/var/log/nginx/error.log--http-client-body-temp-path=/var/lib/nginx/body-- http-fastcgi-temp-path=/var/lib/nginx/fastcgi--http-log-path=/var/log/nginx/access.log--http-proxy-temp-path=/ Var/lib/nginx/proxy--http-scgi-temp-path=/var/lib/nginx/scgi--http-uwsgi-temp-path=/var/lib/nginx/uwsgi-- Lock-path=/var/lock/nginx.lock--pid-path=/var/run/nginx.pid--with-debug--with-http_addition_module--with-http_ Dav_module--with-http_geoip_module--with-http_gzip_static_module--with-http_image_filter_module--with-http_ Realip_module--with-http_stub_status_module--with-http_ssl_module--with-http_sub_module--with-http_xslt_module --with-ipv6--with-sha1=/usr/include/openssl--with-md5=/usr/include/openssl--with-mail--with-mail_ssl_module-- Add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-auth-pam--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-echo--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-upstream-fair-- Add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-dav-ext-module

If it is not recompiled with a GeoIP module Nginx use.

    • Nginx configuration file Configuration GeoIP database, GEOIP database has a fee, there are free downloads, I am free, often updated.
HTTP {        geoip_country  /etc/nginx/geoip.dat;        Geoip_city     /etc/nginx/geolitecity.dat;}
    • The GEO information can be passed to the application via the fastcgi parameter, and the following is an example of a Django fastcgi configuration.
#GeoIPfastcgi_param geoip_country_code $geoip _city_country_code;fastcgi_param geoip_country_code3 $geoip _country_ Code3;fastcgi_param geoip_country_name $geoip _country_name;fastcgi_param geoip_city_country_code $geoip _city_ Country_code;fastcgi_param geoip_city_country_code3 $geoip _city_country_code3;fastcgi_param GEOIP_CITY_COUNTRY_ NAME $geoip _city_country_name;fastcgi_param geoip_region $geoip _region;fastcgi_param geoip_city $geoip _city;fastcgi _param geoip_postal_code $geoip _postal_code;fastcgi_param geoip_city_continent_code $geoip _city_continent_code; Fastcgi_param Geoip_lat $geoip _latitude;fastcgi_param geoip_lng $geoip _longitude;
    • Django passes the latitude and longitude to the foreground via Ajax and gives it to the Google Map API display. If it is the domestic IP may not be accurate, I used a pure IP database, the method Google a lot.

The limitation of this method is to use Nginx + fastcgi, which is not suitable for all people.

No meaning. The IP address translates over the city information. The latitude and longitude of urban information is the central point of regional administrative planning.

I also have to do IP geo-location query site idea.

Check out, http://www.iplocationtools.com/This API looks more reliable.
This site http://www.ipgeo.com/also claims to provide the API, but the domain name of the API can not be resolved.
The SAE also offers a paid interface.

See if this has helped https://developers.google.com/maps/do ...

Http://freegeoip.net/static/index.htm ...
Returns the JSONP data.

HTTP://WWW.HAOSERVICE.COM/DOCS/8 here is the Latitude data interface, based on the location of the provided coordinates and other queries

  • Related Article

    E-Commerce Solutions

    Leverage the same tools powering the Alibaba Ecosystem

    Learn more >

    Apsara Conference 2019

    The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

    Learn more >

    Alibaba Cloud Free Trial

    Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

    Learn more >

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.