Skip to content

MapUtils

Type module

Sources

Items from MapUtils can be imported/included and used via following ways.

/**
* Import via: MapUtils.ts
* Access items like: $maputils.myVariable
*/
import * as $maputils from "@amcharts/amcharts5/MapUtils";

Variables

MapUtils does not have any variables.

Functions

getGeoArea(geometry: GeoJSON.GeometryObject)

Returns number

Returns the area of a geometry on a sphere of radius 1, in steradians: the whole globe is 4π.

getGeoBounds(geometry: GeoJSON.GeometryObject)

Returns { bottom: number, left: number, right: number, top: number }

Returns the geographic bounds of a geometry, in degrees: longitudes left and right, latitudes top and bottom. Bounds across the 180th meridian take all longitudes, -180 to 180.

getGeoCentroid(geometry: GeoJSON.GeometryObject)

Returns IGeoPoint

Returns the geographic centroid of a geometry.

getGeoCircle(geoPoint: IGeoPoint,
radius: number
)

Returns Polygon

Returns a circle on the globe as GeoJSON geometry, for the geometry of a MapPolygon.

getGeoRectangle(north: number,
east: number,
south: number,
west: number
)

Returns MultiPolygon

Returns the area between two latitudes and two longitudes as GeoJSON geometry, for the geometry of a MapPolygon. Its edges follow the parallels and meridians.

getSunPosition(date: Date)

Returns IGeoPointSince 5.21.0

Returns the point where the sun is directly overhead at a given time, such as for the sunPosition of a MapRasterSeries. Accurate to a fraction of a degree.

normalizeGeoPoint(geoPoint: IGeoPoint)

Returns IGeoPoint

Brings a point's longitude within -180 to 180 and its latitude within -90 to 90: a latitude past a pole comes back down on the other side.

Changes geoPoint itself and returns it.