[英]Line or Polygon Object point in Mapbox-gl-js
I work with Mapbox-GL. 我使用Mapbox-GL。 I'm blocking on something that needs to be obvious.
我阻止了一些显而易见的事情。
How can I convert geometry (lng / lat) to point (x, y)? 如何将几何形状(lng / lat)转换为点(x,y)?
There is a "Javascript library" bookseller for this? 有一个“ Javascript库”
书商吗?
Then, if it's a point, line, polygon or multipolygon ... 然后,如果它是点,线,多边形或多多边形...
Thanks! 谢谢!
Use the project
method of the map object. 使用地图对象的
project
方法。
The screenshot is taken from the mapbox-gl-js documentation on project
. 该截图是取自于mapbox-GL-JS文件
project
。
Reference: https://stackoverflow.com/a/23085119/4481169 参考: https : //stackoverflow.com/a/23085119/4481169
map#project
and "geojson-project" github.com/w8r/geojson-project map#project
和“ geojson-project” github.com/w8r/geojson-project
Code sample: 代码示例:
var shape = geojsonProject(object, function(coord) {
var pt = map.project(coord.slice())
return [pt.x, pt.y];
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.