geocoding

How to determine a zip code and city from an IP address? [closed]

血红的双手。 提交于 2019-11-26 18:27:13
I am looking for advice for open API or 3d party products which will help to convert an IP address to a zip code and city, to make geo-specific web site content. What I use is ip2nation: http://www.ip2nation.com It is a completely free MySQL database of IP to country mappings. They include a few sample PHP scripts at their site. I use it on my WordPress blog along with Ozh's free IP to Nation WordPress Plugin Even if you are not using WordPress, download the plugin as it will give you a good set of PHP code to access the database with. He even has a nice set of tiny country flags that you can

How to obtain longitude and latitude for a street address programmatically (and legally)

安稳与你 提交于 2019-11-26 18:19:46
Supposedly, it is possible to get this from Google Maps or some such service. (US addresses only is not good enough.) Sijin The term you're looking for is geocoding and yes Google does provide this service. New V3 API : http://code.google.com/apis/maps/documentation/geocoding/ Old V2 API: http://code.google.com/apis/maps/documentation/services.html#Geocoding Tim Farley In addition to the aforementioned Google geocoding web service , there is also a competing service provided by Yahoo . In a recent project where geocoding is done with user interaction, I included support for both. The reason is

Geocode multiple addresses

泪湿孤枕 提交于 2019-11-26 18:02:54
问题 I need to geocode around 200 addresses per request and do around 3,000 request per day. I will be doing this server side using PHP. I have looked at How to convert an address to a latitude/longitude?, but could not find a way for either Google Maps HTTP Request API or the Yahoo Geocoding REST API (cannot use JavaScript as this is server side) to send multiple addresses. I will be primarily using this to sort addresses based on the coordinates and if the API supports, fill in any missing data

Google Geocoding v2 API stopped working suddenly

99封情书 提交于 2019-11-26 17:51:25
The Geocoding v2 API stopped unexpectedly. e.g. http://maps.google.com/maps/geo?q=27703&output=json&key=AIzaSyBVr3n3IVZzakGvtIWeRaJEXsC63JHZ0w8 I'm not able to get lat,long from the API. The output from server is: { "Status": { "code": 610, "request": "geocode" } } I searched for status: 610 but could not find any relevant info. Thanks. The service has been stopped. It is the 8th of March. See the top of this page for information on the death of v2 See The Google Geocoding API for v3 ... Edit. Actually, there is a page about upgrading to v3 that may be of use. ... Edit. As just pointed out,

Get real IP address in local Rails development environment

拟墨画扇 提交于 2019-11-26 17:35:25
问题 I have Rails 2.3.8, Ruby 1.8.7, Mongrel Web Server and MySQL database. I am in the development mode and I need to find the real IP address When I use request.remote_ip I am getting the IP as 127.0.0.1 I know I am getting 127.0.0.1 because I am developing on the local machine.. but is there a way to get the real ip-address even if I am on the local machine? I am using these mentioned below in my controller and all I get is 127.0.0.1 with all of them in the view. request.remote_ip request.env[

get city from geocoder results?

这一生的挚爱 提交于 2019-11-26 15:40:15
问题 Having problems getting the different arrays content from geocoder results. item.formatted_address works but not item.address_components.locality? geocoder.geocode( {'address': request.term }, function(results, status) { response($.map(results, function(item) { alert(item.formatted_address+" "+item.address_components.locality) } }); // the array returned is; "results" : [ { "address_components" : [ { "long_name" : "London", "short_name" : "London", "types" : [ "locality", "political" ] } ],

Check if a geopoint with latitude and longitude is within a shapefile

天涯浪子 提交于 2019-11-26 15:09:49
问题 How can I check if a geopoint is within the area of a given shapefile? I managed to load a shapefile in python, but can't get any further. 回答1: This is an adaptation of yosukesabai's answer. I wanted to ensure that the point I was searching for was in the same projection system as the shapefile, so I've added code for that. I couldn't understand why he was doing a contains test on ply = feat_in.GetGeometryRef() (in my testing things seemed to work just as well without it), so I removed that.

Getting distance between two points based on latitude/longitude

别来无恙 提交于 2019-11-26 14:58:22
I tried implementing this formula: http://andrew.hedges.name/experiments/haversine/ The aplet does good for the two points I am testing: Yet my code is not working. from math import sin, cos, sqrt, atan2 R = 6373.0 lat1 = 52.2296756 lon1 = 21.0122287 lat2 = 52.406374 lon2 = 16.9251681 dlon = lon2 - lon1 dlat = lat2 - lat1 a = (sin(dlat/2))**2 + cos(lat1) * cos(lat2) * (sin(dlon/2))**2 c = 2 * atan2(sqrt(a), sqrt(1-a)) distance = R * c print "Result", distance print "Should be", 278.546 The distance it returns is 5447.05546147 . Why? Edit: Just as a note, if you just need a quick and easy way

How do i return coordinates after forward geocoding?

自作多情 提交于 2019-11-26 14:57:50
问题 I am trying to see whether the user is within a certain distance of an address. I have successfully managed to get the users location, and convert the address with forward geocoding. I am left with two sets of coordinates. I am trying to make an if statement saying if they are within "a distance", print something! Currently when i print the coordinates inside the placemark function i get the desired coordinates. When i call them to create eventLatitude and eventLongitude they become 0.0. I

Google Maps: how to get country, state/province/region, city given a lat/long value?

一世执手 提交于 2019-11-26 14:04:24
I need a list of countries, states & cities based on a collection of lat/long values I have. I need to store this information in a manner that hierarchy is preserve and without duplicates (e.g. "USA" and "United States" and "United States of America" are the same country; I only want one instance of this country in my database). Is this possible to do with Google Map API? What you are looking for is called reverse geocoding . Google provides a server-side reverse geocoding service through the Google Geocoding API , which you should be able to use for your project. This is how a response to the