GeoIP2 for retrieving city and region ?

  • Thread starter Îικόλας
  • Start date
R

Roy Smith

ÉΪÉ«É»όλας said:
But then how do you explain the fact that
http://www.maxmind.com/en/geoip_demo pinpointed Thessalon£ki and not
Athens and for 2 friends of mine that use the same ISP as me but live
in different cities also accurately identified their locations too?

I just tried 24.136.109.105 on that demo. It comes up with:

US Englewood Cliffs,
New Jersey,
United States,
North America
07632 40.8915,
-73.9471
Time Warner Cable
Time Warner Cable
rr.com
501

Not bad. Google street view shows that as a very pretty residential
neighborhood in one of New York's fancier suburbs. Unfortunately, it
happens to be in run-down industrial building in a factory district
about 20 km away.

There are lots of interesting (and superior) ways to do geolocation
other than looking up IP addresses. Here's a few:

1) GPS. Obviously, if you're on a device that has a GPS receiver and
you have access to that data, and you've got a good signal, nothing is
going to beat GPS. Well, other than Glonass. And Galileo and IRNSS,
whenever they become operational. And whatever the Chinese are calling
theirs.

2) Cell (i.e. mobile) phone tower triangulation. The phone systems know
where all the towers are and know which towers your phone is receiving
signal from. Since they know the signal strengths from each of those
towers, they can do a rough triangulation. It's kind of messy since
signal propagation depends terrain and obstructions which aren't well
mapped. But it's better than nothing.

3) WiFi triangulation. Right now, I can see four WiFi networks (Worb,
J24, MusicWiFi, and jcglinksys). There are databases of WiFi network
names and approximate locations (obtained by wardriving and other ways).
If you can see enough networks, it's easy to look in the database and
figure out where you must be.

4) Who knows what the future will bring. I suppose some day, inertial
nav will become cheap enough that we'll all be walking around with INS
in our phones.

In general, mobile operating systems control direct access to all of
these signals and only allow applications to get the location data when
the user agrees to such access.
 
D

Dennis Lee Bieber

But then how do you explain the fact that
http://www.maxmind.com/en/geoip_demo
pinpointed Thessaloníki and not Athens and for 2 friends of mine that
use the same ISP as me but live in different cities also accurately
identified their locations too?
You have encountered an ISP that reserves IP blocks for specific
suburbs/cities -- and can be tracked thereby. That is, all IPs in
xxx.yyy.zzz.??? may be held for just one neighborhood (granted, I've
defined an old class C network there, but modern network assignments are no
longer in A/B/C (8/16/24 bit network address, with 24/16/8 bit node
addresses) assignments.

It all comes down to how the ISP allocates addresses. It may be that
(as in my case) the ISP is irrelevant -- the IP is issued by the phone
company that actually provides the DSL, and a block of IPs is allocated to
each "central office" of that phone company... And thereby, regardless of
the lease renewal, the IP is still identified as belonging to that central
office location (or whatever location the phone company supplies to the
location service for the IP block).
 
Î

Îικόλας

Στις 13/7/2013 9:19 μμ, ο/η Roy Smith έγÏαψε:
I just tried 24.136.109.105 on that demo. It comes up with:

US Englewood Cliffs,
New Jersey,
United States,
North America
07632 40.8915,
-73.9471
Time Warner Cable
Time Warner Cable
rr.com
501

Not bad. Google street view shows that as a very pretty residential
neighborhood in one of New York's fancier suburbs. Unfortunately, it
happens to be in run-down industrial building in a factory district
about 20 km away.

There are lots of interesting (and superior) ways to do geolocation
other than looking up IP addresses. Here's a few:

1) GPS. Obviously, if you're on a device that has a GPS receiver and
you have access to that data, and you've got a good signal, nothing is
going to beat GPS. Well, other than Glonass. And Galileo and IRNSS,
whenever they become operational. And whatever the Chinese are calling
theirs.

2) Cell (i.e. mobile) phone tower triangulation. The phone systems know
where all the towers are and know which towers your phone is receiving
signal from. Since they know the signal strengths from each of those
towers, they can do a rough triangulation. It's kind of messy since
signal propagation depends terrain and obstructions which aren't well
mapped. But it's better than nothing.

3) WiFi triangulation. Right now, I can see four WiFi networks (Worb,
J24, MusicWiFi, and jcglinksys). There are databases of WiFi network
names and approximate locations (obtained by wardriving and other ways).
If you can see enough networks, it's easy to look in the database and
figure out where you must be.

4) Who knows what the future will bring. I suppose some day, inertial
nav will become cheap enough that we'll all be walking around with INS
in our phones.

In general, mobile operating systems control direct access to all of
these signals and only allow applications to get the location data when
the user agrees to such access.
Do you know a way of implementing anyone of these methods to a script?
 
