简体   繁体   中英

Calculate area & perimeter of a geojson feature of GeojsonLayer in deck.gl

I am using deck.gl to render a geojsonlayer using their geojsonlayer function, where the source of data is a geojson file.

Now I want display an infowindow to show area & perimeter of each feature, when clicked on them on the map. I have managed to fetch the properties object of a particular feature and show its reverse geocode address and display them in the infoWindow (pic below), 在此处输入图片说明

which also gives me access to the geofence coordinates of that particular feature. But I am not able to find any function from the documentation that allows us to calculate the area. Is there anything I missed here? Or Do I have to calculate it manually based on cartesian space and spheroid?

我发现 turf.js 可以计算 geojson 特征的面积和周长。

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