Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverse geocode of a ocean #4

Open
nanu-c opened this issue Dec 20, 2014 · 0 comments
Open

reverse geocode of a ocean #4

nanu-c opened this issue Dec 20, 2014 · 0 comments

Comments

@nanu-c
Copy link

nanu-c commented Dec 20, 2014

this code

Meteor.methods({
  get_country: function(latlng) {
    try {
    var geo2 = new GeoCoder({
      geocoderProvider: "openstreetmap",
      httpAdapter: "http"
    });
    console.log("lookupCountryCode ");
      var result2 = geo2.reverse(latlng.lat,latlng.lng);
      if (result2[0].countryCode!=undefined) return result2[0].countryCode;
    }
    catch (e){return "sea";}

  }
});

gets me an error, when i try to reverse decode a place not on a continent.

=> Meteor server restarted                    
I20141220-10:04:09.126(1)? lookupCountryCode 
W20141220-10:04:09.322(1)? (STDERR) 
W20141220-10:04:09.323(1)? (STDERR) /home/nanu/.meteor/packages/aldeed_geocoder/.0.3.3.1rw72ym++os+web.browser+web.cordova/npm/node_modules/node-geocoder/lib/geocoder/openstreetmapgeocoder.js:55
W20141220-10:04:09.324(1)? (STDERR)         'country' : result.address.country,
W20141220-10:04:09.324(1)? (STDERR)                                   ^
W20141220-10:04:09.325(1)? (STDERR) TypeError: Cannot read property 'country' of undefined
W20141220-10:04:09.325(1)? (STDERR)     at [object Object].OpenStreetMapGeocoder._formatResult (/home/nanu/.meteor/packages/aldeed_geocoder/.0.3.3.1rw72ym++os+web.browser+web.cordova/npm/node_modules/node-geocoder/lib/geocoder/openstreetmapgeocoder.js:55:35)
W20141220-10:04:09.326(1)? (STDERR)     at /home/nanu/.meteor/packages/aldeed_geocoder/.0.3.3.1rw72ym++os+web.browser+web.cordova/npm/node_modules/node-geocoder/lib/geocoder/openstreetmapgeocoder.js:84:36
W20141220-10:04:09.326(1)? (STDERR)     at IncomingMessage.<anonymous> (/home/nanu/.meteor/packages/aldeed_geocoder/.0.3.3.1rw72ym++os+web.browser+web.cordova/npm/node_modules/node-geocoder/lib/httpadapter/httpadapter.js:42:17)
W20141220-10:04:09.327(1)? (STDERR)     at IncomingMessage.emit (events.js:117:20)
W20141220-10:04:09.327(1)? (STDERR)     at _stream_readable.js:943:16
W20141220-10:04:09.328(1)? (STDERR)     at process._tickCallback (node.js:419:13)
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant