Need: general API for IP location data?

There's currently no recognized IP location solution that can be relied on by module authors. Here's a quick summary of the need and a potential approach.

Currently we have at least the following modules, each taking a different approach to using external services to determine a user's location based on IP address data:

In sum, we have various different solutions, each with their own distinct methods, each supporting only a single proprietary external data source, and each producing data in its own format.

As well, most or all of the solutions combine various functionality (ads, user UI, node-related functionality, etc.) that may or may not be of use or interest to other modules that need only the base functionality of fetching locational data by IP address.

What would a solution to this situation look like?

Presumably it would be a generic API module that provided a common set of methods for fetching and returning IP location data and then a way for specific implementations to register themselves.

Does this sound right? Is it needed? Ideas, gotchas?

Comments

Open source data for IP location?

tom_o_t's picture

Is there an open source place to get this data? As nedjo pointed out, the existing modules all use proprietary data sources. I had a quick search and didn't come across any.

This would be a really helpful module, and I agree with your suggested approach of creating a generic API that the individual proprietary or (ideally) open source IP lookups can be plugged into.

Agreed! But why stop at IP?

Allie Micka's picture

This is a much more general problem. One I'd like to solve with the 'geocode' module. Fundamentally, you have some piece of information ( a file, an address, a string containing a place name or an IP address) and you want some piece of geographic data returned for it ( be it a name, a geospatial record, etc. )

I'd really like to see/ work on a system that supports handlers for accepting input types, running them through a handler, and returning geospatial information in the requested format. The handler could look stuff up in a local database, hit a web service, reformat the input, etc.

While I don't have a whole lot of time to elaborate, perhaps that's a hint in the right direction?

Geocode API

Allie Micka's picture

Over the weekend, I released a work-in-progress Geocode module, which provides an abstraction for geocoding. It's shipping with a few proof-of-concept handlers: Postal-to-point geocoding, and an EXIF parser. I plan to add others.

Basically, the goal is to accept information from a variety of input formats (place names, ip addresses, postal addresses, file uploads), and return a variety of output formats ( place names, postal addresses, coordinates, shapes ). If you're crafty with Drupal, the code should make sense.

The module also ships with a Widget for the Geo module, which can store data that is derived from other fields on the same node.

Where do I get the module?

TheOverclocked's picture

Where do I get the module? There are no releases....

Location and Mapping

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week