import GPSUtils from '@mobilizing/library/js/Mobilizing/input/GPSUtils.js'
GPSUtils
Some GPS coordinates convertion tools to use maps in Mobilizing.js
Static Method Summary
Static Public Methods | ||
public static | getCoordinateInMap(longitute: Number, latitude: Number, zoom: Number, mapCoord: Array, mapWidth: Number, mapHeight: Number): * Compute GPS coordinates into pixels x, y coordinates in a map. | |
public static | getPixelsCoordsFromOSMLngLat(longitute: Number, latitude: Number, zoom: Number): {"x": *, "y": *} Converts longitude and latitude coords (from an OpenStreetMap map) into absolute pixels coords. | |
public static | getPolarFromLngLat(longitude: Number, latitude: Number, radius: Number): Object Convert GPS coords to cartesian coords. | |
public static | latitude to absolute y coord | |
public static | latitude to absolute x coord | |
public static | xLng(x: *): * | |
public static | yLat(y: *): * |
Static Public Methods
public static getCoordinateInMap(longitute: Number, latitude: Number, zoom: Number, mapCoord: Array, mapWidth: Number, mapHeight: Number): * source
Compute GPS coordinates into pixels x, y coordinates in a map. Here, we adopt the OSM standard for mappinp. Therefore, you should generate your bitmap earth map with a tool using OSM tiles (like MapBox, TileMill). You should give the zoom factor and the map bounds (in lognititude and latitude) to this method for the calculation to be effective
Return:
* |
public static getPixelsCoordsFromOSMLngLat(longitute: Number, latitude: Number, zoom: Number): {"x": *, "y": *} source
Converts longitude and latitude coords (from an OpenStreetMap map) into absolute pixels coords. This method don't calculate the pixels coords within a given map bound's! Use getCoordinateInMap for this.
Return:
{"x": *, "y": *} |
public static getPolarFromLngLat(longitude: Number, latitude: Number, radius: Number): Object source
Convert GPS coords to cartesian coords. NB : this algorithm is adapted to three.js geoms!
Return:
Object | {x, y, z} coordinates |
public static latY(lat: Number): Number source
latitude to absolute y coord
Params:
Name | Type | Attribute | Description |
lat | Number |
Return:
Number | pixel coordinate |