You are viewing our Forum Archives. To view or take place in current topics click here.
Grab user location(city) in Node without API
Posted:

Grab user location(city) in Node without APIPosted:

dooon
  • Blind Luck
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Hi I was wondering if anyone knew how to get user location of web apps users by using a local database.
I know maxmind exists but for some reason can't get it to work with my version of node, mainly I think because it's the free version..

I don't want to spend $500 for a paid copy & i'm looking for a solutions.

TLDR: Hitting API limits, need User location has it's key part of site functionality.

Nothing illegal about this, it just uses user location to sort by city and is not used for tracking.

Any help much appreciated!
#2. Posted:
-Deano
  • PC Master Race
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
If it's really that much of a problem you can have the user select their city from a list.
#3. Posted:
speed
  • Retired Staff
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
TTG_Hayden wrote I know maxmind exists but for some reason can't get it to work with my version of node, mainly I think because it's the free version..


That's not true if you're using the open source version. You're probably using it incorrectly.

[ Register or Signin to view external links. ]

There are several 3rd party APIs for Node. Even if they didn't work, it would not be difficult to create your own API using the official libraries.
#4. Posted:
dooon
  • TTG Fanatic
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
speed wrote
TTG_Hayden wrote I know maxmind exists but for some reason can't get it to work with my version of node, mainly I think because it's the free version..


That's not true if you're using the open source version. You're probably using it incorrectly.

[ Register or Signin to view external links. ]

There are several 3rd party APIs for Node. Even if they didn't work, it would not be difficult to create your own API using the official libraries.


Yeah i've tried implementing with the geoip , geoip2 & node-geoip.

There seems to be an error reading the mmdb file for some reason.

I wouldn't think all of the packages would be broken and rather that it was my error but i've tried multiple times.

I've got it to work with Ruby and C but I think these APIs are broken.\

geoip2.init('./GeoLite2-Country.mmdb');
  geoip2.lookupSimple("154.20.166.80", (error, result) => {
    if (error) {
      console.log(error);
    } else if (result) {
      console.log(result);
    }
  });


Here's my code.

Error: Error opening MMDB: Error opening the specified MaxMind DB file


Path is correct & mmdb downloaded straight off maxmind.
I tried two different db's.

Have you used it with node?
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.