geos.GEOSArea ⇒ number
⏏
Calculate the area of a geometry.
Kind: Exported member
Returns: number
- 1 on success, 0 on exception
See: https://libgeos.org/doxygen/geos__c_8h.html#af5eec7e8796b756cf007fd21bb3a88ad
Param | Type | Description |
---|---|---|
g | number | A pointer to a GEOSGeometry object |
area | number | A pointer to be filled in with area result |
Example
js
const reader = geos.GEOSWKTReader_create()
const wkt = 'POLYGON((0 0,0 10,10 10,10 0,0 0))'
const size = wkt.length + 1
const wktPtr = geos.Module._malloc(size)
geos.Module.stringToUTF8(wkt, wktPtr, size)
const g = geos.GEOSWKTReader_read(reader, wktPtr)
geos.Module._free(wktPtr)
const area = geos.Module._malloc(8)
geos.GEOSArea(g, area)
const areaValue = geos.Module.getValue(area, 'double')
console.log(areaValue) // 100
geos.GEOSArea_r ⇒ number
⏏
Calculate the area of a geometry using a custom context handle.
Kind: Exported member
Returns: number
- 1 on success, 0 on exception
Param | Type | Description |
---|---|---|
handle | number | A GEOSContextHandle_t object |
g | number | A pointer to a GEOSGeometry object |
area | number | A pointer to be filled in with area result |