Skip to contents

This function takes in latitude and longitude vectors and calculates the area of the polygon defined by those points. It can handle different coordinate systems such as WGS-84, GCJ-02, and BD-09.

Usage

areaCalculator(longitude, latitude, coordinate = "WGS-84", chull = TRUE)

Arguments

longitude

A numeric vector of longitude points.

latitude

A numeric vector of latitude points.

coordinate

A string indicating the coordinate system of the input points, can be "WGS-84", "GCJ-02", or "BD-09". Default is "WGS-84".

chull

A logical value indicating whether to use the convex hull of the points. Default is TRUE.

Value

A numeric value representing the area of the polygon in square meters.

Examples

area <- areaCalculator(
  longitude = c(121.0, 122.1, 121.2, 122.15, 121.2),
  latitude =  c(31.1, 31.919, 31.917, 31.15, 31.12), coordinate = "WGS-84"
)