Repository

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

Params:

NameTypeAttributeDescription
longituteNumber
latitudeNumber
zoomNumber

zoom factor fo this map

mapCoordArray

MapBox/TileMill map coords array, like [-180,-85.0511,180,85.0511]

mapWidthNumber

the map width in pixels

mapHeightNumber

the map height in pixels

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.

Params:

NameTypeAttributeDescription
longituteNumber

longitute

latitudeNumber

latitude

zoomNumber

the zoom factor fo this map

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!

Params:

NameTypeAttributeDescription
longitudeNumber
latitudeNumber
radiusNumber

Return:

Object

{x, y, z} coordinates

public static latY(lat: Number): Number source

latitude to absolute y coord

Params:

NameTypeAttributeDescription
latNumber

Return:

Number

pixel coordinate

public static lngX(lon: Number): Number source

latitude to absolute x coord

Params:

NameTypeAttributeDescription
lonNumber

Return:

Number

pixel coordinate

public static xLng(x: *): * source

Params:

NameTypeAttributeDescription
x*

Return:

*

public static yLat(y: *): * source

Params:

NameTypeAttributeDescription
y*

Return:

*