简体   繁体   中英

How to access pixel coordinates using queryRenderedFeatures in Mapbox-gl-js?

Good day!

I want to access x,y pixel coordinates of all the feature's in mapbox-gl-js using queryRenderedFeatures method.

When I console log the feature, I can see only the variable "_vectorTileFeature" that contains the pixel coordinates?

I guess that this "_vectorTileFeature" is an internal variable the Mapbox team might be using and the key also might change in the future.

Is there any other way to access them?

Attaching screenshot: 在此处输入图像描述

Any suggestion would be helpful?

Use map. project(lng, lat) to find the pixel coordinates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM