Armax / Pokemon-GO-node-api

Pokemon GO api node.js library
MIT License
875 stars 198 forks source link

Google API geocod limit ? #159

Open 4N1S opened 8 years ago

4N1S commented 8 years ago

it worked well until now . Niantic against attack?

TypeError: Cannot read property 'geometry' of undefined ?? var _data$results$0$geome = data.results[0].geometry.location;

sebastianwachter commented 8 years ago

it's working probably a problem with your code

4N1S commented 8 years ago

I have recloned repo directory to another and I start example.js without any change .. I have the same error in files poke.io.js:550 at Request._callback (/Users/NiS/Desktop/travail_ETE_2016/Pokemon_test/node_modules/geocoder/providers/google.js:20:5) at Request.self.callback (/Users/NiS/Desktop/travail_ETE_2016/Pokemon_test/node_modules/geocoder/node_modules/request/main.js:122:22) at emitTwo (events.js:87:13) at Request.emit (events.js:172:7) at Request. (/Users/NiS/Desktop/travail_ETE_2016/Pokemon_test/node_modules/geocoder/node_modules/request/main.js:654:16) at emitOne (events.js:82:20) at Request.emit (events.js:169:7) at IncomingMessage. (/Users/NiS/Desktop/travail_ETE_2016/Pokemon_test/node_modules/geocoder/node_modules/request/main.js:616:14) at emitNone (events.js:72:20)

4N1S commented 8 years ago

I find the solution ! the problem was the limit of GeoCod api google .. It must go through a rental in lat and long . it works !

GeocoderQuotaExceeded: The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time.

brunobarran commented 8 years ago

I solved it. You may get a Geocode Api Key and add it as parameter in every geocode call inside poke.io.js

Example:

geocoder.reverseGeocode.apply(geocoder, _toConsumableArray(GetCoords(self)).concat([function (err, data) {
        if (err) return callback(err);
        if (data && data.status !== 'ZERO_RESULTS' && data.results && data.results[0]) {
          self.playerInfo.locationName = data.results[0].formatted_address;
        }
        callback(null, self.GetLocationCoords());
      }]),{key: 'YOUR KEY'});
coolaj86 commented 8 years ago

It's unnecessary to use the geocoder from the server at all.

If you are using a web ui for the client you can just use google maps with an API key which is easy to get. That's what we do with our Pokémap server and client.

shark0der commented 8 years ago

I'm using this API myself but I'm only feeding it lat/lng coordinates directly because I hit the quota at some point as well. While looking into how to hook the api key into it, I noticed that the geocoder package is completely nuts and doesn't pass the options you pass it to google, so I fixed it for me like this:

https://github.com/shark0der/geocoder/commit/cfd0aaa49d37f50e320aa76f901758b643cd21b9

After a closer look, I noticed that you actually don't need reverse geocoding at all, so I forked this repo and removed that part of code. You can see it here:

https://github.com/shark0der/Pokemon-GO-node-api/commit/69298c2f5ddf585fe12dbb1a8d4bca7cca61fbd0

I can open a pull request as this is the only change I made to the API.

shark0der commented 8 years ago

As I see this might fix #164 as well