The Location map currently only allows lookup up by name to yield the latitude and longitude. There is a package called PySubnetTree that does efficient lookup of IP addresses against subnets like this. We are working on a big new release of the code and I'll include part of this package as a sample that will show how to do this kind of lookup.
If you want to take a crack at some of it now, here's the basics of using PySubnetTree:
First, you need to install it. The easiest is via 'pip':
$ pip install -e git+git://git.bro.org/pysubnettree.git#egg=pysubnettree
If you have it installed in a virtual environment, be sure to run this command within the venv.
Once installed, here's a python snippet that shows how to add entries and lookup entries:
>>> from SubnetTree import SubnetTree >>> tree = SubnetTree() >>> tree['10.0.0.0/8'] = 'Massachusetts' >>> tree['10.1.0.0/16'] = 'Boston' >>> tree['10.2.0.0/16'] = 'Cambridge' >>> print tree['10.1.2.3'] Boston >>> print tree['10.2.3.4'] Cambridge >>> print tree['10.3.4.5'] Massachusetts
We'll make a note of integrating this into the Location lookup an map code.