Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

polygon query: path.map is not a function #1

Open
jaakla opened this issue May 15, 2018 · 2 comments
Open

polygon query: path.map is not a function #1

jaakla opened this issue May 15, 2018 · 2 comments

Comments

@jaakla
Copy link

jaakla commented May 15, 2018

The step8 JS does not work for me, unless with added getArray() like this:

      drawingManager.addListener('polygoncomplete', function (polygon) {
        var path = polygon.getPaths().getAt(0).getArray();
        var queryPolygon = path.map(function(element) {
          return [element.lng(), element.lat()];
        });
        //show an animation to indicate that something is happening.
        fadeToggle(document.getElementById('spinner'));
        polygonQuery(queryPolygon);
      });

@algarecu
Copy link

algarecu commented May 13, 2019

Hey @jaakla i get that working too! kudos for the trick but this google repo still seems to contain code that is full of bugs, for instance often it seems to fail inside the doHeatMap function now: Uncaught TypeError: Cannot read property 'v' of undefined. What v in latCol refers to seems to be the value, which seems to be missing the correct column anyways, depending on the implementation of your particular dataset.

@cartovarc
Copy link

This works for me :)
let queryPolygon = path.Nb.map(element => { return [element.lng(), element.lat()]; });

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

No branches or pull requests

3 participants