helpers library

Classes

BBox
Please make sure, you arrange your parameters like this: Longitude 1, Latitude 1, Altitude 1 (optional), Longitude 2, Latitude 2, Altitude 2 (optional) You can either specify 4 or 6 parameters If you are using the default constructor with two dimensional positions (lng + lat only), please use the constructor like this: BBox(lng1, lat1, lng2, lat2);
CoordinateType
Coordinate types, following https://tools.ietf.org/html/rfc7946#section-4
Feature<T extends GeometryObject>
Feature, as specified here https://tools.ietf.org/html/rfc7946#section-3.2
FeatureCollection<T extends GeometryObject>
FeatureCollection, as specified here https://tools.ietf.org/html/rfc7946#section-3.3
GeoJSONObject
GeometryCollection
GeometryCollection, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.8
GeometryObject
GeometryType<T>
LineString
LineString, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.4
MultiLineString
MultiLineString, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.5
MultiPoint
MultiPoint, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.3
MultiPolygon
MultiPolygon, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.7
Point
Point, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.2
Polygon
Polygon, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.6
Position
Please make sure, you arrange your parameters like this:

Enums

CoordinateSystem
Coordinate reference systems for spatial data
Corner
DistanceGeometry
Whether to calculate the distance based on geodesic (spheroid) or planar (flat) method.
GeoJSONObjectType
Grid
Unit

Constants

areaFactors → const Map<Unit, num>
Area of measurement factors based on 1 square meter.
conversionEarthRadius → const double
Earth radius in meters used for coordinate system conversions
coordSystemConstants → const Map<String, double>
Coordinate system conversion constants
earthRadius → const double
Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
factors → const Map<Unit, num>
Unit of measurement factors using a spherical (non-ellipsoid) earth radius. Keys are the name of the unit, values are the number of that unit in a single radian
mercatorLimit → const double
Maximum extent of the Web Mercator projection in meters
unitsFactors → const Map<Unit, num>

Functions

bearingToAzimuth(num bearing) num
Converts any bearing angle from the north line direction (positive clockwise) and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line
convertArea(num area, [dynamic originalUnit = Unit.meters, dynamic finalUnit = Unit.kilometers]) num
Converts a area to the requested unit. Valid units: Unit.kilometers, Unit.meters, Unit.centimeters, Unit.millimeters, Unit.acres, Unit.miles, Unit.yards, Unit.feet, Unit.inches
convertCoordinates(Position coord, CoordinateSystem fromSystem, CoordinateSystem toSystem) Position
Converts coordinates from one system to another.
convertLength(num length, [Unit originalUnit = Unit.kilometers, Unit finalUnit = Unit.kilometers]) num
Converts a length to the requested unit. Valid units: Unit.miles, Unit.nauticalmiles, Unit.inches, Unit.yards, Unit.meters, Unit.kilometers, Unit.centimeters, Unit.feet
degreesToRadians(num degrees) num
Converts an angle in degrees to radians
lengthToDegrees(num distance, [Unit unit = Unit.kilometers]) num
Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees Valid units: Unit.miles, Unit.nauticalmiles, Unit.inches, Unit.yards, Unit.meters, Unit.centimeters, Unit.kilometers, Unit.feet
lengthToRadians(num distance, [Unit unit = Unit.kilometers]) num
Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians Valid units: Unit.miles, Unit.nauticalmiles, Unit.inches, Unit.yards, Unit.meters, Unit.kilometers, Unit.centimeters, Unit.feet
radiansToDegrees(num radians) num
Converts an angle in radians to degrees
radiansToLength(num radians, [Unit unit = Unit.kilometers]) num
Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit. Valid units: Unit.miles, Unit.nauticalmiles, Unit.inches, Unit.yards, Unit.meters, Unit.kilometers, Unit.centimeters, Unit.feet
round(num value, [num precision = 0]) num
Round number to precision
toMercator(Position coord) Position
Converts a WGS84 coordinate to Web Mercator.
toWGS84(Position coord) Position
Converts a Web Mercator coordinate to WGS84.