Search code examples
javascriptpolygonmapbox-gl-jsturfjs

Line or Polygon Object point in Mapbox-gl-js


I work with Mapbox-GL. I'm blocking on something that needs to be obvious.

How can I convert geometry (lng / lat) to point (x, y)?

There is a "Javascript library" bookseller for this?

Then, if it's a point, line, polygon or multipolygon ...

Thanks!


Solution

  • Use the project method of the map object.

    project description

    The screenshot is taken from the mapbox-gl-js documentation on project.

    Reference: https://stackoverflow.com/a/23085119/4481169