Î

Îικόλας

Στις 13/7/2013 9:21 μμ, ο/η Dennis Lee Bieber έγÏαψε:
You have encountered an ISP that reserves IP blocks for specific
suburbs/cities -- and can be tracked thereby. That is, all IPs in
xxx.yyy.zzz.??? may be held for just one neighborhood (granted, I've
defined an old class C network there, but modern network assignments are no
longer in A/B/C (8/16/24 bit network address, with 24/16/8 bit node
addresses) assignments.

It all comes down to how the ISP allocates addresses. It may be that
(as in my case) the ISP is irrelevant -- the IP is issued by the phone
company that actually provides the DSL, and a block of IPs is allocated to
each "central office" of that phone company... And thereby, regardless of
the lease renewal, the IP is still identified as belonging to that central
office location (or whatever location the phone company supplies to the
location service for the IP block).

You are right and i can back this up.

While FORTHnet ISP(my ISP) works well with maxmind which can pinpoint
the visitor's exact location other ISPs like Cyta, OTEnet, HOL always
says Europe/Athens.

So it seems that all boil down to the way the ISP configure its blocks
of ip addresses per city.

All should do the same and then it would be an easy task to accurately
identify a visitor by its ip address.
 
R

Roy Smith

There are lots of interesting (and superior) ways to do geolocation
other than looking up IP addresses. Here's a few: . [...]
In general, mobile operating systems control direct access to all of
these signals and only allow applications to get the location data when
the user agrees to such access.
Do you know a way of implementing anyone of these methods to a script?[/QUOTE]

Unfortunately, no. I don't do front-end development. I am aware of the
technologies, but do not know the details of how you access them on any
particular device. I would start with the API docs for the device you
are interested in and look for "location services".
 
W

Wayne Werner

But it works for me, How can it be impossible and worked for me at the
same time?

2 + 2 = 4
2 + 6 = 8???

Why can't I make 2 and 6 equal 4? It worked for 2, so I know it's not
impossible! I don't care what everyone says, I was able to make one case work
so obviously I juat need to figure out how to make it work!


Allegorically,
W
 
W

Wayne Werner

But then how do you explain the fact that
http://www.maxmind.com/en/geoip_demo
pinpointed Thessaloníki and not Athens and for 2 friends of mine that
use the same ISP as me but live in different cities also accurately
identified their locations too?

If you bothered doing something as simple as read the Wikipedia article on
Geolocation, you could answer this question yourself: Evidently you, and your
friends have things like cookies, or some other helps that identify your
location, which is why your addresses are close.

-W
 
C

Chris Angelico

So it seems that all boil down to the way the ISP configure its blocks ofip
addresses per city.

All should do the same and then it would be an easy task to accurately
identify a visitor by its ip address.

So every ISP in the world needs to warp its business to your
convenience. Are you at all thinking about what you're asking for,
here?

ChrisA
 
Î

Îικόλας

Can we get the location serived from lat/long coordinates?

Using a mapping service you can create a query that asks "what is the
smallest region that contains points [(x1, y1), (x2, y2),...]" and use
that as our geolocate answer?

That should work, can you show me how such thing can be done please?
 
Î

Îικόλας

Στις 14/7/2013 8:24 πμ, ο/η Chris Angelico έγÏαψε:
Yes, assuming you get accurate latitude and longitude, so you're back
to square 1.

ChrisA


Dear Freelance,

Thank you for your interest in MaxMind Web Services. We have set up a
demo account which includes the following web service(s):

GeoIP City Demo (1000 lookups available)
Usage:
http://geoip.maxmind.com/b?l=YOUR_LICENSE_KEY&i=24.24.24.24
Example scripts may be found at: http://dev.maxmind.com/geoip/web-services

GeoIP City with ISP and Organization Demo (1000 lookups available)
Usage:
http://geoip.maxmind.com/f?l=YOUR_LICENSE_KEY&i=24.24.24.24
Example scripts may be found at: http://dev.maxmind.com/geoip/web-services

Lets see if that would be of any help.
Please try it too you can request a demo trial of maxminds Geo web services.
 
T

Tim Chase

Yes. Modern browsers all support a location API in the browser for
javascript.

And the good browsers give the user the option to disclose this
information or not (and, as I mentioned elsewhere on this thread,
even lie about where you are such as with the Geolocater plugin[1] for
FF).

Some of us value the modicum of privacy that we receive by not being
locatable by IP address.

-tkc

[1]
https://addons.mozilla.org/en-us/firefox/addon/geolocater/
 
Î

Îικόλας

Στις 13/7/2013 9:17 μμ, ο/η Benjamin Kaplan έγÏαψε:
It's not telling you where your ISP is headquartered. It's telling you
where the servers that you're connecting to are. In your case, you're
connecting to servers that your Athens-based ISP has in a Thessaloniki
datacenter. The only way to get an accurate location is to use
something other than IP- phones like to use a combination of their
GPS, a map of the cell phone towers, and a map of wi-fi hotspots (this
is one of the things that Google's StreetView cars log as they drive).

Actually that happens only for my ISP(FORTHnet).
For other ISPs all locations boil down just to Europe/Athens.
This happens to be because my ISP's network scheme is to assign blcoks
of ip addresses per city in Greek area.

Same thing doesn't apply for others ISPs unfortunately here in Greece.

I have no idea how to implement the solution you proposed.
These are nice ideas we need to have a way of implement them within a
script.

I have no way of grasping a map of cell towers of a map of wi-fi hotspots.
 
D

Dennis Lee Bieber

???? 13/7/2013 9:17 ??, ?/? Benjamin Kaplan ??????:
I have no idea how to implement the solution you proposed.
These are nice ideas we need to have a way of implement them within a
script.

I have no way of grasping a map of cell towers of a map of wi-fi hotspots.
You don't... The phone company knows where their towers are, THEY do
the triangulation based on signal strength from cell phones on their
network, and they provide that position to the phone. The phone can then
use that data to respond to applications running ON the phone that request
location information using the phone's OS API (which is different for an
Android phone vs Blackberry vs Apple).

WiFi hotspots would require an application running on the mobile device
accessing some database of hotspots; so the application can do the
triangulation based upon the signal strength it is receiving from the
hotspots (this is the opposite of how the phone location is done: phone
company uses signal strength to assign the control tower, so they can do
the triangulation at their end; WiFi would be triangulated on the mobile as
it is doing the decision of which hotspot to connect through).

In either case, it still comes down to relying on the client machine
for location services. A desktop machine with a wired connection is not
going to be running location services. A mobile device using WiFi is also
likely to NOT be running a location service -- but has the possibility of
having an application loaded and run which does access a WiFi database to
do triangulation (but this application probably has to run in Administrator
mode as it would need to access the WiFi adapter to scan for hotspots and
signal strengths).
 
M

Michael Torrie

You don't... The phone company knows where their towers are, THEY do
the triangulation based on signal strength from cell phones on their
network, and they provide that position to the phone. The phone can then
use that data to respond to applications running ON the phone that request
location information using the phone's OS API (which is different for an
Android phone vs Blackberry vs Apple).

