D
D
dkudelko2014-12-16 09:29:27
Node.js
dkudelko, 2014-12-16 09:29:27

What's wrong with node.js multi-geocoder TypeError: Expecting a function in instanceof check, but got #Object] answer?

took an example from https://www.npmjs.com/package/multi-geocoder
package installed.
my code

var MultiGeocoder = require('multi-geocoder'),
    geocoder = new MultiGeocoder({ provider: 'yandex', coordorder: 'latlong' });

geocoder.geocode(['Moscow', 'New York', 'Paris', 'London'])
    .then(function (res) {
        console.log(res);
    });

in the response (log) such an error
{ result: { type: 'FeatureCollection', features: [] },
  errors: 
   [ { request: 'Moscow',
       index: 0,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] },
     { request: 'New York',
       index: 1,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] },
     { request: 'Paris',
       index: 2,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] },
     { request: 'London',
       index: 3,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] } ] }

Not a very big specialist in node.js to understand this
. Can someone tell me what is missing?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
smanioso, 2014-12-16
@smanioso

Everything works great. Here is the returned result:

$ node geocode.js 
{ result: 
   { type: 'FeatureCollection',
     features: [ [Object], [Object], [Object], [Object] ] },
  errors: [] }

[ { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Москва',
       description: 'Россия',
       metaDataProperty: [Object] } },
  { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Нью-Йорк',
       description: 'Соединённые Штаты Америки',
       metaDataProperty: [Object] } },
  { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Париж',
       description: 'Иль-Де-Франс, Франция',
       metaDataProperty: [Object] } },
  { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Лондон',
       description: 'Англия, Великобритания',
       metaDataProperty: [Object] } } ]

For beauty added to the output:
console.log(res.result.features);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question