I've posted a link to detailed information on this no less than three
times, yet Nikos has not read any of it, sadly.
 
Î

Îικόλας

Στις 14/7/2013 1:57 πμ, ο/η Michael Torrie έγÏαψε:
Yes. Modern browsers all support a location API in the browser for
javascript. See this:

http://diveintohtml5.info/geolocation.html

Lest say i embed inside my index.html the Javascript Geo Code.

Is there a way to pass Javascript's outcome to my Python cgi script somehow?

Can Javascript and Python Cgi somehow exchnage data?
 
J

Joel Goldstick

Στις 14/7/2013 1:57 πμ, ο/η Michael Torrie έγÏαψε:

Lest say i embed inside my index.html the Javascript Geo Code.

Is there a way to pass Javascript's outcome to my Python cgi script
somehow?

Can Javascript and Python Cgi somehow exchnage data?

Learn about ajax
 
A

alex23

I've posted a link to detailed information on this no less than three
times, yet Nikos has not read any of it, sadly.

Just a quick reminder for everyone:

"Ferrous Cranus is utterly impervious to reason, persuasion and new
ideas, and when engaged in battle he will not yield an inch in his
position regardless of its hopelessness. Though his thrusts are
decisively repulsed, his arguments crushed in every detail and his
defenses demolished beyond repair he will remount the same attack again
and again with only the slightest variation in tactics."

http://www.politicsforum.org/images/flame_warriors/flame_62.php
 
D

Dennis Lee Bieber

Lest say i embed inside my index.html the Javascript Geo Code.

Is there a way to pass Javascript's outcome to my Python cgi script somehow?

Can Javascript and Python Cgi somehow exchnage data?

Using plain CGI is going to be painful -- since /everything/ is handled
a whole new page request. You would have to handle session cookies, etc.

Your "index.html" would attempt to run the JavaScript (note that some
users may have JavaScript turned off -- how will you handle that), if it
gets information it would have to do a "GET index2.html?lat=xxx?long=yyy"
or something similar, which will result in a new page load on the user --
hopefully with a cookie set so you know NOT to run the geolocation code on
subsequent pages.

AJAX is a process to allow JavaScript on the browser to interact with a
server (using XML data structures), and likely use DOM operations in the
browser (and the last time I did something on this nature, I had to have
different code for Internet Explorer vs Firefox, and don't know of
Chrome/Opera share one of the others calls) to make changes on the web page
without doing a full submit/render operation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top